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:
parent
83afb6c5f0
commit
c92f69134c
1 changed files with 16 additions and 19 deletions
|
@ -321,26 +321,23 @@ 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();
|
|
||||||
}
|
|
||||||
if (clasList.size()==1) {
|
|
||||||
moniker = this.vClass.getName();
|
|
||||||
}
|
|
||||||
VClass preferredClass = null;
|
|
||||||
for (VClass clas : clasList) {
|
|
||||||
if (clas.getCustomDisplayView() != null && clas.getCustomDisplayView().length()>0) {
|
|
||||||
// arbitrarily deciding that the preferred class (could be >1) is one with a custom view
|
|
||||||
preferredClass = clas;
|
|
||||||
log.debug("Found direct class ["+clas.getName()+"] with custom view "+clas.getCustomDisplayView()+"; resetting entity vClass to this class");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (preferredClass == null) {
|
|
||||||
// no basis for selecting a preferred class name to use
|
|
||||||
moniker = null; // was this.getVClass().getName();
|
|
||||||
} else {
|
} else {
|
||||||
moniker = preferredClass.getName();
|
VClass preferredClass = null;
|
||||||
|
for (VClass clas : clasList) {
|
||||||
|
if (clas.getCustomDisplayView() != null && clas.getCustomDisplayView().length()>0) {
|
||||||
|
// arbitrarily deciding that the preferred class (could be >1) is one with a custom view
|
||||||
|
preferredClass = clas;
|
||||||
|
log.debug("Found direct class ["+clas.getName()+"] with custom view "+clas.getCustomDisplayView()+"; resetting entity vClass to this class");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (preferredClass == null) {
|
||||||
|
// no basis for selecting a preferred class name to use
|
||||||
|
moniker = null; // was this.getVClass().getName();
|
||||||
|
} else {
|
||||||
|
moniker = preferredClass.getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue