diff --git a/src/org/vivoweb/webapp/util/ModelUtils.java b/src/org/vivoweb/webapp/util/ModelUtils.java index 3215d07c..97c988b0 100644 --- a/src/org/vivoweb/webapp/util/ModelUtils.java +++ b/src/org/vivoweb/webapp/util/ModelUtils.java @@ -10,6 +10,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; import edu.cornell.mannlib.vitro.webapp.dao.VClassDao; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; @@ -40,32 +41,42 @@ public class ModelUtils { * BFO Process and a parent that is not a BFO Process and issue * a warning if so. */ - public static PropertyURIPair getPropertyForRoleInClass(String classURI, WebappDaoFactory wadf) { - - PropertyURIPair propertyURIPair= null; + public static ObjectProperty getPropertyForRoleInClass(String classURI, WebappDaoFactory wadf) { if (classURI == null) { log.error("input classURI is null"); - return propertyURIPair; + return null; } if (wadf == null) { log.error("input WebappDaoFactory is null"); - return propertyURIPair; + return null; } VClassDao vcd = wadf.getVClassDao(); List superClassURIs = vcd.getSuperClassURIs(classURI, false); Iterator iter = superClassURIs.iterator(); + ObjectProperty op = new ObjectProperty(); + boolean isBFOProcess = false; + while (iter.hasNext()) { String superClassURI = iter.next(); if (processClass.contains(superClassURI)) { - return new PropertyURIPair(processPropertyURI, processPropertyInverseURI); + isBFOProcess = true; + break; } } - return new PropertyURIPair(nonProcessPropertyURI, nonProcessPropertyInverseURI); + if (isBFOProcess) { + op.setURI(processPropertyURI); + op.setURIInverse(processPropertyInverseURI); + } else { + op.setURI(nonProcessPropertyURI); + op.setURIInverse(nonProcessPropertyInverseURI); + } + + return op; } } diff --git a/src/org/vivoweb/webapp/util/PropertyURIPair.java b/src/org/vivoweb/webapp/util/PropertyURIPair.java deleted file mode 100644 index d27782bf..00000000 --- a/src/org/vivoweb/webapp/util/PropertyURIPair.java +++ /dev/null @@ -1,32 +0,0 @@ - -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package org.vivoweb.webapp.util; - -public class PropertyURIPair { - private String propURI = null; - private String inversePropURI = null; - - public PropertyURIPair(){}; - - public PropertyURIPair(String propURI, String inversePropURI) { - this.propURI = propURI; - this.inversePropURI = inversePropURI; - } - - public String getPropURI() { - return propURI; - } - - public void setPropURI(String propURI) { - this.propURI = propURI; - } - - public String getInversePropURI() { - return inversePropURI; - } - - public void setInversePropURI(String inversePropURI) { - this.inversePropURI = inversePropURI; - } -}