本文整理了Java中pl.edu.icm.model.bwmeta.y.YCurrent
类的一些代码示例,展示了YCurrent
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YCurrent
类的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YCurrent
类名称:YCurrent
暂无
代码示例来源:origin: pl.edu.icm.yadda/yadda-polindex
public static boolean isArticle(final YElement element) {
final String hierarchyLevel = yCurrentInJournalHierarchy(element).getLevel();
return HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE.equals(hierarchyLevel);
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
protected YCurrent getCurrent(PublicationMeta meta, YElement directAncestor) {
YCurrent current = new YCurrent();
switch (meta.getLevel().toLowerCase()) {
case WileyComponentConstants.PMETA_SERIES:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_BOOK_SERIES);
break;
case WileyComponentConstants.PMETA_PRODUCT:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_BOOK_BOOK);
break;
case WileyComponentConstants.PMETA_PART:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_BOOK_PART);
break;
case WileyComponentConstants.PMETA_UNIT:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_BOOK_CHAPTER);
break;
default:
throw new ConfigurationException("Unknown level: " + meta.getLevel());
}
return current;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
public static String articlePosition(YElement element) {
String position = null;
YStructure anc = element.getStructure(YaddaIdConstants.ID_HIERARACHY_JOURNAL);
if (anc != null) {
YCurrent cAnc = anc.getCurrent();
if (cAnc != null && !StringUtils.isEmpty(cAnc.getPosition()))
position = cAnc.getPosition();
}
return position;
}
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private void updateArticleCurrentLevel(ZentralBlattSoFieldParser.SoFieldData soData) {
YStructure articleStructure = yArticle.getStructure(YConstants.EXT_HIERARCHY_JOURNAL);
YCurrent current = new YCurrent(YConstants.EXT_LEVEL_JOURNAL_ARTICLE);
if (soData.pages != null && soData.pages.length() > 0) {
current.setPosition(soData.pages);
}
articleStructure.setCurrent(current);
}
代码示例来源:origin: pl.edu.icm.synat/synat-sdk-sample-services
private void fixYearInYear(DocumentRepository repository,
Document document, YElement element) {
String fixedCurrentLevel = HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_VOLUME;
String newTagValue = HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL + "=" + fixedCurrentLevel;
document.addTagByKey("hierarchyLevel", newTagValue);
YStructure structure = element.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL);
YCurrent current = structure.getCurrent();
if (!HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR.equals(current.getLevel())) {
System.out.println("current level is = "+current.getLevel()+" expected year. Won't fix");
} else {
current.setLevel(fixedCurrentLevel);
saveDocumentWithElement(repository, document, element);
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
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;
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private List<StructureData> prepareStructure(YElement yElement, String hierarchy, String[] levels, String... topLevelIds) {
List<String> topLevels = Arrays.asList(topLevelIds);
String topId = null;
String topLevelId = null;
List<StructureData> ancestors = new ArrayList<StructureData>();
final YStructure structure = yElement.getStructure(hierarchy);
if (structure != null) {
ListMultimap<String, YAncestor> mappedAncestors = getMappedAncestors(structure.getAncestors());
for (String level : levels) {
final YAncestor ancestor = getAncestor(mappedAncestors, level);
if (ancestor != null && ArrayUtils.contains(StructureData.LEVELS_ALLOWED, ancestor.getLevel())) {
if (topLevels.contains(ancestor.getLevel())) {
topId = ancestor.getIdentity();
topLevelId = ancestor.getLevel();
ancestors.add(new StructureData(ancestor.getIdentity(), YModelUtils.getDefaultName(ancestor), ancestor.getLevel(), topId, topLevelId));
} else {
ancestors.add(new StructureData(ancestor.getIdentity(), IndexUtils.encodeNameValue(YModelUtils.getDefaultName(ancestor)),
ancestor.getLevel(), topId, topLevelId));
}
}
}
if (StringUtils.isNotBlank(structure.getCurrent().getPosition())
&& ArrayUtils.contains(StructureData.ALLOWED_LEVELS_OF_CURRENT_POSITION, structure.getCurrent().getLevel())) {
ancestors.add(new StructureData(null, structure.getCurrent().getPosition()));
}
}
return ancestors;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-polindex
/**
* Returns YCurrent object representing level of element in journal
* hierarchy. Method never returns null - if journal hierarchy level is not
* specified, empty YCurrent object is returned.
*/
public static YCurrent yCurrentInJournalHierarchy(final YElement element) {
YCurrent result = null;
final YStructure struct = element.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL);
if (struct != null) {
result = struct.getCurrent();
}
return result == null ? new YCurrent() : result;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
YCurrent current = new YCurrent();
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE);
current.setPosition(position);
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
public void updateElementPages(org.jdom.Element ameta, YElement article, String hierarchy) {
StringBuilder sb = new StringBuilder();
sb.append(JDOMHelper.getChildTextTrim(ameta, "fpage"));
String lastPage = JDOMHelper.getChildTextTrim(ameta, "lpage");
if(lastPage != null && !"".equals(lastPage)){
sb.append("-");
sb.append(lastPage);
}
String s=sb.toString();
if (s==null || "null".equalsIgnoreCase(s.trim()) || StringUtils.isBlank(s)) {
return;
}
article.getStructure(hierarchy).getCurrent().setPosition(s);
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
/**
* Creates an element in the hierarchy.
*
* @param level hierarchy for the element
* @param level level for the element in the hierarchy
* @param name name to use as the canonical name of the element
* @param parent parent for the element in the hierarchy
* @param id eudml id
* @return the created element
*/
public YElement element(String hierarchy, String level, YName name, YElement parent, String id) {
YStructure ps = parent==null ? null : parent.getStructure(hierarchy);
YStructure struct = new YStructure(hierarchy).setCurrent(new YCurrent(level));
List<String> issns = parent==null ? null : parent.getIds(IdSchemaIds.EXT_SCHEME_ISSN);
String issn = (issns==null || issns.isEmpty()) ? null : issns.get(0);
if (ps != null) {
YAncestor ancestor = new YAncestor(ps.getCurrent().getLevel(), parent.getId()).addName(parent.getDefaultName());
if (StringUtils.isNotEmpty(issn)) {
ancestor.addId(new YId(IdSchemaIds.EXT_SCHEME_ISSN, issn));
}
struct.setAncestors(ps.getAncestors()).addAncestor(ancestor);
}
return new YElement(id).addName(name).addStructure(struct);
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private void addCurrent(YStructure journal, ArticleEditForm form) {
YCurrent yCurrent = new YCurrent(YConstants.EXT_LEVEL_JOURNAL_ARTICLE);
yCurrent.setPosition(form.getPages());
journal.setCurrent(yCurrent);
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
if (yElementJournalStructure.getCurrent().getLevel().equals(YConstants.EXT_LEVEL_JOURNAL_ARTICLE)) {
bibEntry.setType(BibEntry.TYPE_ARTICLE);
String pages = yElementJournalStructure.getCurrent().getPosition();
bibEntry.setField(BibEntry.FIELD_PAGES, pages);
if (yElementBookStructure.getCurrent().getLevel().equals(YConstants.EXT_LEVEL_BOOK_BOOK)) {
bibEntry.setType(BibEntry.TYPE_BOOK);
代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import
private void updateJournalCurrentLevel() {
YStructure struct = yJournal.getStructure(YConstants.EXT_HIERARCHY_JOURNAL);
struct.setCurrent(new YCurrent(YConstants.EXT_LEVEL_JOURNAL_JOURNAL));
}
代码示例来源:origin: pl.edu.icm.synat/synat-sdk-sample-services
private boolean changeElementLevel(DocumentRepository repository, String identity) {
NativeDocument fetchDocument = repository.fetchDocument(identity);
Document document = (Document) fetchDocument;
YElement element = (YElement) document.getMetadata();
String fixedCurrentLevel = HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ISSUE;
String newTagValue = HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL + "=" + fixedCurrentLevel;
document.addTagByKey("hierarchyLevel", newTagValue);
YStructure structure = element.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL);
YCurrent current = structure.getCurrent();
if (!HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_VOLUME.equals(current.getLevel())) {
System.out.println("current level is = "+current.getLevel()+" expected year. Won't fix");
return false;
} else {
current.setLevel(fixedCurrentLevel);
document.setMetadata(element);
repository.storeDocument(document, EventConstants.EVENT_TAG_NO_EVENT);
return true;
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected void updatePages(Pages pages, YCurrent current) {
if (pages == null) {
return;
}
StringBuffer position = new StringBuffer();
if (pages.getFirstPage() != null) {
position.append(pages.getFirstPage());
}
if (pages.getLastPage() != null) {
position.append('-');
position.append(pages.getLastPage());
}
if (pages.getOtherPages() != null) {
if (position.length() > 0) {
position.append(SPACE);
}
position.append(pages.getOtherPages());
}
current.setPosition(position.toString());
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api
public static ElementKind resolveKindFromStructure(List<YStructure> structures){
for (final YStructure yStructure : structures) {
switch (yStructure.getCurrent().getLevel()) {
case HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE: return BASE;
case HierarchyWithLevelIds.EXT_LEVEL_PUBLICATION_ELEMENT: return BASE;
case HierarchyWithLevelIds.EXT_LEVEL_BOOK_SERIES: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_BOOK_BOOK: return BASE;
case HierarchyWithLevelIds.EXT_LEVEL_BOOK_CHAPTER: return BASE;
case HierarchyWithLevelIds.EXT_LEVEL_BOOK_SECTION: return BASE;
case HierarchyWithLevelIds.EXT_LEVEL_BOOK_PART: return BASE;
case HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_JOURNAL: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_SERIES: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ISSUE: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_VOLUME: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_CONFERENCE_EVENT: return BUNDLE;
case HierarchyWithLevelIds.EXT_LEVEL_CONFERENCE_CONFERENCE: return BUNDLE;
// TODO check it, is this correct?
case VideoConstants.VIDEO_CURRENT_LEVEL: return BASE;
}
}
return null;
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
tmpStruct.setCurrent(new YCurrent(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_YEAR));
for (YAncestor a : struct.getAncestors()) {
tmpStruct.addAncestor(a);
struct.addAncestor(new YAncestor(el.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL).getCurrent().getLevel(), el.getId(), el.getDefaultName()));
tmpStruct.setCurrent(new YCurrent(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_VOLUME));
for (YAncestor a : struct.getAncestors()) {
tmpStruct.addAncestor(a);
list.add(el);
struct.addAncestor(new YAncestor(el.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL).getCurrent().getLevel(), el.getId(), el.getDefaultName()));
el.addName(new YName(number));
YStructure tmpStruct = new YStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL);
tmpStruct.setCurrent(new YCurrent(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ISSUE));
for (YAncestor a : struct.getAncestors()) {
tmpStruct.addAncestor(a);
list.add(el);
struct.addAncestor(new YAncestor(el.getStructure(HierarchyWithLevelIds.EXT_HIERARCHY_JOURNAL).getCurrent().getLevel(), el.getId(), el.getDefaultName()));
struct.setCurrent(new YCurrent(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE));
return struct;
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
protected YCurrent getCurrent(PublicationMeta meta, YElement directAncestor) {
YCurrent current = new YCurrent();
switch (meta.getLevel().toLowerCase()) {
case WileyComponentConstants.PMETA_SERIES:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_SERIES);
break;
case WileyComponentConstants.PMETA_PRODUCT:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_JOURNAL);
break;
case WileyComponentConstants.PMETA_PART:
String lastLevel = getLevel(directAncestor);
current.setLevel(getNextPartLevel(meta, lastLevel));
break;
case WileyComponentConstants.PMETA_UNIT:
current.setLevel(HierarchyWithLevelIds.EXT_LEVEL_JOURNAL_ARTICLE);
break;
default:
throw new ConfigurationException("Unknown level: " + meta.getLevel());
}
return current;
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private void appendStructure(ResourceData resource, YElement yElement) {
final String hierarchy = ResourceDataConstants.MAP_TYPE_TO_HIERARCHY.get(resource.getType());
final String current = ResourceDataConstants.MAP_TYPE_TO_CURRENT.get(resource.getType());
YStructure structure = new YStructure(hierarchy);
final AncestorData pages = extractAncestorFromHierarchyData(resource, ResourceDataConstants.ANCESTOR_LEVEL_NAME_PAGES);
final String position = pages == null ? StringUtils.EMPTY : StringUtils.defaultString(pages.getName());
structure.setCurrent(new YCurrent(current).setPosition(position));
final Collection<YAncestor> ancestors = mapHierarchyToAncestors(resource.getType(), resource.getHierarchy());
if (CollectionUtils.isNotEmpty(ancestors)) {
structure.setAncestors(ancestors);
}
yElement.addStructure(structure);
}
内容来源于网络,如有侵权,请联系作者删除!