NIHVIVO-647 Code fixes in IndividualJena.getMoniker() for cases where there is no moniker and less than 2 vclasses, so that we return the vclass. This was the intent behind the existing code but it was not working correctly.

This commit is contained in:
rjy7 2010-07-04 17:27:08 +00:00
parent 83afb6c5f0
commit c92f69134c

View file

@ -321,13 +321,9 @@ public class IndividualJena extends IndividualImpl implements Individual {
try { try {
// trying to deal with the fact that an entity may have more than 1 VClass // trying to deal with the fact that an entity may have more than 1 VClass
List<VClass> clasList = this.getVClasses(true); List<VClass> clasList = this.getVClasses(true);
if (clasList == null || clasList.size()==0) { if (clasList == null || clasList.size() < 2) {
getVClass(); moniker = getVClass().getName();
moniker = this.vClass.getName(); } else {
}
if (clasList.size()==1) {
moniker = this.vClass.getName();
}
VClass preferredClass = null; VClass preferredClass = null;
for (VClass clas : clasList) { for (VClass clas : clasList) {
if (clas.getCustomDisplayView() != null && clas.getCustomDisplayView().length()>0) { if (clas.getCustomDisplayView() != null && clas.getCustomDisplayView().length()>0) {
@ -342,6 +338,7 @@ public class IndividualJena extends IndividualImpl implements Individual {
} else { } else {
moniker = preferredClass.getName(); moniker = preferredClass.getName();
} }
}
} catch (Exception e) {} } catch (Exception e) {}
} }
return moniker; return moniker;