本文整理了Java中pl.edu.icm.model.bwmeta.y.YName
类的一些代码示例,展示了YName
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YName
类的具体详情如下:
包路径:pl.edu.icm.model.bwmeta.y.YName
类名称:YName
暂无
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private String getNameTextFrom(YName name, String fallback){
if(name == null){
return fallback;
} else {
String nameText = name.getText();
if(StringUtils.isBlank(nameText)){
return fallback;
} else {
return nameText;
}
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
protected List<YContributor> parseBibEntryPersons(List<String> persons, String role) {
List<YContributor> yContributorList = new ArrayList<YContributor>();
for (String person : persons) {
YContributor yContributor = new YContributor();
yContributor.setPerson(true);
yContributor.setRole(role);
yContributor.addName(new YName().setType(YConstants.NM_CANONICAL).setText(person));
String[] split = person.split(", ");
if (split.length > 0) {
yContributor.addName(new YName().setType(YConstants.NM_SURNAME).setText(split[0]));
}
if (split.length > 1) {
yContributor.addName(new YName().setType(YConstants.NM_FORENAMES).setText(split[1]));
}
if (split.length > 2) {
yContributor.addName(new YName().setType(YConstants.NM_SUFFIX).setText(split[2]));
}
yContributorList.add(yContributor);
}
return yContributorList;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
if("canonical".equals(yn.getType())){
cname = yn.getText().trim();
}else if("forename".equals(yn.getType())){
fname = fname + " " + yn.getText();
for(String s : yn.getText().split(" "))
}else if("forenames".equals(yn.getType())){
fname = fname + " " + yn.getText();
for(String s : yn.getText().split(" "))
}else if("surname".equals(yn.getType())){
sname = yn.getText().trim();
sname = NameProceeder.unifySurname(sname);
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private String findNameInLanguage(List<YName> names, YLanguage yLanguage){
for(YName name: names){
if(yLanguage.equals(name.getLanguage()))
return name.getText();
}
return null;
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
private Map<String, FilteredString> buildFilteredStrings(List<YName> nameList) {
Map<String, FilteredString> result = new HashMap<>();
for (YName name : nameList) {
result.put(name.getType(), buildFilteredString(name.getRichText()));
}
return result;
}
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
private LocalizedString extractLocalizedStringFrom(YName yName){
YRichText text = yName.getRichText();
if(StringUtils.isBlank(yName.getText())){
return null;
} else {
String langCode = languageExtractor.extractLanguageCode(yName.getLanguage());
return new LocalizedString(langCode, YRTHelper.toXmlFragmentWithoutNamespaces(text));
}
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
String cname = null;
for(YName name : nc.getNames()){
if("canonical".equals(name.getType())) cname = name.getText();
else if("forenames".equals(name.getType())) fname = name.getText();
else if("surname".equals(name.getType())) sname = name.getText();
if(sname!=null && zblc.getOneName("surname")!=null && sname.equals(zblc.getOneName("surname").getText())){
if(zblc.getOneName("forenames").getText().split(" ").length >fname.split(" ").length){
fname = zblc.getOneName("forenames").getText();
YName fn = new YName(fname);
fn.setType("forenames");
YName sn = new YName(sname);
sn.setType("surname");
YName cn;
if(cname!=null) cn = new YName(cname);
else cn = new YName(fname+" "+sname);
cn.setType("canonical");
LinkedList<YName> ynames = new LinkedList<YName>();
ynames.add(fn);
代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core
YContentFile buildYContentFile() {
YContentFile yContentFile = new YContentFile(String.valueOf(id), FileTypes.FT_FULL_TEXT,
format, Lists.newArrayList(location));
YName yName = new YName(name);
yName.setType(NameTypes.NM_FILE_NAME);
yContentFile.addName(yName);
return yContentFile;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
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);
}
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
private static void replaceAthorsCoauthorsField(final YElement yElement, final String[] values) {
for (final String value : values) {
if (value != null && value.length() > 0) {
final String rawValue = unhighlight(value);
for (final YContributor cont : yElement.getContributors()) {
final YName name = cont.getOneName();
if (name != null && (rawValue.equals(name.getText()))) {
final YName hlName = new YName(value);
hlName.setType(Y_TYPE_HIGHLIGHTED);
cont.getNames().add(hlName);
}
}
}
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct
@Override
public void parseMetadata(YElement element, PublicationMeta pm, YLanguage defaultLanguage, List<YElement> ancestors) {
String partNumber = element.getStructures().get(0).getCurrent().getPosition();
if(StringUtils.isNotBlank(partNumber)){
String id = ancestors.get(ancestors.size() - 1).getId() + "-p-" + partNumber;
id = WileyUtils.processId(id);
element.setId(id);
}
if (element.getNames().size() == 1) {
YName name = YModelUtils.fetchDefaultName(element);
if(StringUtils.equals(NameTypes.NM_ALTERNATIVE, name.getType()) && StringUtils.isNotBlank(partNumber)){
name.setText(BaseYModelUtils.buildRichText(name.getText() + StringUtils.SPACE + partNumber));
}
name.setType(NameTypes.NM_CANONICAL);
}
}
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
protected YName convert(List<Serializable> content) {
YRichText text = convertText(content);
YName name = new YName(text);
return name;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
private Object prepareTitles(List<YName> names, YName defaultName, IFilteringContext filteringContext) {
List<LocalizedString> res = new ArrayList<LocalizedString>();
if (names != null)
for (YName name : names) {
if (defaultName != name && YNameAndYDescriptionSorter.isMainOrAlternativeName(name.getType())) {
String lang = languageDictionary.getShortDescription(name.getLanguage().getShortCode());
res.add(new LocalizedString(lang, detailsFilter.filter(YRTHelper.toXmlFragment(name.getRichText()),
InputType.RICH_TEXT, filteringContext)));
}
}
return res;
}
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
ArrayList<YName> outZblNames = new ArrayList<YName>();
for(YName n : zblc.getNames()){
if ("canonical".equals(n.getType())){
n.setText(NameProceeder.unifyCanonical(n.getText()));
}else if ("forenames".equals(n.getType())){
n.setText(NameProceeder.unifyForenames(n.getText()));
}else if ("forename".equals(n.getType())){
n.setText(NameProceeder.unifyForenames(n.getText()));
}else if ("surname".equals(n.getType())){
n.setText(NameProceeder.unifySurname(n.getText()));
ArrayList<YName> outZblNames = new ArrayList<YName>();
for(YName n : nc.getNames()){
if ("canonical".equals(n.getType())){
n.setText(NameProceeder.unifyCanonical(n.getText()));
}else if ("forenames".equals(n.getType())){
n.setText(NameProceeder.unifyForenames(n.getText()));
}else if ("forename".equals(n.getType())){
n.setText(NameProceeder.unifyForenames(n.getText()));
}else if ("surname".equals(n.getType())){
n.setText(NameProceeder.unifySurname(n.getText()));
if ("surname".equals(name.getType()))
sname = name.getText();
&& sname.equals(zblc.getOneName("surname").getText())) {
for (YAttribute a : zblc.getAttributes(YConstants.AT_ZBL_AUTHOR_FINGERPRINT)) {
nc.addAttribute(a);
代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers
year.addName(new YName()
.setText(xmc.getArticle().getJournal().getPubDate().getYear())
.setLanguage(YLanguage.NoLinguisticContent)
.setType(NameTypes.NM_CANONICAL));
代码示例来源:origin: pl.edu.icm.yadda/yadda-analysis-impl
private static YElement putNameLeafsIntoNodes(YElement yelement) {
for(YName yn : yelement.getNames()){
YRichText yrt = new YRichText(putLeafsIntoNodes(yn.getRichText().toParts()));
yn.setText(yrt);
}
return yelement;
}
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
@Override
protected Object buildElementViewPart(YExportable exp,
String[] elementTags, Map<String, Object> additionalParameters,
IFilteringContext filteringContext) {
YInstitution inst = (YInstitution) exp;
Map<String, Object> partModel = new HashMap<String, Object>();
partModel.put("extId", detailsFilter.filter(inst.getId(),
InputType.PLAIN_TEXT, filteringContext));
partModel.put("title", detailsFilter.filter(
YRTHelper.toXmlFragment(inst.getDefaultName().getRichText()),
InputType.RICH_TEXT, filteringContext));
partModel.put("titles", prepareTitles(inst.getNames(), inst.getDefaultName(), filteringContext));
partModel.put("addresses", getAddresses(inst, filteringContext));
partModel.put("contacts", CommonBuilderUtils.resolveContacts(inst, filteringContext, detailsFilter));
partModel.put("description", getDescription(inst, filteringContext, YConstants.DS_ABSTRACT));
partModel.put("fullAddress", getFullAddress(inst, filteringContext));
partModel.put("notes", getDescription(inst, filteringContext, YConstants.DS_NOTE));
if (pageTitleFactory!=null) {
String role = (String) additionalParameters.get(DetailsConstants.PARAM_ROLE);
String title = pageTitleFactory.getTitleForContributor(role, inst.getDefaultName().getText());
additionalParameters.put(DetailsConstants.VIEW_PARAM_PAGE_TITLE, title);
}
return partModel;
}
代码示例来源:origin: pl.edu.icm.synat/synat-process-common
String cleared = name.getText();
for (String pattern : PATTERNS_TO_REMOVE) {
cleared = StringUtils.removePattern(cleared, pattern);
if (!StringUtils.equals(cleared, name.getText())) {
name.setText(cleared.trim());
modify = true;
代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core
public static String xmlFromRichText(YName name) {
return name != null ? YRTHelper.toXmlFragment(name.getRichText()) : "";
}
}
代码示例来源:origin: pl.edu.icm.synat/synat-portal-core
final YLanguage yLanguage = name.getLanguage();
if (hasBeenList.contains(yLanguage)) {
continue;
YName yName = yElement.getDefaultName();
if (yName != null) {
CharSequence name = new FilteredString(YModelUtils.yRichTextToString(yName.getRichText()));
final PublicationNameData titleList = new PublicationNameData(name);
names.add(new LocalizedData<PublicationNameData>(makeLanguageData(yName.getLanguage(), locale), titleList));
内容来源于网络,如有侵权,请联系作者删除!