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...");
@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 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; }
for (Ancestor ancestor : ancestorLists) { if (YaddaIdConstants.ID_LEVEL_JOURNAL_JOURNAL .equals(ancestor.getLevelExtid())) { addValue(IndexFields.F_JOURNAL_NAME, ancestor.getDefaultNameText(), values); + ancestor.getLevelExtid(), ancestor.getExtid(), values); addValue(IndexFields.F_SIM_HIERARCHY_DUMP_NAME_PREFIX + ancestor.getLevelExtid(), ancestor.getDefaultNameText(), values);
private void processJournalAncestors(final DocMetadata metadata, final List<Ancestor> ancestors) { if (ancestors == null || ancestors.isEmpty()) { return; } metadata.setType(Type.ARTICLE); for (final Ancestor ancestor : ancestors) { final String levelExtId = ancestor.getLevelExtid(); final String name = ancestor.getDefaultNameText(); if (YaddaIdConstants.ID_LEVEL_JOURNAL_JOURNAL.equals(levelExtId)) { metadata.setJournal(name); } if (YaddaIdConstants.ID_LEVEL_JOURNAL_NUMBER.equals(levelExtId)) { metadata.setNumber(name); } if (YaddaIdConstants.ID_LEVEL_JOURNAL_PUBLISHER.equals(levelExtId)) { metadata.setPublisher(name); } if (YaddaIdConstants.ID_LEVEL_JOURNAL_SERIES.equals(levelExtId)) { metadata.setSeries(name); } if (YaddaIdConstants.ID_LEVEL_JOURNAL_VOLUME.equals(levelExtId)) { metadata.setVolume(name); } if (YaddaIdConstants.ID_LEVEL_JOURNAL_YEAR.equals(levelExtId)) { metadata.setYear(name); } } }
private ElementTitlePart findTitlePart(Ancestors ancestors) { for (String hierarchyId : ancestors.getHierarchies()) { Ancestor ancestor = ancestors.getCurrentInHierarchy(hierarchyId); ElementTitlePart titlePart = levelToTitlePartMap.get(ancestor.getLevelExtid()); if (titlePart!=null) { return titlePart; } } return null; }
private String name(Ancestor ancestor) { return ancestor==null ? null : ancestor.getDefaultNameText(); }
private String _getAncestorId(Ancestors ancestors, String levelId){ Ancestor ancestor = ancestors.getAncestorAtLevel(levelId); if(ancestor==null) return ""; else return ancestor.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; }
if (ancestor.getPublishedDate() != null && ancestor.getPublishedDate().getDate() != null) { sElement.setPublishDate(new SDate(ancestor.getPublishedDate().getDate(), ancestor .getPublishedDate().getPrecission().getPrecission())); } else if (ancestor.getPublishedDate() == null) { log.debug("Element {} has 'published' date with null date (text: {})", el.getExtId(), ancestor.getPublishedDate()); ancestor.getPublishedDate()); final List<AncestorPlugin> ancestorPlugins = getAncestorPlugins(ancestor.getLevelExtid()); if (ancestorPlugins.isEmpty()) { log.debug("No plugin for ancestor in level '" + ancestor.getLevelExtid() + "'");
private String identifierOfType(Ancestor ancestor, String idType) { Map<String, String> ids = ancestor.getAdditionalIdentifiers(); return ids==null ? null : ids.get(idType); }
final Ancestor parentAncestor = new Ancestor( element.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).getCurrent().getLevel(), element.getId(), element.getOneName());
final String extid = ancestor.getExtid(); final String levelExtid = ancestor.getLevelExtid(); final String name = ancestor.getDefaultNameText();
private boolean hasRelatedPublisher(CatalogElement catalogElement) throws YaddaException { final Element element = catalogElement.getElement(); final ElementLevel journalHierarchyLevel = element.getElementLevel(YaddaIdConstants.ID_HIERARACHY_JOURNAL); if (journalHierarchyLevel!=null && YaddaIdConstants.ID_LEVEL_JOURNAL_JOURNAL.equals(journalHierarchyLevel.getLevelExtId())) { final Ancestors ancestors = catalogElement.getAncestors(); if (ancestors != null) { final Ancestor parentInHierarchy = ancestors.getParentInHierarchy(YaddaIdConstants.ID_HIERARACHY_JOURNAL); if (parentInHierarchy != null) { final String parentLevel = parentInHierarchy.getLevelExtid(); if (YaddaIdConstants.ID_LEVEL_JOURNAL_PUBLISHER.equals(parentLevel)) { return true; } } } } for (Contributor contributor : element.getContributors()) { if (ContributorConstants.ROLE_PUBLISHER.equals(contributor.getRole())) { return true; } } return false; }
private String _getPublisherName(Ancestors ancestors, String publisherLevelId){ Ancestor publisher = ancestors.getAncestorAtLevel(publisherLevelId); if(publisher != null) return publisher.getDefaultNameText(); else return ""; }
@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); } }
private static String identifierOfType(Ancestor ancestor, String idType) { Map<String, String> ids = ancestor.getAdditionalIdentifiers(); return ids==null ? null : ids.get(idType); }
@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()); } } }
if (ancestors != null && ancestors.size() > 0) { for (Ancestor currentAncestor : ancestors) { if (currentAncestor.getLevelExtid().equals(levelExtId)) { return currentAncestor.getExtid();