merging changes for NIHVIVO-1173 (2nd batch up updates for that issue) into the trunk

This commit is contained in:
sjm222 2010-10-01 18:49:29 +00:00
parent 4adba03c2a
commit 997934d6d8
2 changed files with 75 additions and 8 deletions

View file

@ -39,7 +39,6 @@ import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.RDF; import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS; import com.hp.hpl.jena.vocabulary.RDFS;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean;
import edu.cornell.mannlib.vitro.webapp.beans.Classes2Classes; import edu.cornell.mannlib.vitro.webapp.beans.Classes2Classes;
import edu.cornell.mannlib.vitro.webapp.beans.Ontology; import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClass;
@ -64,8 +63,8 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
/* ************************************************** */ /* ************************************************** */
private String getLabelForClass(OntClass cls,boolean withPrefix,boolean forPickList) { public String getLabelForClass(OntClass cls,boolean withPrefix,boolean forPickList) {
getOntModel().enterCriticalSection(Lock.READ); cls.getModel().enterCriticalSection(Lock.READ);
try { try {
if (cls.isAnon()) { if (cls.isAnon()) {
if (cls.isRestriction()) { if (cls.isRestriction()) {
@ -171,7 +170,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
} catch (Exception e) { } catch (Exception e) {
return "???"; return "???";
} finally { } finally {
getOntModel().leaveCriticalSection(); cls.getModel().leaveCriticalSection();
} }
} }

View file

@ -14,6 +14,7 @@ import com.hp.hpl.jena.shared.Lock;
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean; import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean;
import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
/** /**
@ -44,6 +45,7 @@ public class VClassJena extends VClass {
/** /**
* What this VClass is called * What this VClass is called
*/ */
@Override
public String getName() { public String getName() {
if (this.myName != null) { if (this.myName != null) {
@ -51,10 +53,15 @@ public class VClassJena extends VClass {
} else { } else {
cls.getOntModel().enterCriticalSection(Lock.READ); cls.getOntModel().enterCriticalSection(Lock.READ);
try { try {
VClassDao vClassDao = webappDaoFactory.getVClassDao();
if (vClassDao instanceof VClassDaoJena) {
this.myName = ((VClassDaoJena) vClassDao).getLabelForClass(cls,false,false);
} else {
log.error("WebappDaoFactory returned a type of " + vClassDao.getClass().getName() + ". Expected VClassDaoJena");
this.myName = webappDaoFactory.getJenaBaseDao().getLabelOrId(cls); this.myName = webappDaoFactory.getJenaBaseDao().getLabelOrId(cls);
if (this.myName == null) {
this.myName = "[null]";
} }
return this.myName; return this.myName;
} finally { } finally {
cls.getOntModel().leaveCriticalSection(); cls.getOntModel().leaveCriticalSection();
@ -62,9 +69,58 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getLocalNameWithPrefix() {
if (this.localNameWithPrefix != null) {
return localNameWithPrefix;
} else {
cls.getOntModel().enterCriticalSection(Lock.READ);
try {
VClassDao vClassDao = webappDaoFactory.getVClassDao();
if (vClassDao instanceof VClassDaoJena) {
this.localNameWithPrefix = ((VClassDaoJena) vClassDao).getLabelForClass(cls,true,false);
} else {
log.error("WebappDaoFactory returned a type of " + vClassDao.getClass().getName() + ". Expected VClassDaoJena");
this.localNameWithPrefix = webappDaoFactory.getJenaBaseDao().getLabelOrId(cls);
}
return this.localNameWithPrefix;
} finally {
cls.getOntModel().leaveCriticalSection();
}
}
}
@Override
public String getPickListName() {
if (this.pickListName != null) {
return pickListName;
} else {
cls.getOntModel().enterCriticalSection(Lock.READ);
try {
VClassDao vClassDao = webappDaoFactory.getVClassDao();
if (vClassDao instanceof VClassDaoJena) {
this.pickListName = ((VClassDaoJena) vClassDao).getLabelForClass(cls,false,true);
} else {
log.error("WebappDaoFactory returned a type of " + vClassDao.getClass().getName() + ". Expected VClassDaoJena");
this.pickListName = webappDaoFactory.getJenaBaseDao().getLabelOrId(cls);
}
return this.pickListName;
} finally {
cls.getOntModel().leaveCriticalSection();
}
}
}
/** /**
* An example member of this VClass * An example member of this VClass
*/ */
@Override
public String getExample() { public String getExample() {
if (this.myExample != null) { if (this.myExample != null) {
@ -83,6 +139,7 @@ public class VClassJena extends VClass {
/** /**
* Information about the type of information expected of a member of this VClass * Information about the type of information expected of a member of this VClass
*/ */
@Override
public String getDescription() { public String getDescription() {
if (this.myDescription != null) { if (this.myDescription != null) {
@ -98,6 +155,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getShortDef() { public String getShortDef() {
if (this.myShortDefinition != null) { if (this.myShortDefinition != null) {
@ -113,6 +171,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public int getDisplayLimit() { public int getDisplayLimit() {
if (this.displayLimit != null) { if (this.displayLimit != null) {
@ -128,6 +187,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public int getDisplayRank() { public int getDisplayRank() {
if (this.displayRank != null) { if (this.displayRank != null) {
@ -143,6 +203,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getGroupURI() { public String getGroupURI() {
if (this.groupURI != null) { if (this.groupURI != null) {
@ -167,6 +228,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getCustomEntryForm() { public String getCustomEntryForm() {
if (this.customEntryForm != null) { if (this.customEntryForm != null) {
@ -182,6 +244,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getCustomDisplayView() { public String getCustomDisplayView() {
if (this.customDisplayView != null) { if (this.customDisplayView != null) {
@ -197,6 +260,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getCustomShortView() { public String getCustomShortView() {
if (this.customShortView != null) { if (this.customShortView != null) {
@ -212,6 +276,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public String getCustomSearchView() { public String getCustomSearchView() {
if (this.customSearchView != null) { if (this.customSearchView != null) {
@ -227,6 +292,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public Float getSearchBoost() { public Float getSearchBoost() {
if (this.searchBoost != null) { if (this.searchBoost != null) {
@ -242,6 +308,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public RoleLevel getHiddenFromDisplayBelowRoleLevel() { public RoleLevel getHiddenFromDisplayBelowRoleLevel() {
if (this.hiddenFromDisplayBelowRoleLevel != null) { if (this.hiddenFromDisplayBelowRoleLevel != null) {
@ -276,6 +343,7 @@ public class VClassJena extends VClass {
} }
} }
@Override
public RoleLevel getProhibitedFromUpdateBelowRoleLevel() { public RoleLevel getProhibitedFromUpdateBelowRoleLevel() {
if (this.prohibitedFromUpdateBelowRoleLevel != null) { if (this.prohibitedFromUpdateBelowRoleLevel != null) {