Changing individualSDB.getMoniker() in SDB so that it doesn't return a VClass name when the moniker is not in the model
This commit is contained in:
parent
ddc58f5259
commit
bfa9979266
1 changed files with 155 additions and 141 deletions
|
@ -342,6 +342,10 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
|||
}
|
||||
|
||||
private void doFlag1() {
|
||||
if( webappDaoFactory.getPortalDao().isSinglePortal() ){
|
||||
flag1Set = "0";
|
||||
flag1Numeric = 1;
|
||||
}else{
|
||||
String getObjects = null;
|
||||
Model tempModel = ModelFactory.createDefaultModel();
|
||||
OntModel ontModel = ModelFactory.createOntologyModel(
|
||||
|
@ -384,7 +388,8 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
|||
}
|
||||
portalSet+=Integer.toString(portalNumber);
|
||||
} catch (Exception e) {
|
||||
log.error(e,e);
|
||||
log.warn("could not convert into a " +
|
||||
"portal id:'" + typeName + "' " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -400,9 +405,14 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
|||
w.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void doFlag2() {
|
||||
if( webappDaoFactory.getPortalDao().isSinglePortal() ){
|
||||
flag2Set = "";
|
||||
flag2Numeric = 0 ;
|
||||
}else{
|
||||
String getObjects = null;
|
||||
Model tempModel = ModelFactory.createDefaultModel();
|
||||
OntModel ontModel = ModelFactory.createOntologyModel(
|
||||
|
@ -459,6 +469,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
|||
w.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Date getSunrise() {
|
||||
|
@ -576,45 +587,48 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
|||
moniker = webappDaoFactory.getJenaBaseDao()
|
||||
.getPropertyStringValue(
|
||||
ind,webappDaoFactory.getJenaBaseDao().MONIKER);
|
||||
if (moniker == null) {
|
||||
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) {
|
||||
if( getVClass() != null )
|
||||
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 {
|
||||
preferredClass.getName();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e,e);
|
||||
}
|
||||
}
|
||||
//Changing behavior to moniker because it is taking extra time to get the vclass
|
||||
//alternative if the moniker isn't filled out. That time is wasted if the vclass alternative isn't desired.
|
||||
//see NIHVIVO-2001
|
||||
// if (moniker == null) {
|
||||
// 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) {
|
||||
// if( getVClass() != null )
|
||||
// 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 {
|
||||
// preferredClass.getName();
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error(e,e);
|
||||
// }
|
||||
// }
|
||||
return moniker;
|
||||
} finally {
|
||||
ind.getOntModel().leaveCriticalSection();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue