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() {
|
private void doFlag1() {
|
||||||
|
if( webappDaoFactory.getPortalDao().isSinglePortal() ){
|
||||||
|
flag1Set = "0";
|
||||||
|
flag1Numeric = 1;
|
||||||
|
}else{
|
||||||
String getObjects = null;
|
String getObjects = null;
|
||||||
Model tempModel = ModelFactory.createDefaultModel();
|
Model tempModel = ModelFactory.createDefaultModel();
|
||||||
OntModel ontModel = ModelFactory.createOntologyModel(
|
OntModel ontModel = ModelFactory.createOntologyModel(
|
||||||
|
@ -384,7 +388,8 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
}
|
}
|
||||||
portalSet+=Integer.toString(portalNumber);
|
portalSet+=Integer.toString(portalNumber);
|
||||||
} catch (Exception e) {
|
} 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();
|
w.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void doFlag2() {
|
private void doFlag2() {
|
||||||
|
if( webappDaoFactory.getPortalDao().isSinglePortal() ){
|
||||||
|
flag2Set = "";
|
||||||
|
flag2Numeric = 0 ;
|
||||||
|
}else{
|
||||||
String getObjects = null;
|
String getObjects = null;
|
||||||
Model tempModel = ModelFactory.createDefaultModel();
|
Model tempModel = ModelFactory.createDefaultModel();
|
||||||
OntModel ontModel = ModelFactory.createOntologyModel(
|
OntModel ontModel = ModelFactory.createOntologyModel(
|
||||||
|
@ -459,6 +469,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Date getSunrise() {
|
public Date getSunrise() {
|
||||||
|
@ -576,45 +587,48 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
moniker = webappDaoFactory.getJenaBaseDao()
|
moniker = webappDaoFactory.getJenaBaseDao()
|
||||||
.getPropertyStringValue(
|
.getPropertyStringValue(
|
||||||
ind,webappDaoFactory.getJenaBaseDao().MONIKER);
|
ind,webappDaoFactory.getJenaBaseDao().MONIKER);
|
||||||
if (moniker == null) {
|
//Changing behavior to moniker because it is taking extra time to get the vclass
|
||||||
try {
|
//alternative if the moniker isn't filled out. That time is wasted if the vclass alternative isn't desired.
|
||||||
// trying to deal with the fact that an entity
|
//see NIHVIVO-2001
|
||||||
// may have more than 1 VClass
|
// if (moniker == null) {
|
||||||
List<VClass> clasList = this.getVClasses(true);
|
// try {
|
||||||
if (clasList == null || clasList.size() < 2) {
|
// // trying to deal with the fact that an entity
|
||||||
if( getVClass() != null )
|
// // may have more than 1 VClass
|
||||||
moniker = getVClass().getName();
|
// List<VClass> clasList = this.getVClasses(true);
|
||||||
} else {
|
// if (clasList == null || clasList.size() < 2) {
|
||||||
VClass preferredClass = null;
|
// if( getVClass() != null )
|
||||||
for (VClass clas : clasList) {
|
// moniker = getVClass().getName();
|
||||||
if (clas.getCustomDisplayView() != null
|
// } else {
|
||||||
&& clas.getCustomDisplayView()
|
// VClass preferredClass = null;
|
||||||
.length()>0) {
|
// for (VClass clas : clasList) {
|
||||||
// arbitrarily deciding that the
|
// if (clas.getCustomDisplayView() != null
|
||||||
// preferred class (could be >1)
|
// && clas.getCustomDisplayView()
|
||||||
// is one with a custom view
|
// .length()>0) {
|
||||||
preferredClass = clas;
|
// // arbitrarily deciding that the
|
||||||
log.debug("Found direct class [" +
|
// // preferred class (could be >1)
|
||||||
clas.getName() +
|
// // is one with a custom view
|
||||||
"] with custom view " +
|
// preferredClass = clas;
|
||||||
clas.getCustomDisplayView() +
|
// log.debug("Found direct class [" +
|
||||||
"; resetting entity vClass " +
|
// clas.getName() +
|
||||||
"to this class");
|
// "] with custom view " +
|
||||||
}
|
// clas.getCustomDisplayView() +
|
||||||
}
|
// "; resetting entity vClass " +
|
||||||
if (preferredClass == null) {
|
// "to this class");
|
||||||
// no basis for selecting a preferred
|
// }
|
||||||
// class name to use
|
// }
|
||||||
moniker = null;
|
// if (preferredClass == null) {
|
||||||
// was this.getVClass().getName();
|
// // no basis for selecting a preferred
|
||||||
} else {
|
// // class name to use
|
||||||
preferredClass.getName();
|
// moniker = null;
|
||||||
}
|
// // was this.getVClass().getName();
|
||||||
}
|
// } else {
|
||||||
} catch (Exception e) {
|
// preferredClass.getName();
|
||||||
log.error(e,e);
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// } catch (Exception e) {
|
||||||
|
// log.error(e,e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
return moniker;
|
return moniker;
|
||||||
} finally {
|
} finally {
|
||||||
ind.getOntModel().leaveCriticalSection();
|
ind.getOntModel().leaveCriticalSection();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue