Changing individualJena.getMoniker() so that it doesn't return a VClass name when the moniker is not in the model
This commit is contained in:
parent
bfa9979266
commit
6e00e1e997
1 changed files with 27 additions and 22 deletions
|
@ -342,29 +342,34 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
||||||
try {
|
try {
|
||||||
moniker = webappDaoFactory.getJenaBaseDao().getPropertyStringValue(ind,webappDaoFactory.getJenaBaseDao().MONIKER);
|
moniker = webappDaoFactory.getJenaBaseDao().getPropertyStringValue(ind,webappDaoFactory.getJenaBaseDao().MONIKER);
|
||||||
if (moniker == null) {
|
if (moniker == null) {
|
||||||
try {
|
//Changing behavior to moniker because it is taking extra time to get the vclass
|
||||||
// trying to deal with the fact that an entity may have more than 1 VClass
|
//alternative if the moniker isn't filled out. That time is wasted if the vclass alternative isn't desired.
|
||||||
List<VClass> clasList = this.getVClasses(true);
|
//see NIHVIVO-2001
|
||||||
if (clasList == null || clasList.size() < 2) {
|
moniker = "";
|
||||||
moniker = getVClass().getName();
|
|
||||||
} else {
|
|
||||||
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) {}
|
|
||||||
}
|
}
|
||||||
|
// try {
|
||||||
|
// // trying to deal with the fact that an entity may have more than 1 VClass
|
||||||
|
// List<VClass> clasList = this.getVClasses(true);
|
||||||
|
// if (clasList == null || clasList.size() < 2) {
|
||||||
|
// moniker = getVClass().getName();
|
||||||
|
// } else {
|
||||||
|
// 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) {}
|
||||||
|
// }
|
||||||
return moniker;
|
return moniker;
|
||||||
} finally {
|
} finally {
|
||||||
ind.getOntModel().leaveCriticalSection();
|
ind.getOntModel().leaveCriticalSection();
|
||||||
|
|
Loading…
Add table
Reference in a new issue