private String _getAncestorId(Ancestors ancestors, String levelId){ Ancestor ancestor = ancestors.getAncestorAtLevel(levelId); if(ancestor==null) return ""; else return ancestor.getExtid(); }
@Override public void process(final SElement sel, final Ancestor ref) { if (sel.getPublishDate() == null) { final String n = ref.getDefaultNameText(); if (n.matches("[0-9]{4}")) { final int i = Integer.parseInt(n); final Calendar c = new GregorianCalendar(i, 1, 1); sel.setPublishDate(new SDate(c.getTime(), Precision.YEAR)); } else { log.warn( "Year does not match required regexp. Cannot use it to generate publication date (year name='{}', element id='{}')", n, ref.getExtid()); } } } }
@Override public Map<String, Serializable> provideParams(YaddaObjectID id, ParamProviderContext<CatalogObject<String>> context) throws ParamProviderException { Map<String, Serializable> result = new HashMap<String, Serializable>(); String ancestorsXML = getAncestorsXML(id, context); if (ancestorsXML!=null) { Ancestors ancestors = (Ancestors) ancestorSerializer.toObject( null, ancestorsXML); List<Ancestor> journalAncestors = ancestors.getAncestorsOfHierarchy( RepositoryStringConstants.HIERARCHY_JOURNAL); if (journalAncestors!=null && journalAncestors.size()>0) { String[] array = new String[journalAncestors.size()]; for (int i=0; i<journalAncestors.size(); i++) { array[i] = journalAncestors.get(i).getExtid(); } result.put(ANCESTORS_PARAM_KEY_NAME, array); } return result; } else { throw new ParamProviderException("unable to find ancestors part " + "for id: " + id); } }
new YaddaObjectID(currentAncestor.getExtid()), ACLConstants.ACL_PART_NAME, null); if (aclPart!=null && aclPart.getData()!=null) { if (log.isDebugEnabled()) { log.debug("got valid policy: " + result.getId() + " from ancestor: " + currentAncestor.getExtid() + " of level: " + currentAncestor.getLevelExtid()); log.debug("no ACL part for ancestor: " + currentAncestor.getExtid() + " of level: " + currentAncestor.getLevelExtid() + ", checking next level if available...");
for (Ancestor currentAncestor : ancestors) { if (currentAncestor.getLevelExtid().equals(levelExtId)) { return currentAncestor.getExtid();
private ElementAncestors<YElement> setJournalIdsInOrigSequence(ElementAncestors<YElement> yElemAncest) throws ModelDataSourceException { Ancestor journal = yElemAncest.getAncestors().getAncestorAtLevel(YaddaIdConstants.ID_LEVEL_JOURNAL_JOURNAL); if (journal != null) { YElement journalYElem= dataSourcesFactory.getYCatalogDataSource().getElementById(journal.getExtid()); // Keep ids original order, it decides on citation styling @see YElemToCSLItemConverter LinkedHashMap<String, String> idsSorted = new LinkedHashMap<>(); for (YId yId : journalYElem.getIds()) { idsSorted.put(yId.getScheme(), yId.getValue()); } journal.setAdditionalIdentifiers(idsSorted); } return yElemAncest; }
@Override public void process(final SElement sel, final Ancestor ref) { if (sel.getLevels() != null && sel.getLevels().contains(YaddaIdConstants.ID_LEVEL_JOURNAL_PUBLISHER)) { final SBookInfo bookInfo = new SBookInfo(); bookInfo.setPublisherName(ref.getDefaultNameText()); bookInfo.setPublisherExtId(ref.getExtid()); sel.addInfo(bookInfo); sel.addAncestorName(bookInfo.getPublisherName()); } } }
journalGPReq.setObject(new YaddaObjectID(currentAnc.getExtid())); journalGPReq.setType(CatalogParamConstants.TYPE_BWMETA1); GetPartResponse<String> journalGPResponse = catalog.getPart(journalGPReq); journalGPResponse.getPart().getData()!=null) { Object object = (Identified)bwmetaSerializer.toObject(currentAnc.getExtid(), journalGPResponse.getPart().getData());
@Override public void process(final SElement sel, final Ancestor ref) { if (sel.getLevels() != null && sel.getLevels().contains(YaddaIdConstants.ID_LEVEL_BOOK_BOOK)) { final SBookInfo bookInfo = new SBookInfo(); bookInfo.setPublisherName(ref.getDefaultNameText()); bookInfo.setPublisherExtId(ref.getExtid()); sel.addInfo(bookInfo); sel.addAncestorName(bookInfo.getPublisherName()); } } }
@Override public void process(final SElement sel, final Ancestor ref) { if (sel.getLevels() != null && sel.getLevels().contains(YaddaIdConstants.ID_LEVEL_SCIENTIFIC_WORK)) { final SScientificEntityInfo seInfo = new SScientificEntityInfo(); seInfo.setEntityExtId(ref.getExtid()); seInfo.setEntityName(ref.getDefaultNameText()); sel.addInfo(seInfo); sel.addAncestorName(seInfo.getEntityName()); } } }
@Override public void process(final SElement sel, final Ancestor ref) { if (sel.getLevels() != null && sel.getLevels().contains(YaddaIdConstants.ID_LEVEL_SCIENTIFIC_WORK)) { final SScientificInstitutionInfo siInfo = new SScientificInstitutionInfo(); siInfo.setInstitutionExtId(ref.getExtid()); siInfo.setInstitutionName(ref.getDefaultNameText()); sel.addInfo(siInfo); sel.addAncestorName(siInfo.getInstitutionName()); } } }
if (entry.size() > 1) { Ancestor parent = entry.get(1); parentsToInvalidate.add(parent.getExtid());
@Override public void process(final SElement sel, final Ancestor ref) { final SJournalDescendantInfo jdi = new SJournalDescendantInfo(); jdi.setJournalName(ref.getDefaultNameText()); jdi.addJournalOtherNames(ref.getAdditionalNames()); jdi.setJournalExtId(ref.getExtid()); sel.addInfo(jdi); sel.addAncestorName(ref.getDefaultNameText()); final Map<String, String> ids = ref.getAdditionalIdentifiers(); if (ids != null) { sel.addIssn(ids.get(YaddaIdConstants.IDENTIFIER_CLASS_ISSN)); sel.addIssn(ids.get(YaddaIdConstants.IDENTIFIER_CLASS_EISSN)); } } }
/** * 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; }
@Override public AncestorsViewObject getParentJournalForIssue(String issueReferenceId) { AncestorsViewObject result = new AncestorsViewObject(); try { final ElementAncestors<YElement> elementWithAncestors = elementRepository.getElementWithAncestors(issueReferenceId); final Ancestors ancestors = elementWithAncestors.getAncestors(); final Ancestor journal = ancestors.getAncestorAtLevel(HierarchyWithLevelIds .EXT_LEVEL_JOURNAL_JOURNAL); if (journal != null) { result.setJournal(new BasicElementInfo(journal.getExtid(), journal.getDefaultNameText())); } } catch (RepositoryException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } return result; }
final String extid = ancestor.getExtid(); final String levelExtid = ancestor.getLevelExtid(); final String name = ancestor.getDefaultNameText();
for (final String hierarchyId : ancestors.getHierarchies()) { for (Ancestor ancestor:ancestors.getAncestorsOfHierarchy(hierarchyId)) { String id = ancestor.getExtid(); YElement element = loadElementFromYaddaCatalog(id); if (ancestor.getLevelExtid().equals("bwmeta1.level.hierarchy_Journal_Year")) {
.EXT_LEVEL_JOURNAL_JOURNAL); if (journal != null) { result.setJournal(new BasicElementInfo(journal.getExtid(), journal.getDefaultNameText())); if (year != null) { issue.getYear().setName(year.getDefaultNameText()); issue.getYear().setId(year.getExtid()); issue.getVolume().setId(volume.getExtid()); issue.getNumber().setId(number.getExtid());
.EXT_LEVEL_JOURNAL_JOURNAL); if (journal != null) { result.setJournal(new BasicElementInfo(journal.getExtid(), journal.getDefaultNameText())); if (year != null) { issue.getYear().setName(year.getDefaultNameText()); issue.getYear().setId(year.getExtid()); issue.getVolume().setId(volume.getExtid()); issue.getNumber().setId(number.getExtid());
+ ancestor.getLevelExtid(), ancestor.getExtid(), values); addValue(IndexFields.F_SIM_HIERARCHY_DUMP_NAME_PREFIX