public static void updateYRelationWithZblNames(YRelation relye, YElement zblye) { for (YName n : zblye.getNames()) { YAttribute ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_NAME, ""); ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE, n.getLanguage().getName())); ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE, n.getType())); ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE, n.getText())); relye.addAttribute(ya); } }
public static void updateYRelationWithZblTags(YRelation relye, YElement zblye) { for (YTagList tl : zblye.getTagLists()) { YAttribute ya = new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TAG, ""); ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_TYPE, tl.getType())); ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_LANGUAGE, tl.getLanguage().getName())); for (String t : tl.getValues()) { ya.addAttribute(new YAttribute(YConstants.AT_ENHANCED_FROM_ZBL_VALUE, t)); } relye.addAttribute(ya); } }
public static YStructure getOrCreateJournalStructure(YElement element) { YStructure structure = element.getStructure(YConstants.EXT_HIERARCHY_JOURNAL); if (structure == null) { structure = new YStructure(YConstants.EXT_HIERARCHY_JOURNAL); structure.setCurrent(new YCurrent(YConstants.EXT_LEVEL_JOURNAL_ARTICLE)); element.addStructure(structure); } return structure; }
private void updateIssue(ZentralBlattSoFieldParser.SoFieldData soData) { if (soData.issue != null && soData.issue.length() > 0) { YAncestor ancestor = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_ISSUE); // TODO // UID? YName issueName = new YName(soData.issue); yIssue.addName(issueName); ancestor.setIdentity(yIssue.getId()); ancestor.addName(issueName); yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL).addAncestor(ancestor); } }
private static void putEditor(YElement element, String editor) { YName name = new YName().setType(YConstants.NM_CANONICAL).setText(editor); YContributor contributor = new YContributor().setRole(YConstants.CR_EDITOR).addName(name); element.addContributor(contributor); }
@Override public String fetchCurrentStructureLevel(YElement yElement) { for (YStructure structure : yElement.getStructures()) { if (structure.getCurrent() != null) { return structure.getCurrent().getLevel(); } } return null; }
public static void updateYRelationWithZblClassificationCodes(YRelation relye, YElement zblye) { YAttribute ya; ya = new YAttribute(YConstants.TG_CATEGORY, ""); for (YCategoryRef r : zblye.getCategoryRefs()) { ya.addAttribute(new YAttribute(r.getClassification(), r.getCode())); } relye.addAttribute(ya); }
public String getPosition(YElement yElement){ YStructure structure = yElement.getStructure(YaddaIdConstants.ID_HIERARACHY_JOURNAL); YCurrent current = structure.getCurrent(); return current.getPosition(); }
private String getContributorLastName(final YContributor cont) { if (cont.getOneName(YConstants.NM_SURNAME) != null) { return cont.getOneName(YConstants.NM_SURNAME).getText(); } final YAttribute person = cont.getOneAttribute(YConstants.AT_CONTRIBUTOR_PERSON); if (person != null) { return person.getOneAttributeSimpleValue(YConstants.AT_CONTRIBUTOR_PERSON_LASTNAME); } else { return cont.getOneAttributeSimpleValue(YConstants.AT_CONTRIBUTOR_PERSON_LASTNAME); } }
private void updateJournalCurrentLevel() { YStructure struct = yJournal.getStructure(YConstants.EXT_HIERARCHY_JOURNAL); struct.setCurrent(new YCurrent(YConstants.EXT_LEVEL_JOURNAL_JOURNAL)); }
private String findNameInLanguage(List<YName> names, YLanguage yLanguage){ for(YName name: names){ if(yLanguage.equals(name.getLanguage())) return name.getText(); } return null; } }
private String extractId(YContentFile yFile) { YName fileNameCandidate = yFile.getOneName(NameTypes.NM_FILE_NAME); if (fileNameCandidate == null) { fileNameCandidate = yFile.getOneName(); } if (fileNameCandidate == null) { return yFile.getId(); } else { return fileNameCandidate.getText(); } }
private YAncestor getAncestor(YElement element, String hierarchy, String level) { YStructure structure = element.getStructure(hierarchy); if(structure == null){ return null; } YAncestor ancestor = structure.getAncestor(level); return ancestor; }
public void addEmptyStructureToYElement(YElement yelement) { YStructure articleStructure = new YStructure(); // TODO // czy nie trzeba wiecej nic ustawiac? articleStructure.setHierarchy(YConstants.EXT_HIERARCHY_JOURNAL); yelement.addStructure(articleStructure); }
public static YAffiliation getOrCreateAffiliation(YElement element, String id) { YAffiliation affiliation = element.getAffiliation(id); if (affiliation == null) { affiliation = new YAffiliation().setId(id); element.addAffiliation(affiliation); } return affiliation; }
protected void addNotNullAttribute(AbstractA<?> element, String key, String value) { if (value == null) return; element.addAttribute(new YAttribute(key, value)); }
private void addIssue(YStructure journal, YAncestor issue, String issueId) { if(issue == null) { issue = new YAncestor(YConstants.EXT_LEVEL_JOURNAL_ISSUE, issueId); } journal.addAncestor(issue); }
private String getContributorFirstName(final YContributor cont) { if (cont.getOneName(YConstants.NM_FORENAMES) != null) { return cont.getOneName(YConstants.NM_FORENAMES).getText(); } final YAttribute person = cont.getOneAttribute(YConstants.AT_CONTRIBUTOR_PERSON); if (person != null) { return person.getOneAttributeSimpleValue(YConstants.AT_CONTRIBUTOR_PERSON_FIRSTNAME); } else { return cont.getOneAttributeSimpleValue(YConstants.AT_CONTRIBUTOR_PERSON_FIRSTNAME); } }
private void updateYearCurrentLevel() { YStructure struct = yYear.getStructure(YConstants.EXT_HIERARCHY_JOURNAL); struct.setCurrent(new YCurrent(YConstants.EXT_LEVEL_JOURNAL_YEAR)); }