From 57d93285ff4d10cdc273714d055eb6612f6a16a7 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Tue, 15 Nov 2022 20:33:01 +0100 Subject: [PATCH] fix: removed 'other' hack from forms (#328) --- .../VTwo/fields/ChildVClassesWithParent.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/fields/ChildVClassesWithParent.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/fields/ChildVClassesWithParent.java index 22f5763a4..50bd37d34 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/fields/ChildVClassesWithParent.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/fields/ChildVClassesWithParent.java @@ -38,11 +38,6 @@ public class ChildVClassesWithParent implements FieldOptions { return this; } -/* - * UQAM-Linguistic-Management - * This method is polymorphism of getOptions(EditConfigurationVTwo editConfig,String fieldName, WebappDaoFactory wDaoFact) - * for the internationalization of word "other" in the scroling list of personHasAdvisorRelationship.ftl - */ public Map getOptions( EditConfigurationVTwo editConfig, String fieldName, @@ -53,16 +48,17 @@ public class ChildVClassesWithParent implements FieldOptions { if ( ! StringUtils.isEmpty( defaultOptionLabel ) ){ optionsMap.put(LEFT_BLANK, defaultOptionLabel); } - String other_i18n = i18n.text("other"); - // first character in capital - optionsMap.put(classUri, other_i18n.substring(0, 1).toUpperCase() + other_i18n.substring(1)); VClassDao vclassDao = wDaoFact.getVClassDao(); + VClass rdfClass = vclassDao.getVClassByURI(classUri); + if (rdfClass != null && !OWL.Nothing.getURI().equals(classUri)) { + optionsMap.put(classUri, rdfClass.getName().trim()); + } List subClassList = vclassDao.getAllSubClassURIs(classUri); if (subClassList != null && subClassList.size() > 0) { for (String subClassUri : subClassList) { - VClass subClass = vclassDao.getVClassByURI(subClassUri); - if (subClass != null && !OWL.Nothing.getURI().equals(subClassUri)) { - optionsMap.put(subClassUri, subClass.getName().trim()); + rdfClass = vclassDao.getVClassByURI(subClassUri); + if (rdfClass != null && !OWL.Nothing.getURI().equals(subClassUri)) { + optionsMap.put(subClassUri, rdfClass.getName().trim()); } } } @@ -72,5 +68,5 @@ public class ChildVClassesWithParent implements FieldOptions { public Comparator getCustomComparator() { return null; } - + }