private String extracjPublisherFromArticle(List<YElement> yelements) { List<YElement> articles = YElementsParsingToolbox.filterYElementsOfStructureLevel(yelements, YConstants.EXT_LEVEL_JOURNAL_ARTICLE); if (articles.size() == 0) { return null; } if (articles.size() > 1) { log.error("More than one articles found in package of yelements!"); } YElement article = articles.get(0); YStructure struct = article.getStructure(YConstants.EXT_HIERARCHY_JOURNAL); if (struct == null) { return null; } YAncestor ancest = struct.getAncestor(YConstants.EXT_LEVEL_JOURNAL_PUBLISHER); if (ancest == null) { return null; } return YElementsParsingToolbox.removeEmptyValues(YElementsParsingToolbox.selectBestName(ancest.getNames())); }
public static void copyDataToAncestor(YElement ele, YAncestor anc) { anc.getNames().addAll(ele.getNames()); anc.getIds().addAll(ele.getIds()); anc.getDates().addAll(ele.getDates()); anc.setIdentity(ele.getId()); }
private YDate getDateFromYear(final YAncestor ancestor) { JournalYearExtractor journalYearExtractor = new JournalYearExtractorImpl(); for (final YName yName : ancestor.getNames()) { Integer parsedYear = journalYearExtractor.parseYear(yName.getText()); if (parsedYear != null) { return new YDate("hierarchy", parsedYear, 1, 1, "hierarchy"); } } return null; }
protected YStructure buildStructureFromParent(YElement parent, String hierarchy, String currentLevel) { YStructure structure = new YStructure(hierarchy); YCurrent current = new YCurrent(currentLevel); structure.setCurrent(current); if (parent != null) { YStructure parentStructure = parent.getStructure(hierarchy); structure.getAncestors().addAll(parentStructure.getAncestors()); YAncestor ancestor = new YAncestor(parentStructure.getCurrent().getLevel(), parent.getId()); ancestor.getNames().addAll(parent.getNames()); ancestor.getIds().addAll(parent.getIds()); structure.addAncestor(ancestor); } return structure; }