@Override protected void processElement(Element<CatalogElement> element) throws Exception { String extId = element.getData().getExtId(); metadataImporter.cleanMetadata(extId); }
@Override protected Chunk doProcessChunk(Chunk data, Map<String, Serializable> context, IProcessListener processListener, ProcessingStats stats) throws Exception { for (CatalogElement element : data.getItems()) { String extId = element.getExtId(); metadataImporter.cleanMetadata(extId); } return data; }
log.warn("no parent relation defined in " + ce.getExtId() + " for hierarchy " + hierarchyExtId + " and level " + levelExtId); return null; } else { log.warn("no parent relations defined in " + ce.getExtId() + " for hierarchy " + hierarchyExtId); return null; log.warn("no parent relations defined in " + ce.getExtId()); return null;
@Override public void process( LicenseProcessingContext<CatalogElement, LicenseCollectionHolder> ctx) throws LicenseProcessorException { if (isSupportedCollection(ctx.getElement())) { try { log.debug("processing element extId: " + ctx.getElement().getExtId()); Set<String> titlegroupLicenses = dispatchProcessing(ctx); if (titlegroupLicenses != null) { ctx.getBatchHolder().addAllLicenses(titlegroupLicenses); } } catch (CatalogException e) { throw new LicenseProcessorException(e); } catch (YaddaException e) { throw new LicenseProcessorException(e); } } else { log.debug("unsupported collection of element " + ctx.getElement().getExtId() + ", only the following collections: " + StringUtils.join(supportedCollectionNames, ";") + ") are supported"); } }
StackTraceUtil.getStackTrace(e)); for (final CatalogElement item : data.getItems()) { processListener.notifyEvent("chunkProcessing.item", new String[]{data.getId(), item.getExtId()}, EventResultCode.ERROR, null);
@Override protected Chunk doProcessChunk(final Chunk data, final Map<String, Serializable> context, final IProcessListener processListener, final ProcessingStats stats) throws Exception { final Batch batch = browserFacade.relation(SubscriberView.VIEW_NAME).batch(); for (final CatalogElement ce : data.getItems()) { try { batch.delete(Condition.eq(SubscriberView.FIELD_ELEMENT_ID, ce.getExtId())); if (!ce.isDeleted() && ce.getElement() != null) { final Serializable[][] tuples=SubscriberView.asTuples(ce); for (final Serializable[] tuple : tuples) { batch.add(tuple); } } } catch (final Exception e) { if (processListener != null) { processListener.notifyEvent("subscriberViewGenerator.process", new String[]{ce.getExtId()}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(e)); } log.error("Exception processing element " + ce.getExtId()); throw e; } } batch.run(); return data; }
@Override protected Chunk doProcessChunk(final Chunk data, final Map<String, Serializable> context, final IProcessListener processListener, final ProcessingStats stats) throws Exception { final ComplexEditorStorageBatchHolder batchHolder = new ComplexEditorStorageBatchHolder(); for (final CatalogElement e : data.getItems()) { try { if (e.getElement() != null || e.getNonElement()!=null) { processElement(e, context, batchHolder); } } catch (final Exception ex) { if (processListener != null) { processListener.notifyEvent("licenceResolver.process", new String[]{e.getExtId()}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(ex)); } log.error("Exception processing licenses for element" + e.getExtId(), ex); throw ex; } } data.getCustomEditorOperations().addAll(batchHolder.getEditorBatchToRead()); data.getCustomStorageOperations().addAll(batchHolder.getStorageBatchToRead()); return data; }
ce.getExtId())); } else if (ce.getNonElement() != null && ce.getNonElement() instanceof Category) { (Category) ce.getNonElement()); batch.addOrUpdate(Condition.eq(CategoryView.FIELD_EXTID, ce.getExtId()), tuple); processListener.notifyEvent( "categtoryViewGenerator.process", new String[]{ce.getExtId()}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(e)); log.error("Exception processing element" + ce.getExtId()); throw e;
@Override protected Chunk doProcessChunk(final Chunk data, final Map<String, Serializable> context, final IProcessListener processListener, final ProcessingStats stats) throws Exception { final Batch batch = browserFacade.relation(ContributorView.CONTRIBUTOR_VIEW_NAME).batch(); for (final CatalogElement ce : data.getItems()) { try { batch.delete(Condition.eq(ContributorView.FIELD_ELEMENT_ID, ce.getExtId())); if (!ce.isDeleted() && ce.getElement() != null) { final Serializable[][] tuples=ContributorView.asTuples(ce.getElement(), contributorInfoBuilder); for (final Serializable[] tuple : tuples) { batch.add(tuple); } } } catch (final Exception e) { if (context.containsKey(Constants.PARAM_DISABLE_AGGREGATIONS_DURING_REBUILD)) { browserFacade.relation(ContributorView.CONTRIBUTOR_VIEW_NAME).setAggregatingEnabled(false, false); } if (processListener != null) { processListener.notifyEvent("contributorViewGenerator.process", new String[]{ce.getExtId()}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(e)); } log.error("Exception processing element " + ce.getExtId()); throw e; } } batch.run(); return data; }
@Override protected Chunk doProcessChunk(Chunk data, Map<String, Serializable> context, IProcessListener processListener, ProcessingStats stats) throws Exception { final Batch batch = browserFacade.relation(ElementPublisherView.ELEMENT_PUBLISHER_VIEW_NAME).batch(); for (final CatalogElement catalogElement : data.getItems()) { try { batch.delete(Condition.eq(ElementPublisherView.FIELD_PUBLISHED_ELEMENT_EXTID, catalogElement.getExtId())); if (!catalogElement.isDeleted() && catalogElement.getElement() != null && hasRelatedPublisher(catalogElement)) { final List<Serializable[]> tuples = ElementPublisherView.asTuples(catalogElement, contributorInfoBuilder, bwmetaSource); for (final Serializable[] tuple : tuples) { batch.add(tuple); } } } catch (final Exception e) { if (context.containsKey(Constants.PARAM_DISABLE_AGGREGATIONS_DURING_REBUILD)) { browserFacade.relation(ElementPublisherView.ELEMENT_PUBLISHER_VIEW_NAME).setAggregatingEnabled(false, false); } if (processListener != null) { processListener.notifyEvent("elementPublisherViewGenerator.process", new String[]{catalogElement.getExtId()}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(e)); } log.error("Exception processing element " + catalogElement.getExtId()); throw e; } } batch.run(); return data; }
public CDocument convert(CatalogElement ce) throws YaddaException { Element el = ce.getElement(); if (el==null) { return null; } CDocument doc = new CDocument(); doc.setId(ce.getExtId()); doc.setText(getText(el)); // we ignore language only if it is not valid iso 639-1 language code if (!el.getLanguages().isEmpty()) { String lang = StringUtils.defaultString(LanguageUtils.canonicalLang(el.getLanguages().get(0))); if (LanguagesIso639_1.isValid(lang)) { doc.setLanguage(lang); } } return doc; }
+ ctx.getElement().getExtId()); return null;
/** * Retrieves publication date from ancestors or null when not found. * @param ce * @return */ protected Date getPublicationDateFromAncestors(CatalogElement ce) { if (ce!=null && ce.getAncestors()!=null) { List<Ancestor> anc = ce.getAncestors().getAncestorsOfHierarchy(ID_HIERARACHY_JOURNAL); if (anc!=null) { for (Ancestor currentAnc : anc) { if (currentAnc.getPublishedDate()!=null) { try { return currentAnc.getPublishedDate().getDate(); } catch (ParseException e) { log.error("unable to retrieve publication date from ancestor " + currentAnc.getExtid() + " of level " + currentAnc.getLevelExtid() + " of element " + ce.getExtId(), e); } } } } } // fallback return null; }
ctx.getElement().getExtId()); } else { try {
@Override protected Chunk doProcessChunk(final Chunk data, final Map<String, Serializable> context, final IProcessListener processListener, final ProcessingStats stats) throws Exception { final Batch batch = browserFacade.relation(TypeView.TYPE_VIEW_NAME).batch(); for (final CatalogElement ce : data.getItems()) { try { if (ce.isDeleted()) { batch.delete(Condition.eq(TypeView.FIELD_EXTID, ce.getId().getId())); } else if (ce.getElement() == null && ce.getNonElement() != null) { String extId = null; extId = ce.getNonElement().getExtId(); final Serializable[] tuple = TypeView.asTuple(ce.getNonElement()); batch.addOrUpdate(Condition.eq(TypeView.FIELD_EXTID, extId), tuple); } else if (ce.isDeleted()) { batch.delete(Condition.eq(TypeView.FIELD_EXTID, ce.getExtId())); } } catch (final Exception e) { log.error("Exception processing element " + ce.getExtId()); if (processListener != null) { processListener.notifyEvent("typeViewGenerator.process", new String[]{ce.getExtId()}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(e)); } throw e; } } batch.run(); return data; }
/** * Converts CatalogElement to SimilarityDocument. Note that this method does * not categorize elements and so categorization should occur before this * convertion. * * @see CatalogElementToCDocumentConverter */ public SimilarityDocument convert(CatalogElement ce) throws YaddaException { Element el = ce.getElement(); if (el == null) { return null; } SimilarityDocument doc = new SimilarityDocument(); doc.setId(ce.getExtId()); doc.setName(StringUtils.defaultString(el.getDescription())); doc.setText(getText(el, ce.getLanguage())); doc.setAuthors(getAuthors(el)); doc.setCategory(ce.getCategory()); doc.setLanguage(ce.getLanguage()); if (ce.getLicenses() != null) { doc.setLicenses(new ArrayList<String>(ce.getLicenses())); } prepareValues(ce, doc); return doc; }
if (ce.isDeleted()) { batch.delete(Condition.eq(ContentView.EXTID, ce.getExtId())); } else { final Element e = ce.getElement(); final String archiveid = o.getId().getId(); batch.addOrUpdate(Condition.eq(ContentView.ARCHIVE_ID, archiveid), ContentView.tuple(archiveid, articleid, issn, cf.getMimeType(), ce.getExtId()));