NIHVIVO-3116 and assorted cleanup of legacy backend editor

This commit is contained in:
brianjlowe 2011-10-04 20:50:31 +00:00
parent a9e36bd8dd
commit 17a60cb81c
47 changed files with 442 additions and 662 deletions

View file

@ -33,7 +33,8 @@ public class BaseEditController extends VitroHttpServlet {
public static final String JSP_PREFIX = "/templates/edit/specific/";
protected static DateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy");
protected static DateFormat DISPLAY_DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy");
protected static final int BASE_10 = 10;
private static final Log log = LogFactory.getLog(BaseEditController.class.getName());
private static final String DEFAULT_LANDING_PAGE = Controllers.SITE_ADMIN;

View file

@ -11,7 +11,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -23,6 +22,7 @@ import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
import edu.cornell.mannlib.vedit.listener.ChangeListener;
import edu.cornell.mannlib.vedit.listener.EditPreProcessor;
import edu.cornell.mannlib.vedit.util.FormUtils;
import edu.cornell.mannlib.vedit.util.FormUtils.NegativeIntegerException;
import edu.cornell.mannlib.vedit.util.OperationUtils;
import edu.cornell.mannlib.vedit.validator.ValidationObject;
import edu.cornell.mannlib.vedit.validator.Validator;
@ -201,17 +201,6 @@ public class OperationController extends BaseEditController {
}
}
private void applySimpleMask(EditProcessObject epo, Object newObj) {
// apply the simple mask
//if (epo.getSimpleMask() != null) {
// Iterator smaskIt = epo.getSimpleMask().iterator();
// while (smaskIt.hasNext()){
// Object[] simpleMaskPair = (Object[]) smaskIt.next();
// FormUtils.beanSet(newObj,(String)simpleMaskPair[0],simpleMaskPair[1].toString());
// }
//}
}
private Object getNewObj(EditProcessObject epo) {
Object newObj = null;
if (epo.getOriginalBean() != null) { // we're updating or deleting an existing bean
@ -292,10 +281,14 @@ public class OperationController extends BaseEditController {
epo.getBadValueMap().remove(currParam);
} catch (NumberFormatException e) {
if (currValue.length()>0) {
valid=false;
valid = false;
epo.getErrMsgMap().put(currParam,"Please enter an integer");
epo.getBadValueMap().put(currParam,currValue);
}
} catch (NegativeIntegerException nie) {
valid = false;
epo.getErrMsgMap().put(currParam,"Please enter a positive integer");
epo.getBadValueMap().put(currParam,currValue);
} catch (IllegalArgumentException f) {
valid=false;
log.error("doPost() reports IllegalArgumentException for "+currParam);

View file

@ -5,6 +5,7 @@ package edu.cornell.mannlib.vedit.util;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@ -26,32 +27,45 @@ import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
public class FormUtils {
protected static final Log log = LogFactory.getLog(FormUtils.class.getName());
protected static final Log log = LogFactory.getLog(FormUtils.class.getName());
protected static final int BASE_10 = 10;
protected static final Class[] SUPPORTED_TYPES = { String.class,
int.class,
Integer.class,
boolean.class,
Date.class
};
protected static final List<Class> SUPPORTED_TYPE_LIST = Arrays
.asList(SUPPORTED_TYPES);
/* this class needs to be reworked */
public static String htmlFormFromBean (Object bean, String action, FormObject foo) {
return htmlFormFromBean(bean,action,null,foo,new HashMap());
public static void populateFormFromBean (Object bean,
String action,
FormObject foo) {
populateFormFromBean(bean,action,null,foo,new HashMap());
}
public static String htmlFormFromBean (Object bean, String action, FormObject foo, Map<String, String> badValuesHash) {
return htmlFormFromBean(bean,action,null,foo,badValuesHash);
public static void populateFormFromBean (Object bean,
String action,
FormObject foo,
Map<String, String> badValuesHash) {
populateFormFromBean(bean,action,null,foo,badValuesHash);
}
/**
* Creates a basic XHTML editing form for a bean class
*
* This is the simplest version, creating an input field for each and every setter method in the bean.
*
* @param bean the bean class for which an editing form should be built
* @return XHTML markup of an editing form for the specified class
* @author bjl23
* Populates form objects with bean values
*/
public static String htmlFormFromBean (Object bean, String action, EditProcessObject epo, FormObject foo, Map<String, String> BadValuesHash) {
String formMarkup = "";
Class beanClass = (epo != null && epo.getBeanClass() != null) ? epo.getBeanClass() : bean.getClass();
public static void populateFormFromBean (Object bean,
String action,
EditProcessObject epo,
FormObject foo,
Map<String, String> BadValuesHash) {
Class beanClass =
(epo != null && epo.getBeanClass() != null)
? epo.getBeanClass()
: bean.getClass();
Method[] meths = beanClass.getMethods();
@ -60,32 +74,16 @@ public class FormUtils {
if (meths[i].getName().indexOf("set") == 0) {
// we have a setter method
Method currMeth = meths[i];
Class[] currMethParamTypes = currMeth.getParameterTypes();
Class currMethType = currMethParamTypes[0];
String currMethTypeStr = currMethType.toString();
if (SUPPORTED_TYPE_LIST.contains(currMethType)) {
//we only want people directly to type in ints, strings, and dates
//of course, most of the ints are probably foreign keys anyway...
if (currMethTypeStr.equals("int") || currMethTypeStr.indexOf("class java.lang.String")>-1 || currMethTypeStr.indexOf("class java.util.Date")>-1) {
//we only want people directly to type in ints, strings, and dates
//of course, most of the ints are probably foreign keys anyway...
String elementName = currMeth.getName().substring(3,currMeth.getName().length());
formMarkup += "<tr><td align=\"right\">";
formMarkup += "<p><strong>"+elementName+"</strong></p>";
formMarkup += "</td><td>";
formMarkup += "<input name=\""+elementName+"\" ";
//if int, make a smaller box
if (currMethTypeStr.equals("int")){
formMarkup += " size=\"11\" maxlength=\"11\" ";
}
else
formMarkup += "size=\"75%\" ";
String elementName = currMeth.getName().substring(
3,currMeth.getName().length());
//see if there's something in the bean using
//the related getter method
@ -93,7 +91,8 @@ public class FormUtils {
Class[] paramClass = new Class[1];
paramClass[0] = currMethType;
try {
Method getter = beanClass.getMethod("get"+elementName,(Class[]) null);
Method getter = beanClass.getMethod(
"get" + elementName, (Class[]) null);
Object existingData = null;
try {
existingData = getter.invoke(bean, (Object[]) null);
@ -105,36 +104,40 @@ public class FormUtils {
if (existingData instanceof String){
value += existingData;
}
else if (!(existingData instanceof Integer && (Integer)existingData <= -10000)) {
else if (!(existingData instanceof Integer
&& (Integer)existingData < 0)) {
value += existingData.toString();
}
}
String badValue = (String) BadValuesHash.get(elementName);
if (badValue != null)
value = badValue;
formMarkup += " value=\""+StringEscapeUtils.escapeHtml(value)+"\" ";
if (badValue != null) {
value = badValue;
}
foo.getValues().put(elementName, value);
} catch (NoSuchMethodException e) {
// System.out.println("Could not find method get"+elementName+"()");
//ignore it
}
formMarkup += "/>\n";
formMarkup += "</td></tr>";
}
}
}
return formMarkup;
}
public static List /*of Option*/ makeOptionListFromBeans (List beanList, String valueField, String bodyField, String selectedValue, String selectedBody) {
return makeOptionListFromBeans (beanList, valueField, bodyField, selectedValue, selectedBody, true);
public static List<Option> makeOptionListFromBeans (List beanList,
String valueField,
String bodyField,
String selectedValue,
String selectedBody) {
return makeOptionListFromBeans (
beanList, valueField, bodyField, selectedValue, selectedBody, true);
}
public static List /*of Option*/ makeOptionListFromBeans (List beanList, String valueField, String bodyField, String selectedValue, String selectedBody, boolean forceSelectedInclusion) {
List optList = new LinkedList();
public static List<Option> makeOptionListFromBeans(List beanList,
String valueField,
String bodyField,
String selectedValue,
String selectedBody,
boolean forceSelectedInclusion) {
List<Option> optList = new LinkedList();
if (beanList == null)
return optList;
@ -149,10 +152,12 @@ public class FormUtils {
Method valueMeth = null;
Object valueObj = null;
try {
valueMeth = bean.getClass().getMethod("get"+valueField, (Class[]) null);
valueMeth = bean.getClass().getMethod(
"get" + valueField, (Class[]) null);
valueObj = valueMeth.invoke(bean, (Object[]) null);
} catch (Exception e) {
log.warn("Could not find method get"+valueField+" on "+bean.getClass());
log.warn("Could not find method get" + valueField + " on " +
bean.getClass());
}
if (valueObj != null){
@ -163,7 +168,8 @@ public class FormUtils {
Method bodyMeth = null;
Object bodyObj = null;
try {
bodyMeth = bean.getClass().getMethod("get"+bodyField, (Class[]) null);
bodyMeth = bean.getClass().getMethod(
"get" + bodyField, (Class[]) null);
bodyObj = bodyMeth.invoke(bean, (Object[]) null);
} catch (Exception e) {
log.warn(" could not find method get"+bodyField);
@ -195,11 +201,13 @@ public class FormUtils {
}
/* if the list of beans doesn't include the selected value/body, insert it anyway so we don't inadvertently change the value of the
field to the first thing that happens to be in the select list */
// if the list of beans doesn't include the selected value/body,
// insert it anyway so we don't inadvertently change the value of the
// field to the first thing that happens to be in the select list
boolean skipThisStep = !forceSelectedInclusion;
// for now, if the value is a negative integer, we won't try to preserve it, as the bean was probably just instantiated
// should switch to a more robust way of handling inital bean values later
// For now, if the value is a negative integer, we won't try to
// preserve it, as the bean was probably just instantiated.
// Should switch to a more robust way of handling inital bean values.
if (selectedValue == null) {
skipThisStep = true;
} else {
@ -225,17 +233,21 @@ public class FormUtils {
}
public static List<Option> makeVClassOptionList(WebappDaoFactory wadf, String selectedVClassURI) {
public static List<Option> makeVClassOptionList(WebappDaoFactory wadf,
String selectedVClassURI) {
List<Option> vclassOptionList = new LinkedList<Option>();
for (VClass vclass : wadf.getVClassDao().getAllVclasses()) {
Option option = new Option();
option.setValue(vclass.getURI());
if ( (selectedVClassURI != null) && (vclass.getURI() != null) && (selectedVClassURI.equals(vclass.getURI())) ) {
if ( (selectedVClassURI != null)
&& (vclass.getURI() != null)
&& (selectedVClassURI.equals(vclass.getURI())) ) {
option.setSelected(true);
}
String ontologyName = null;
if (vclass.getNamespace() != null) {
Ontology ont = wadf.getOntologyDao().getOntologyByURI(vclass.getNamespace());
Ontology ont = wadf.getOntologyDao().getOntologyByURI(
vclass.getNamespace());
if ( (ont != null) && (ont.getName() != null) ) {
ontologyName = ont.getName();
}
@ -257,51 +269,43 @@ public class FormUtils {
beanSet (newObj, field, value, null);
}
public static void beanSet(Object newObj, String field, String value, EditProcessObject epo) {
SimpleDateFormat standardDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat minutesOnlyDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Class cls = (epo != null && epo.getBeanClass() != null) ? epo.getBeanClass() : newObj.getClass();
Class[] paramList = new Class[1];
paramList[0] = String.class;
boolean isInt = false;
boolean isDate = false;
boolean isBoolean = false;
Method setterMethod = null;
try {
setterMethod = cls.getMethod("set"+field,paramList);
} catch (NoSuchMethodException e) {
//let's try int
paramList[0] = int.class;
try {
setterMethod = cls.getMethod("set"+field,paramList);
isInt = true;
} catch (NoSuchMethodException f) {
//boolean
paramList[0] = boolean.class;
try {
setterMethod = cls.getMethod("set"+field,paramList);
isBoolean = true;
//System.out.println("Found boolean field "+field);
} catch (NoSuchMethodException h) {
//let's try Date!
paramList[0] = Date.class;
try {
// this isn't so great ; should probably be in a validator
if(value != null && value.length() > 0 && value.indexOf(":") < 1) {
value += " 00:00:00";
}
setterMethod = cls.getMethod("set"+field,paramList);
isDate = true;
} catch (NoSuchMethodException g) {
//System.out.println("beanSet could not find a setter method for "+field+" in "+cls.getName());
}
}
}
}
public static void beanSet(Object newObj,
String field,
String value,
EditProcessObject epo) {
SimpleDateFormat standardDateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
SimpleDateFormat minutesOnlyDateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm");
Class cls =
(epo != null && epo.getBeanClass() != null)
? epo.getBeanClass()
: newObj.getClass();
Class[] paramList = new Class[1];
Method setterMethod = getSetterMethod(cls, field, SUPPORTED_TYPE_LIST);
if (setterMethod == null) {
log.warn("Could not find method set" + field + " on "
+ cls.getName());
return;
}
Class argumentType = setterMethod.getParameterTypes()[0];
Object[] arglist = new Object[1];
if (isInt)
arglist[0] = Integer.decode(value);
else if (isDate)
if (int.class.equals(argumentType)
|| Integer.class.equals(argumentType)) {
arglist[0] = (int.class.equals(argumentType)) ? -1 : null;
if (!value.isEmpty()) {
int parsedInt = Integer.parseInt(value, BASE_10);
if (parsedInt < 0) {
throw new FormUtils.NegativeIntegerException();
} else {
arglist[0] = parsedInt;
}
}
} else if (Date.class.equals(argumentType)) {
// this isn't so great ; should probably be in a validator
if (value != null && value.length() > 0 && value.indexOf(":") < 1) {
value += " 00:00:00";
}
if (value != null && value.length()>0) {
try {
arglist[0] = standardDateFormat.parse(value);
@ -309,28 +313,44 @@ public class FormUtils {
try {
arglist[0] = minutesOnlyDateFormat.parse(value);
} catch (ParseException q) {
log.error(FormUtils.class.getName()+" could not parse"+value+" to a Date object.");
throw new IllegalArgumentException("Please enter a date/time in one of these formats: '2007-07-07', '2007-07-07 07:07', or '2007-07-07 07:07:07'");
log.error(FormUtils.class.getName()+" could not parse" +
value + " to a Date object.");
throw new IllegalArgumentException(
"Please enter a date/time in one of these " +
"formats: '2007-07-07', '2007-07-07 07:07' " +
"or '2007-07-07 07:07:07'");
}
}
} else {
arglist[0] = null;
}
else if (isBoolean) {
} else if (boolean.class.equals(argumentType)) {
arglist[0] = (value.equalsIgnoreCase("true"));
//System.out.println("Setting "+field+" "+value+" "+arglist[0]);
} else {
arglist[0] = value;
}
try {
setterMethod.invoke(newObj,arglist);
} catch (Exception e) {
// System.out.println("Couldn't invoke method");
// System.out.println(e.getMessage());
// System.out.println(field+" "+arglist[0]);
log.error(e,e);
}
}
private static Method getSetterMethod(Class beanClass,
String fieldName,
List<Class> supportedTypes) {
for (Class clazz : supportedTypes) {
try {
Class[] argList = new Class[1];
argList[0] = clazz;
return beanClass.getMethod("set" + fieldName, argList);
} catch (NoSuchMethodException nsme) {
// just try the next type
}
}
return null;
}
/**
* Takes a bean and uses all of its setter methods to set null values
* @return
@ -344,7 +364,8 @@ public class FormUtils {
try{
meth.invoke(bean,(Object[]) null);
} catch (Exception e) {
log.error ("edu.cornell.mannlib.vitro.edit.FormUtils nullBean(Object) unable to use "+meth.getName()+" to set null.");
log.error ("unable to use " + meth.getName() +
" to set null.");
}
}
}
@ -384,11 +405,11 @@ public class FormUtils {
setterObjs[0] = overlayObj;
setterMeth.invoke(base,setterObjs);
} catch (NoSuchMethodException e) {
log.error("edu.cornell.mannlib.vitro.edit.FormUtils.overlayBean(Object,Object) could not find setter method "+setterName);
log.error("could not find setter method "+setterName);
}
}
} catch (Exception e) {
log.error("edu.cornell.mannlib.vitro.edit.FormUtils overlayBean(Object,Object) could not invoke getter method "+methName);
log.error("could not invoke getter method "+methName);
}
}
@ -398,7 +419,8 @@ public class FormUtils {
}
/**
* Decodes a Base-64-encoded String of format key:value;key2:value2;key3:value, and puts the keys and values in a Map
* Decodes a Base-64-encoded String of format
* key:value;key2:value2;key3:value, and puts the keys and values in a Map
* @param params
* @return
*/
@ -410,7 +432,8 @@ public class FormUtils {
beanParamMap.put(p[0],new String(Base64.decodeBase64(p[1].getBytes())));
}
return beanParamMap;
}
}
public static class NegativeIntegerException extends RuntimeException {}
}

View file

@ -7,8 +7,8 @@ import edu.cornell.mannlib.vedit.validator.ValidationObject;
public class IntValidator implements Validator {
protected int minVal = -1;
protected int maxVal = -1;
protected int minVal = 0; // the edit framework doesn't handle negative ints
protected int maxVal = Integer.MAX_VALUE;
public ValidationObject validate (Object obj) throws IllegalArgumentException {

View file

@ -1,64 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
public class Keyword {
private int id = -1;
private String term = null;
private String stem = null;
private String type = null;
private String source = null;
private String comments= null;
private String origin = null;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTerm() {
return term;
}
public void setTerm(String term) {
this.term = term;
}
public String getStem() {
return stem;
}
public void setStem(String stem) {
this.stem = stem;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getComments() {
return comments;
}
public void setComments(String comments) {
this.comments = comments;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
}

View file

@ -1,32 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
public class KeywordIndividualRelation extends BaseResourceBean {
private int keyId = -1;
private String entURI = null;
private String mode = "visible";
public int getKeyId() {
return keyId;
}
public void setKeyId(int keyId) {
this.keyId = keyId;
}
public String getEntURI() {
return entURI;
}
public void setEntURI(String entURI) {
this.entURI = entURI;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
}

View file

@ -1,44 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.beans;
import java.text.Collator;
public class KeywordProperty extends Property implements Comparable<KeywordProperty> {
public final static int DEFAULT_KEYWORDS_DISPLAY_RANK = 99;
private String displayLabel = null;
private int displayRank = 0;
public KeywordProperty(String displayText,String editText,int rank, String groupUri) {
super();
this.setDisplayLabel(displayText);
this.setLabel(editText);
this.setDisplayRank(rank);
this.setGroupURI(groupUri);
this.setLocalName("keywords");
}
public String getDisplayLabel() {
return displayLabel;
}
public void setDisplayLabel(String label) {
displayLabel = label;
}
public int getDisplayRank() {
return displayRank;
}
public void setDisplayRank(int rank) {
displayRank = rank;
}
/**
* Sorts alphabetically by non-public name
*/
public int compareTo (KeywordProperty kp) {
Collator collator = Collator.getInstance();
return collator.compare(this.getDisplayLabel(),(kp).getDisplayLabel());
}
}

View file

@ -31,13 +31,11 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
private String domainVClassURI = null;
private VClass domainVClass = null;
private String domainEntityURI = null;
private String domainSidePhasedOut = null;
private String domainPublic = null;
private String rangeVClassURI = null;
private VClass rangeVClass = null;
private String rangeEntityURI = null;
private String rangeSidePhasedOut = null;
private String rangePublic = null;
private boolean transitive = false;
@ -56,17 +54,15 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
private String domainEntitySortField = null;
private String domainEntitySortDirection = null;
private String domainDisplayTier = "-1";
private int domainDisplayLimit = 5;
private String domainQuickEditJsp = null;
private Integer domainDisplayTier = null;
private Integer domainDisplayLimit = 5;
private String objectIndividualSortPropertyURI = null;
private String rangeEntitySortField = null;
private String rangeEntitySortDirection = null;
private String rangeDisplayTier = "-1";
private int rangeDisplayLimit = 5;
private String rangeQuickEditJsp = null;
private Integer rangeDisplayTier = null;
private Integer rangeDisplayLimit = 5;
private boolean selectFromExisting = true;
private boolean offerCreateNewOption = false;
@ -105,13 +101,6 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
public void setDomainPublic(String domainPublic) {
this.domainPublic = domainPublic;
}
public String getDomainSidePhasedOut() {
return domainSidePhasedOut;
}
public void setDomainSidePhasedOut(String domainSidePhasedOut) {
this.domainSidePhasedOut = domainSidePhasedOut;
}
public VClass getDomainVClass() {
return domainVClass;
}
@ -143,13 +132,6 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
public void setRangePublic(String rangePublic) {
this.rangePublic = rangePublic;
}
public String getRangeSidePhasedOut() {
return rangeSidePhasedOut;
}
public void setRangeSidePhasedOut(String rangeSide) {
this.rangeSidePhasedOut = rangeSide;
}
public VClass getRangeVClass() {
return rangeVClass;
}
@ -271,19 +253,36 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
getObjectPropertyStatements().add(objPropertyStmt);
}
/**
* @return int for compatibility reasons. Null values convert to -1.
*/
public int getDomainDisplayLimit() {
return domainDisplayLimit;
return (domainDisplayLimit == null) ? -1 : domainDisplayLimit;
}
public void setDomainDisplayLimit(int domainDisplayLimit) {
/**
* @return display limit, or null for an unset value
*/
public Integer getDomainDisplayLimitInteger() {
return domainDisplayLimit;
}
public void setDomainDisplayLimit(Integer domainDisplayLimit) {
this.domainDisplayLimit = domainDisplayLimit;
}
public String getDomainDisplayTier() {
/**
* @return int for compatibility reasons. Null values convert to -1.
*/
public int getDomainDisplayTier() {
return (domainDisplayTier != null) ? domainDisplayTier : -1;
}
/**
* @return display tier, or null for an unset value
*/
public Integer getDomainDisplayTierInteger() {
return domainDisplayTier;
}
public void setDomainDisplayTier(String domainDisplayTier) {
public void setDomainDisplayTier(Integer domainDisplayTier) {
this.domainDisplayTier = domainDisplayTier;
}
public String getDomainEntitySortDirection() {
return domainEntitySortDirection;
}
@ -296,34 +295,42 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
public void setDomainEntitySortField(String domainEntitySortField) {
this.domainEntitySortField = domainEntitySortField;
}
public String getDomainQuickEditJsp() {
return domainQuickEditJsp;
}
public void setDomainQuickEditJsp(String domainQuickEditJsp) {
this.domainQuickEditJsp = domainQuickEditJsp;
}
public String getObjectIndividualSortPropertyURI() {
return this.objectIndividualSortPropertyURI;
}
public void setObjectIndividualSortPropertyURI(String objectIndividualSortPropertyURI) {
this.objectIndividualSortPropertyURI = objectIndividualSortPropertyURI;
}
/**
* @return int for compatibility reasons. Null values convert to -1.
*/
public int getRangeDisplayLimit() {
return rangeDisplayLimit;
return (rangeDisplayLimit == null) ? -1 : rangeDisplayLimit;
}
/**
* @return display limit, or null for an unset value
*/
public Integer getRangeDisplayLimitInteger() {
return rangeDisplayLimit;
}
public void setRangeDisplayLimit(int rangeDisplayLimit) {
this.rangeDisplayLimit = rangeDisplayLimit;
}
public String getRangeDisplayTier() {
return rangeDisplayTier;
/**
* @return int for compatibility reason. Null values convert to -1.
*/
public int getRangeDisplayTier() {
return (rangeDisplayTier == null) ? -1 : rangeDisplayTier;
}
public void setRangeDisplayTier(String rangeDisplayTier) {
/**
* @return display tier, or null for an unset value
*/
public Integer getRangeDisplayTierInteger() {
return rangeDisplayTier;
}
public void setRangeDisplayTier(Integer rangeDisplayTier) {
this.rangeDisplayTier = rangeDisplayTier;
}
public String getRangeEntitySortDirection() {
return rangeEntitySortDirection;
}
@ -336,14 +343,6 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
public void setRangeEntitySortField(String rangeEntitySortField) {
this.rangeEntitySortField = rangeEntitySortField;
}
public String getRangeQuickEditJsp() {
return rangeQuickEditJsp;
}
public void setRangeQuickEditJsp(String rangeQuickEditJsp) {
this.rangeQuickEditJsp = rangeQuickEditJsp;
}
public boolean getSelectFromExisting() {
return selectFromExisting;
}
@ -366,60 +365,14 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
public void setStubObjectRelation(boolean b) {
this.stubObjectRelation = b;
}
}
/**
* swaps the domain and range.
*
*/
public final void reflect(){
int tempI = getDomainDisplayLimit();
setDomainDisplayLimit( getRangeDisplayLimit() );
setRangeDisplayLimit( tempI);
String tmpS =getDomainDisplayTier();
setDomainDisplayTier( getRangeDisplayTier() );
setRangeDisplayTier(tmpS);
tmpS=getDomainEntityURI();
setDomainEntityURI(getRangeEntityURI());
setRangeEntityURI(tmpS);
tmpS=getDomainEntitySortDirection();
setDomainEntitySortDirection(getRangeEntitySortDirection());
setRangeEntitySortDirection(tmpS);
tmpS=getDomainEntitySortField();
setDomainEntitySortField(getRangeEntitySortField());
setRangeEntitySortField(tmpS);
tmpS=getDomainPublic();
setDomainPublic(getRangePublic());
setRangePublic(tmpS);
tmpS=getDomainQuickEditJsp();
setDomainQuickEditJsp(getRangeQuickEditJsp());
setRangeQuickEditJsp(tmpS);
tmpS=getDomainSidePhasedOut();
setDomainSidePhasedOut(getRangeSidePhasedOut());
setRangeSidePhasedOut(tmpS);
VClass tmpC=getDomainVClass();
setDomainVClass(getRangeVClass());
setRangeVClass(tmpC);
tmpS = getDomainVClassURI();
setDomainVClassURI(getRangeVClassURI());
setRangeVClassURI(tmpS);
}
/**
* Sorts alphabetically by non-public name
* Sorts alphabetically by public name
*/
public int compareTo (ObjectProperty op) {
Collator collator = Collator.getInstance();
return collator.compare(this.getDomainSidePhasedOut(),(op).getDomainSidePhasedOut());
return collator.compare(this.getDomainPublic(), (op).getDomainPublic());
}
/**
@ -430,11 +383,11 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
public int compare(Object o1, Object o2) {
if( !(o1 instanceof ObjectProperty ) && !(o2 instanceof ObjectProperty))
return 0;
String tier1 = ((ObjectProperty ) o1).getDomainDisplayTier();
String tier2 = ((ObjectProperty ) o2).getDomainDisplayTier();
tier1 = tier1 == null ? "0":tier1;
tier2 = tier2 == null ? "0":tier2;
return Integer.parseInt( tier1 ) - Integer.parseInt( tier2 );
Integer tier1 = ((ObjectProperty ) o1).getDomainDisplayTier();
Integer tier2 = ((ObjectProperty ) o2).getDomainDisplayTier();
tier1 = (tier1 == null) ? 0 : tier1;
tier2 = (tier2 == null) ? 0 : tier2;
return tier1 - tier2;
}
}
@ -670,8 +623,6 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
"domainVClass: " + getDomainVClass() + "\n\t" +
"domainClassId: " + getDomainVClassURI() + "\n\t" +
"domainPublic: " + getDomainPublic() + "\n\t" +
"domainQuickEditJsp: " + getDomainQuickEditJsp() + "\n\t" +
"domainSidePhasedOut: " + getDomainSidePhasedOut() + "\n\t" +
"parentId: " + getParentURI() + "\n\t" +
"rangeDisplayLimit: " + getRangeDisplayLimit() + "\n\t" +
"rangeDisplayTier: " + getRangeDisplayTier() + "\n\t" +
@ -681,8 +632,6 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
"rangeVClass: " + getRangeVClass() + "\n\t" +
"rangeClassId: " + getRangeVClassURI() + "\n\t" +
"rangePublic: " + getRangePublic() + "\n\t" +
"rangeQuickEditJsp: " + getRangeQuickEditJsp() + "\n\t" +
"rangeSidePhasedOut: " + getRangeSidePhasedOut() + "\n\t" +
"customEntryForm" + getCustomEntryForm() + "\n\t" +
"selectFromExisting" + getSelectFromExisting() + "\n\t" +
"offerCreateNewOption" + getOfferCreateNewOption() + "\n\t" +

View file

@ -173,7 +173,6 @@ public class ObjectPropertyStatementImpl implements ObjectPropertyStatement
pi.setPropertyURI(propertyURI);
pi.setSubjectEntURI(subjectURI);
pi.setObjectEntURI(objectURI);
pi.setSubjectSide(subjectOriented);
return pi;
}

View file

@ -71,19 +71,11 @@ public class Property extends BaseResourceBean {
private int determineDisplayRank(Property p) {
if (p instanceof DataProperty) {
DataProperty dp = (DataProperty)p;
DataProperty dp = (DataProperty) p;
return dp.getDisplayTier();
} else if (p instanceof ObjectProperty) {
ObjectProperty op = (ObjectProperty)p;
String tierStr = p.isSubjectSide() ? op.getDomainDisplayTier() : op.getRangeDisplayTier();
try {
return Integer.parseInt(tierStr);
} catch (NumberFormatException ex) {
log.error("Cannot decode object property display tier value "+tierStr+" as an integer");
}
} else if (p instanceof KeywordProperty) {
KeywordProperty kp = (KeywordProperty)p;
return kp.getDisplayRank();
ObjectProperty op = (ObjectProperty) p;
return op.getDomainDisplayTier();
} else {
log.error("Property is of unknown class in PropertyRanker()");
}

View file

@ -364,12 +364,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
return dp.getDisplayTier();
} else if (p instanceof ObjectProperty) {
ObjectProperty op = (ObjectProperty)p;
String tierStr = p.isSubjectSide() ? op.getDomainDisplayTier() : op.getRangeDisplayTier();
try {
return Integer.parseInt(tierStr);
} catch (NumberFormatException ex) {
log.error("Cannot decode object property display tier value "+tierStr+" as an integer");
}
return op.getDomainDisplayTier();
} else {
log.error("Property is of unknown class in PropertyRanker()");
}

View file

@ -83,7 +83,7 @@ public class ApplicationBeanRetryController extends BaseEditController {
foo.setOptionLists(optionMap);
epo.setFormObject(foo);
FormUtils.htmlFormFromBean(applicationForEditing, epo.getAction(), foo);
FormUtils.populateFormFromBean(applicationForEditing, epo.getAction(), foo);
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");

View file

@ -95,10 +95,9 @@ public class ClassgroupRetryController extends BaseEditController {
foo.setErrorMap(epo.getErrMsgMap());
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(vclassGroupForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(vclassGroupForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/classgroup_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -85,10 +85,9 @@ public class DataPropertyStatementRetryController extends BaseEditController {
foo.setOptionLists(OptionMap);
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
FormUtils.populateFormFromBean(objectForEditing,action,foo);
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/ents2data_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -29,6 +29,7 @@ import edu.cornell.mannlib.vitro.webapp.auth.policy.bean.PropertyRestrictionList
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.RoleLevelOptionsSetup;
@ -130,15 +131,25 @@ public class DatapropRetryController extends BaseEditController {
foo.setErrorMap(epo.getErrMsgMap()); // retain error messages from previous time through the form
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
FormUtils.populateFormFromBean(objectForEditing,action,foo);
//for now, this is also making the value hash - need to separate this out
HashMap optionMap = new HashMap();
List namespaceList = FormUtils.makeOptionListFromBeans(ontDao.getAllOntologies(),"URI","Name", ((objectForEditing.getNamespace()==null) ? "" : objectForEditing.getNamespace()), null, (objectForEditing.getNamespace()!=null));
namespaceList.add(new Option(vreq.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
namespaceList.add(0, new Option(vreq.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
optionMap.put("Namespace", namespaceList);
List<Option> domainOptionList = FormUtils.makeVClassOptionList(vreq.getFullWebappDaoFactory(), objectForEditing.getDomainClassURI());
List<Option> domainOptionList = FormUtils.makeVClassOptionList(vreq.getFullWebappDaoFactory(), objectForEditing.getDomainClassURI());
if (objectForEditing.getDomainClassURI() != null) {
VClass domain = vreq.getWebappDaoFactory().getVClassDao()
.getVClassByURI(objectForEditing.getDomainClassURI());
if (domain.isAnonymous()) {
domainOptionList.add(0, new Option(
domain.getURI(),
domain.getName(),
true));
}
}
domainOptionList.add(0, new Option("","(none specified)"));
optionMap.put("DomainClassURI", domainOptionList);
@ -166,7 +177,6 @@ public class DatapropRetryController extends BaseEditController {
foo.setErrorMap(epo.getErrMsgMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("colspan","4");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -83,12 +83,11 @@ public class DatatypeRetryController extends BaseEditController {
FormObject foo = new FormObject();
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
FormUtils.populateFormFromBean(objectForEditing,action,foo);
//for now, this is also making the value hash - need to separate this out
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");
request.setAttribute("formJsp","/templates/edit/specific/datatype_retry.jsp");

View file

@ -275,8 +275,7 @@ public class EntityRetryController extends BaseEditController {
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
DateFormat minutesOnlyDateFormat = new SimpleDateFormat ("yyyy-MM-dd HH:mm");
DateFormat dateOnlyFormat = new SimpleDateFormat("yyyy-MM-dd");
String html = FormUtils.htmlFormFromBean(individualForEditing,action,epo,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(individualForEditing,action,epo,foo,epo.getBadValueMap());
List cList = new ArrayList();
cList.add(new IndividualDataPropertyStatementProcessor());
@ -289,7 +288,6 @@ public class EntityRetryController extends BaseEditController {
ApplicationBean appBean = vreq.getAppBean();
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/entity_retry.jsp");
request.setAttribute("epoKey",epo.getKey());

View file

@ -92,10 +92,9 @@ public class ExternalIdRetryController extends BaseEditController {
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(eidForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(eidForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/externalIds_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -99,10 +99,9 @@ public class NamespaceRetryController extends BaseEditController {
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(namespaceForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(namespaceForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/namespace_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -143,10 +143,9 @@ public class ObjectPropertyStatementRetryController extends BaseEditController {
foo.setOptionLists(optionMap);
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(objectForEditing,action,foo);
FormUtils.populateFormFromBean(objectForEditing,action,foo);
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/ents2ents_retry_domainSide.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -113,10 +113,9 @@ public class OntologyRetryController extends BaseEditController {
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(ontologyForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(ontologyForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/ontology_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -94,10 +94,9 @@ public class PropertyGroupRetryController extends BaseEditController {
foo.setErrorMap(epo.getErrMsgMap());
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(propertyGroupForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(propertyGroupForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/propertyGroup_retry.jsp");
request.setAttribute("scripts","/templates/edit/formBasic.js");

View file

@ -143,7 +143,7 @@ public class PropertyRetryController extends BaseEditController {
HashMap<String, List<Option>> optionMap = new HashMap<String, List<Option>>();
try {
List<Option> namespaceIdList = FormUtils.makeOptionListFromBeans(ontDao.getAllOntologies(),"URI","Name", ((propertyForEditing.getNamespace()==null) ? "" : propertyForEditing.getNamespace()), null, (propertyForEditing.getNamespace()!=null));
namespaceIdList.add(new Option(request.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
namespaceIdList.add(0, new Option(request.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
optionMap.put("Namespace", namespaceIdList);
List<Option> namespaceIdInverseList = FormUtils.makeOptionListFromBeans(ontDao.getAllOntologies(),"URI","Name", ((propertyForEditing.getNamespaceInverse()==null) ? "" : propertyForEditing.getNamespaceInverse()), null, (propertyForEditing.getNamespaceInverse()!=null));
namespaceIdInverseList.add(new Option(request.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
@ -160,10 +160,24 @@ public class PropertyRetryController extends BaseEditController {
List<Option> objectIndividualSortPropertyList = FormUtils.makeOptionListFromBeans(dpList,"URI","Name",propertyForEditing.getObjectIndividualSortPropertyURI(),null);
objectIndividualSortPropertyList.add(0,new Option("","- select data property -"));
optionMap.put("ObjectIndividualSortPropertyURI",objectIndividualSortPropertyList);
List<Option> domainOptionList = FormUtils.makeVClassOptionList(request.getFullWebappDaoFactory(), propertyForEditing.getDomainVClassURI());
List<Option> domainOptionList = FormUtils.makeVClassOptionList(request.getFullWebappDaoFactory(), propertyForEditing.getDomainVClassURI());
if (propertyForEditing.getDomainVClass() != null
&& propertyForEditing.getDomainVClass().isAnonymous()) {
domainOptionList.add(0, new Option(
propertyForEditing.getDomainVClass().getURI(),
propertyForEditing.getDomainVClass().getName(),
true));
}
domainOptionList.add(0, new Option("","(none specified)"));
optionMap.put("DomainVClassURI", domainOptionList);
List<Option> rangeOptionList = FormUtils.makeVClassOptionList(request.getFullWebappDaoFactory(), propertyForEditing.getRangeVClassURI());
List<Option> rangeOptionList = FormUtils.makeVClassOptionList(request.getFullWebappDaoFactory(), propertyForEditing.getRangeVClassURI());
if (propertyForEditing.getRangeVClass() != null
&& propertyForEditing.getRangeVClass().isAnonymous()) {
rangeOptionList.add(0, new Option(
propertyForEditing.getRangeVClass().getURI(),
propertyForEditing.getRangeVClass().getName(),
true));
}
rangeOptionList.add(0, new Option("","(none specified)"));
optionMap.put("RangeVClassURI", rangeOptionList);
} catch (Exception e) {
@ -204,7 +218,7 @@ public class PropertyRetryController extends BaseEditController {
epo.setFormObject(foo);
String html = FormUtils.htmlFormFromBean(propertyForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(propertyForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");

View file

@ -144,7 +144,7 @@ public class VclassRetryController extends BaseEditController {
List namespaceIdList = (action.equals("insert"))
? FormUtils.makeOptionListFromBeans(oDao.getAllOntologies(),"URI","Name", ((vclassForEditing.getNamespace()==null) ? "" : vclassForEditing.getNamespace()), null, false)
: FormUtils.makeOptionListFromBeans(oDao.getAllOntologies(),"URI","Name", ((vclassForEditing.getNamespace()==null) ? "" : vclassForEditing.getNamespace()), null, true);
namespaceIdList.add(new Option(request.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
namespaceIdList.add(0, new Option(request.getFullWebappDaoFactory().getDefaultNamespace(),"default"));
optionMap.put("Namespace", namespaceIdList);
} catch (Exception e) {
log.error(this.getClass().getName() + "unable to create Namespace option list");
@ -161,10 +161,9 @@ public class VclassRetryController extends BaseEditController {
request.setAttribute("formValue",foo.getValues());
String html = FormUtils.htmlFormFromBean(vclassForEditing,action,foo,epo.getBadValueMap());
FormUtils.populateFormFromBean(vclassForEditing,action,foo,epo.getBadValueMap());
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
request.setAttribute("formHtml",html);
request.setAttribute("bodyJsp","/templates/edit/formBasic.jsp");
request.setAttribute("formJsp","/templates/edit/specific/vclass_retry.jsp");
request.setAttribute("colspan","4");

View file

@ -43,7 +43,7 @@ public class AllClassGroupsListingController extends BaseEditController {
results.add("XX");
results.add("Group");
results.add("display rank");
results.add("last modified");
results.add("XX");
results.add("XX");
if (groups != null) {
@ -58,8 +58,9 @@ public class AllClassGroupsListingController extends BaseEditController {
} catch (Exception e) {
results.add(publicName);
}
results.add(Integer.valueOf(vcg.getDisplayRank()).toString());
results.add("???"); // VClassGroup doesn't yet supprt getModTime()
Integer t;
results.add(((t = Integer.valueOf(vcg.getDisplayRank())) != -1) ? t.toString() : "");
results.add(""); // VClassGroup doesn't yet supprt getModTime()
results.add("XX");
List<VClass> classList = vcg.getVitroClassList();
if (classList != null && classList.size()>0) {

View file

@ -211,9 +211,21 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
} else {
numCols = addColToResults("unspecified", results, numCols);
}
numCols = addColToResults(Integer.toString(dp.getDisplayTier()), results, numCols); // ("d"+dp.getDomainDisplayTier()+",r"+dp.getRangeDisplayTier(), results, numCols); // column 6
numCols = addColToResults(dp.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified" : dp.getHiddenFromDisplayBelowRoleLevel().getShorthand(), results, numCols); // column 7
numCols = addColToResults(dp.getProhibitedFromUpdateBelowRoleLevel() == null ? "unspecified" : dp.getProhibitedFromUpdateBelowRoleLevel().getShorthand(), results, numCols); // column 8
Integer displayTier = dp.getDisplayTier();
String displayTierStr = (displayTier < 0)
? ""
: Integer.toString(displayTier);
numCols = addColToResults(displayTierStr, results, numCols);
numCols = addColToResults(
(dp.getHiddenFromDisplayBelowRoleLevel() == null)
? "unspecified"
: dp.getHiddenFromDisplayBelowRoleLevel()
.getShorthand(), results, numCols); // column 7
numCols = addColToResults(
(dp.getProhibitedFromUpdateBelowRoleLevel() == null)
? "unspecified"
: dp.getProhibitedFromUpdateBelowRoleLevel()
.getShorthand(), results, numCols); // column 8
results.add("XX"); // column 9
}
return results;

View file

@ -139,8 +139,16 @@ public class DatatypePropertiesListingController extends BaseEditController {
} else {
results.add("unspecified");
}
results.add(String.valueOf(prop.getDisplayTier())); // column 6
results.add(String.valueOf(prop.getDisplayLimit())); // column 7
Integer displayTier = prop.getDisplayTier();
String displayTierStr = (displayTier < 0)
? ""
: Integer.toString(displayTier);
results.add(displayTierStr); // column 6
Integer displayLimit = prop.getDisplayLimit();
String displayLimitStr = (displayLimit < 0)
? ""
: Integer.toString(displayLimit);
results.add(displayLimitStr); // column 7
results.add(prop.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified" : prop.getHiddenFromDisplayBelowRoleLevel().getShorthand()); // column 8
results.add(prop.getProhibitedFromUpdateBelowRoleLevel() == null ? "unspecified" : prop.getProhibitedFromUpdateBelowRoleLevel().getShorthand()); // column 9
}

View file

@ -75,7 +75,12 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
if (startPropertyUri != null) {
roots = new LinkedList<ObjectProperty>();
roots.add(opDao.getObjectPropertyByURI(startPropertyUri));
ObjectProperty op = opDao.getObjectPropertyByURI(startPropertyUri);
if (op == null) {
op = new ObjectProperty();
op.setURI(startPropertyUri);
}
roots.add(op);
} else {
roots = opDao.getRootObjectProperties();
if (roots!=null){
@ -83,7 +88,7 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
}
}
if (roots!=null) {
if (roots != null) {
Iterator<ObjectProperty> rootIt = roots.iterator();
if (!rootIt.hasNext()) {
ObjectProperty op = new ObjectProperty();
@ -94,7 +99,10 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
} else {
while (rootIt.hasNext()) {
ObjectProperty root = rootIt.next();
if ( (ontologyUri==null) || ( (ontologyUri!=null) && (root.getNamespace()!=null) && (ontologyUri.equals(root.getNamespace())) ) ) {
if ( (ontologyUri==null) ||
( (ontologyUri != null)
&& (root.getNamespace() != null)
&& (ontologyUri.equals(root.getNamespace())) ) ) {
ArrayList childResults = new ArrayList();
addChildren(root, childResults, 0, ontologyUri);
results.addAll(childResults);
@ -165,8 +173,6 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
private List addObjectPropertyDataToResultsList(ObjectProperty op, int position, String ontologyUri) {
List results = new ArrayList();
if (ontologyUri == null || ( (op.getNamespace()!=null) && (op.getNamespace().equals(ontologyUri)) ) ) {
//if (position==1)
// position=2;
for (int i=0; i<position; i++) {
results.add("@@entities"); // column 1
}
@ -201,9 +207,24 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
} else {
numCols = addColToResults("unspecified", results, numCols);
}
numCols = addColToResults(op.getDomainDisplayTier(), results, numCols); // ("d"+op.getDomainDisplayTier()+",r"+op.getRangeDisplayTier(), results, numCols); // column 6
numCols = addColToResults(op.getHiddenFromDisplayBelowRoleLevel() == null ? "unspecified" : op.getHiddenFromDisplayBelowRoleLevel().getShorthand(), results, numCols); // column 7
numCols = addColToResults(op.getProhibitedFromUpdateBelowRoleLevel() == null ? "unspecified" : op.getProhibitedFromUpdateBelowRoleLevel().getShorthand(), results, numCols); // column 8
Integer displayTier = op.getDomainDisplayTierInteger();
numCols = addColToResults(
(displayTier == null)
? ""
: Integer.toString(displayTier, BASE_10),
results, numCols); // column 6
numCols = addColToResults(
(op.getHiddenFromDisplayBelowRoleLevel() == null)
? "unspecified"
: op.getHiddenFromDisplayBelowRoleLevel()
.getShorthand(),
results, numCols); // column 7
numCols = addColToResults(
(op.getProhibitedFromUpdateBelowRoleLevel() == null)
? "unspecified"
: op.getProhibitedFromUpdateBelowRoleLevel()
.getShorthand(),
results, numCols); // column 8
results.add("XX"); // column 9
}
return results;

View file

@ -55,15 +55,25 @@ public class PropertyGroupsListingController extends BaseEditController {
results.add("XX");
if (pg.getName() != null) {
try {
results.add("<a href=\"./editForm?uri="+URLEncoder.encode(pg.getURI(),"UTF-8")+"&amp;controller=PropertyGroup\">"+pg.getName()+"</a>");
results.add("<a href=\"./editForm?uri=" +
URLEncoder.encode(pg.getURI(),"UTF-8") +
"&amp;controller=PropertyGroup\">" +
pg.getName() + "</a>");
} catch (Exception e) {
results.add(pg.getName());
}
} else {
results.add("");
}
results.add(pg.getPublicDescription()==null ? "unspecified" : pg.getPublicDescription());
results.add(Integer.valueOf(pg.getDisplayRank()).toString());
results.add(
(pg.getPublicDescription() == null)
? "unspecified"
: pg.getPublicDescription());
Integer t;
results.add(
((t = Integer.valueOf(pg.getDisplayRank())) != -1)
? t.toString()
: "");
results.add("XX");
List<Property> classList = pg.getPropertyList();
if (classList != null && classList.size()>0) {
@ -79,33 +89,55 @@ public class PropertyGroupsListingController extends BaseEditController {
Property p = propIt.next();
if (p instanceof ObjectProperty) {
ObjectProperty op = (ObjectProperty) p;
if (op.getLocalNameWithPrefix() != null && op.getURI() != null) {
if (op.getLocalNameWithPrefix() != null
&& op.getURI() != null) {
try {
results.add("<a href=\"propertyEdit?uri="+URLEncoder.encode(op.getURI(),"UTF-8")+"\">"+op.getLocalNameWithPrefix()+"</a>");
results.add("<a href=\"propertyEdit?uri=" +
URLEncoder.encode(
op.getURI(), "UTF-8") +
"\">" +
op.getLocalNameWithPrefix()
+ "</a>");
} catch (Exception e) {
results.add(op.getLocalNameWithPrefix());
}
} else {
results.add("");
}
String exampleStr = (op.getExample() == null) ? "" : op.getExample();
String exampleStr =
(op.getExample() == null)
? ""
: op.getExample();
results.add(exampleStr);
String descriptionStr = (op.getDescription() == null) ? "" : op.getDescription();
String descriptionStr =
(op.getDescription() == null)
? ""
: op.getDescription();
results.add(descriptionStr);
} else {
DataProperty dp = (DataProperty) p;
if (dp.getName() != null && dp.getURI() != null) {
try {
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")+"\">"+dp.getName()+"</a>");
results.add("<a href=\"datapropEdit?uri=" +
URLEncoder.encode(
dp.getURI(),"UTF-8") +
"\">" + dp.getName() +
"</a>");
} catch (Exception e) {
results.add(dp.getName());
}
} else {
results.add("");
}
String exampleStr = (dp.getExample() == null) ? "" : dp.getExample();
String exampleStr =
(dp.getExample() == null)
? ""
: dp.getExample();
results.add(exampleStr);
String descriptionStr = (dp.getDescription() == null) ? "" : dp.getDescription();
String descriptionStr =
(dp.getDescription() == null)
? ""
: dp.getDescription();
results.add(descriptionStr);
}
if (propIt.hasNext())

View file

@ -182,7 +182,11 @@ public class PropertyWebappsListingController extends BaseEditController {
} else {
results.add("unspecified");
}
results.add(prop.getDomainDisplayTier()); //("d"+prop.getDomainDisplayTier()+",r"+prop.getRangeDisplayTier()); // column 7
if (prop.getDomainDisplayTierInteger() != null) {
results.add(Integer.toString(prop.getDomainDisplayTierInteger(), BASE_10)); // column 7
} else {
results.add(""); // column 7
}
results.add(prop.getHiddenFromDisplayBelowRoleLevel() == null ? "(unspecified)" : prop.getHiddenFromDisplayBelowRoleLevel().getShorthand()); // column 8
results.add(prop.getProhibitedFromUpdateBelowRoleLevel() == null ? "(unspecified)" : prop.getProhibitedFromUpdateBelowRoleLevel().getShorthand()); // column 9
}

View file

@ -8,7 +8,6 @@ import java.util.List;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.edit.EditLiteral;
import edu.cornell.mannlib.vitro.webapp.search.beans.ObjectSourceIface;

View file

@ -11,8 +11,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstanceIface;
public interface PropertyInstanceDao {
public abstract Iterator getAllOfThisTypeIterator();
void deleteObjectPropertyStatement(String subjectURI, String propertyURI, String objectURI);
Collection<PropertyInstance> getAllPossiblePropInstForIndividual(String individualURI);

View file

@ -114,12 +114,6 @@ public class FilteringPropertyInstanceDao implements PropertyInstanceDao {
return null;
}
/* ************* unfiltered methods that might need to be filtered ****** */
public Iterator getAllOfThisTypeIterator() {
return innerPropertyInstanceDao.getAllOfThisTypeIterator();
}
/* **************** unfiltered methods ***************** */
public void deleteObjectPropertyStatement(String subjectURI,
String propertyURI, String objectURI) {

View file

@ -9,12 +9,10 @@ import java.util.Iterator;
import java.util.List;
import net.sf.jga.algorithms.Filter;
import net.sf.jga.algorithms.Summarize;
import net.sf.jga.algorithms.Transform;
import net.sf.jga.fn.UnaryFunctor;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;

View file

@ -71,10 +71,20 @@ public class ObjectPropertyFiltering extends ObjectProperty {
}
@Override
public String getDomainDisplayTier() {
public Integer getDomainDisplayLimitInteger() {
return innerObjectProperty.getDomainDisplayLimitInteger();
}
@Override
public int getDomainDisplayTier() {
return innerObjectProperty.getDomainDisplayTier();
}
@Override
public Integer getDomainDisplayTierInteger() {
return innerObjectProperty.getDomainDisplayTierInteger();
}
@Override
public String getDomainEntitySortDirection() {
return innerObjectProperty.getDomainEntitySortDirection();
@ -94,17 +104,7 @@ public class ObjectPropertyFiltering extends ObjectProperty {
public String getDomainPublic() {
return innerObjectProperty.getDomainPublic();
}
@Override
public String getDomainQuickEditJsp() {
return innerObjectProperty.getDomainQuickEditJsp();
}
@Override
public String getDomainSidePhasedOut() {
return innerObjectProperty.getDomainSidePhasedOut();
}
@Override
public VClass getDomainVClass() {
return innerObjectProperty.getDomainVClass();
@ -208,10 +208,20 @@ public class ObjectPropertyFiltering extends ObjectProperty {
}
@Override
public String getRangeDisplayTier() {
public Integer getRangeDisplayLimitInteger() {
return innerObjectProperty.getRangeDisplayLimitInteger();
}
@Override
public int getRangeDisplayTier() {
return innerObjectProperty.getRangeDisplayTier();
}
@Override
public Integer getRangeDisplayTierInteger() {
return innerObjectProperty.getRangeDisplayTierInteger();
}
@Override
public String getRangeEntitySortDirection() {
return innerObjectProperty.getRangeEntitySortDirection();
@ -232,16 +242,6 @@ public class ObjectPropertyFiltering extends ObjectProperty {
return innerObjectProperty.getRangePublic();
}
@Override
public String getRangeQuickEditJsp() {
return innerObjectProperty.getRangeQuickEditJsp();
}
@Override
public String getRangeSidePhasedOut() {
return innerObjectProperty.getRangeSidePhasedOut();
}
@Override
public VClass getRangeVClass() {
return innerObjectProperty.getRangeVClass();
@ -303,12 +303,12 @@ public class ObjectPropertyFiltering extends ObjectProperty {
}
@Override
public void setDomainDisplayLimit(int domainDisplayLimit) {
public void setDomainDisplayLimit(Integer domainDisplayLimit) {
innerObjectProperty.setDomainDisplayLimit(domainDisplayLimit);
}
@Override
public void setDomainDisplayTier(String domainDisplayTier) {
public void setDomainDisplayTier(Integer domainDisplayTier) {
innerObjectProperty.setDomainDisplayTier(domainDisplayTier);
}
@ -333,16 +333,6 @@ public class ObjectPropertyFiltering extends ObjectProperty {
innerObjectProperty.setDomainPublic(domainPublic);
}
@Override
public void setDomainQuickEditJsp(String domainQuickEditJsp) {
innerObjectProperty.setDomainQuickEditJsp(domainQuickEditJsp);
}
@Override
public void setDomainSidePhasedOut(String domainSidePhasedOut) {
innerObjectProperty.setDomainSidePhasedOut(domainSidePhasedOut);
}
@Override
public void setDomainVClass(VClass domainVClass) {
innerObjectProperty.setDomainVClass(domainVClass);
@ -464,7 +454,7 @@ public class ObjectPropertyFiltering extends ObjectProperty {
}
@Override
public void setRangeDisplayTier(String rangeDisplayTier) {
public void setRangeDisplayTier(Integer rangeDisplayTier) {
innerObjectProperty.setRangeDisplayTier(rangeDisplayTier);
}
@ -489,16 +479,6 @@ public class ObjectPropertyFiltering extends ObjectProperty {
innerObjectProperty.setRangePublic(rangePublic);
}
@Override
public void setRangeQuickEditJsp(String rangeQuickEditJsp) {
innerObjectProperty.setRangeQuickEditJsp(rangeQuickEditJsp);
}
@Override
public void setRangeSidePhasedOut(String rangeSide) {
innerObjectProperty.setRangeSidePhasedOut(rangeSide);
}
@Override
public void setRangeVClass(VClass rangeVClass) {
innerObjectProperty.setRangeVClass(rangeVClass);

View file

@ -6,11 +6,9 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
@ -18,18 +16,11 @@ import java.util.Set;
import org.apache.commons.lang.NotImplementedException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntResource;
import com.hp.hpl.jena.ontology.UnionClass;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.AnonId;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Property;
@ -40,14 +31,12 @@ import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.rdf.model.Statement;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.shared.Lock;
import com.hp.hpl.jena.util.iterator.ClosableIterator;
import com.hp.hpl.jena.vocabulary.OWL;
import com.hp.hpl.jena.vocabulary.RDF;
import com.hp.hpl.jena.vocabulary.RDFS;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;

View file

@ -34,8 +34,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
import edu.cornell.mannlib.vitro.webapp.beans.Link;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;

View file

@ -18,7 +18,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.DateTime;
import com.clarkparsia.pellet.sparqldl.engine.QueryExec;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.ontology.OntResource;
@ -46,8 +45,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
import edu.cornell.mannlib.vitro.webapp.beans.Link;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatementImpl;

View file

@ -251,6 +251,21 @@ public class JenaBaseDao extends JenaBaseDaoCon {
}
}
/**
* convenience method
*/
protected Integer getPropertyNonNegativeIntegerValue(OntResource res, Property dataprop) {
if (dataprop != null) {
try {
return ((Literal)res.getPropertyValue(dataprop)).getInt();
} catch (Exception e) {
return null;
}
} else {
return null;
}
}
/**
* convenience method
*/
@ -322,13 +337,27 @@ public class JenaBaseDao extends JenaBaseDaoCon {
* convenience method for use with functional datatype properties
*/
protected void updatePropertyNonNegativeIntValue(Resource res, Property dataprop, int value, Model model) {
if (value < 0)
return;
updatePropertyIntValue(res,dataprop,value,model);
if (value < 0) {
// TODO fixme: the backend editor depends on this weird behavior.
if (model != null && res != null && dataprop != null) {
model.removeAll(res, dataprop, (RDFNode) null);
}
} else {
updatePropertyIntValue(res,dataprop,value,model);
}
}
/**
* convenience method for use with functional datatype properties
*/
protected void updatePropertyNonNegativeIntegerValue(Resource res, Property dataprop, Integer value, Model model) {
if (value != null) {
updatePropertyIntValue(res,dataprop,value,model);
} else {
model.removeAll(res, dataprop, (RDFNode) null);
}
}
/**
* convenience method for use with functional datatype properties

View file

@ -98,11 +98,6 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
p.setPickListName(p.getLocalName()+" ("+prefix+")");
}
String propertyName = getPropertyStringValue(op,PROPERTY_FULLPROPERTYNAMEANNOT);
if (propertyName != null) {
p.setDomainSidePhasedOut(propertyName);
} else {
p.setDomainSidePhasedOut(op.getLocalName());
}
if (op.getLabel(null) != null)
p.setDomainPublic(getLabelOrId(op));
else
@ -135,11 +130,6 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
p.setNamespaceInverse(invOp.getNameSpace());
p.setLocalNameInverse(invOp.getLocalName());
String invPropertyName = getPropertyStringValue(invOp,PROPERTY_FULLPROPERTYNAMEANNOT);
if (invPropertyName != null) {
p.setRangeSidePhasedOut(invPropertyName);
} else {
p.setRangeSidePhasedOut(invOp.getLocalName());
}
p.setRangePublic(getLabelOrId(invOp));
}
try {
@ -166,16 +156,8 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
p.setDescription(getPropertyStringValue(op,DESCRIPTION_ANNOT));
p.setPublicDescription(getPropertyStringValue(op,PUBLIC_DESCRIPTION_ANNOT));
try {
p.setDomainDisplayTier(Integer.toString(getPropertyNonNegativeIntValue(op,DISPLAY_RANK_ANNOT)));
} catch (Exception e) {
log.error("Error converting displayRank integer to string for "+op.getURI());
}
try {
p.setRangeDisplayTier(Integer.toString(getPropertyNonNegativeIntValue(invOp,DISPLAY_RANK_ANNOT)));
} catch (Exception e) {
log.error("Error converting displayRank integer to string for "+invOp.getURI());
}
p.setDomainDisplayTier(getPropertyNonNegativeIntegerValue(op,DISPLAY_RANK_ANNOT));
p.setRangeDisplayTier(getPropertyNonNegativeIntegerValue(invOp,DISPLAY_RANK_ANNOT));
p.setDomainDisplayLimit(getPropertyNonNegativeIntValue(op,DISPLAY_LIMIT));
p.setRangeDisplayLimit(getPropertyNonNegativeIntValue(invOp,DISPLAY_LIMIT));
p.setDomainEntitySortField(getPropertyStringValue(op,PROPERTY_ENTITYSORTFIELD));
@ -236,13 +218,6 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
Boolean collateBySubclass = getPropertyBooleanValue(op,PROPERTY_COLLATEBYSUBCLASSANNOT);
p.setCollateBySubclass(collateBySubclass==null ? false : collateBySubclass);
// the <i> thing from the old system causes sorting problems and ugliness; here is an inelegant way of dealing with it for now (Note <i>s will disappear on update)
if (p.getDomainSidePhasedOut() != null) {
p.setDomainSidePhasedOut(stripItalics(p.getDomainSidePhasedOut()));
}
if (p.getRangeSidePhasedOut() != null) {
p.setRangeSidePhasedOut(stripItalics(p.getRangeSidePhasedOut()));
}
Resource groupRes = (Resource) op.getPropertyValue(PROPERTY_INPROPERTYGROUPANNOT);
if (groupRes != null) {
p.setGroupURI(groupRes.getURI());
@ -524,20 +499,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
getOntModel().remove(p,RDF.type,OWL.InverseFunctionalProperty);
}
}
/* 3/29/2010 sjm. Commenting out per bjl. As far as we can tell from looking at the code, these fields
* are no longer used by the application. Leaving this here commented out for now though,
* just in case.
if (prop.getDomainSidePhasedOut() != null) {
updatePropertyStringValue(p,PROPERTY_FULLPROPERTYNAMEANNOT,prop.getDomainSidePhasedOut(),ontModel);
}
if (prop.getRangeSidePhasedOut() != null && inv != null) {
updatePropertyStringValue(inv,PROPERTY_FULLPROPERTYNAMEANNOT,prop.getRangeSidePhasedOut(),ontModel);
}
*/
if ( (prop.getDomainVClassURI() != null) && (prop.getDomainVClassURI().length()>0) ) {
if (!p.hasDomain(ontModel.getResource(prop.getDomainVClassURI()))) {
p.setDomain(ontModel.getResource(prop.getDomainVClassURI()));
@ -569,26 +531,21 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
updatePropertyStringValue(p,EXAMPLE_ANNOT,prop.getExample(),getOntModel());
updatePropertyStringValue(p,DESCRIPTION_ANNOT,prop.getDescription(),getOntModel());
updatePropertyStringValue(p,PUBLIC_DESCRIPTION_ANNOT,prop.getPublicDescription(),getOntModel());
updatePropertyNonNegativeIntValue(p,DISPLAY_LIMIT,prop.getDomainDisplayLimit(),getOntModel());
updatePropertyNonNegativeIntegerValue(p,DISPLAY_LIMIT,prop.getDomainDisplayLimitInteger(),getOntModel());
updatePropertyStringValue(p,PROPERTY_ENTITYSORTFIELD,prop.getDomainEntitySortField(),getOntModel());
updatePropertyStringValue(p,PROPERTY_ENTITYSORTDIRECTION,prop.getDomainEntitySortDirection(),getOntModel());
if (inv != null) {
updatePropertyStringValue(inv,EXAMPLE_ANNOT,prop.getExample(),getOntModel());
updatePropertyStringValue(inv,DESCRIPTION_ANNOT,prop.getDescription(),getOntModel());
updatePropertyNonNegativeIntValue(inv,DISPLAY_LIMIT,prop.getRangeDisplayLimit(),getOntModel());
updatePropertyNonNegativeIntegerValue(inv,DISPLAY_LIMIT,prop.getRangeDisplayLimitInteger(),getOntModel());
updatePropertyStringValue(inv,PROPERTY_ENTITYSORTFIELD,prop.getRangeEntitySortField(),getOntModel());
updatePropertyStringValue(inv,PROPERTY_ENTITYSORTDIRECTION,prop.getRangeEntitySortDirection(),getOntModel());
}
if (prop.getDomainDisplayTier() != null) {
updatePropertyNonNegativeIntValue(p,DISPLAY_RANK_ANNOT,Integer.decode(prop.getDomainDisplayTier()),getOntModel());
if (inv != null) {
if (prop.getRangeDisplayTier() != null) {
updatePropertyNonNegativeIntValue(inv,DISPLAY_RANK_ANNOT,Integer.decode(prop.getRangeDisplayTier()),getOntModel());
}
}
}
updatePropertyNonNegativeIntegerValue(p, DISPLAY_RANK_ANNOT, prop.getDomainDisplayTierInteger(), getOntModel());
if (inv != null) {
updatePropertyNonNegativeIntegerValue(inv, DISPLAY_RANK_ANNOT, prop.getRangeDisplayTierInteger(), getOntModel());
}
String oldObjectIndividualSortPropertyURI = null;
RDFNode sortPropertyNode = p.getPropertyValue(PROPERTY_OBJECTINDIVIDUALSORTPROPERTY);

View file

@ -14,13 +14,11 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import com.hp.hpl.jena.ontology.AllValuesFromRestriction;
import com.hp.hpl.jena.ontology.ObjectProperty;
import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.ontology.Restriction;
import com.hp.hpl.jena.ontology.SomeValuesFromRestriction;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.ResIterator;
import com.hp.hpl.jena.rdf.model.Resource;
@ -94,11 +92,6 @@ public class PropertyInstanceDaoJena extends JenaBaseDao implements
}
}
public Iterator getAllOfThisTypeIterator() {
// TODO Auto-generated method stub
return null;
}
public Collection<PropertyInstance> getAllPossiblePropInstForIndividual(String individualURI) {
Individual ind = getWebappDaoFactory().getIndividualDao().getIndividualByURI(individualURI);
VClassDao vcDao = getWebappDaoFactory().getVClassDao();

View file

@ -973,8 +973,8 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
updatePropertyStringValue(ontCls,SHORTDEF,cls.getShortDef(),ontModel);
updatePropertyStringValue(ontCls,EXAMPLE_ANNOT,cls.getExample(),ontModel);
updatePropertyStringValue(ontCls,DESCRIPTION_ANNOT,cls.getDescription(),ontModel);
updatePropertyIntValue(ontCls,DISPLAY_LIMIT,cls.getDisplayLimit(),ontModel);
updatePropertyIntValue(ontCls,DISPLAY_RANK_ANNOT,cls.getDisplayRank(),ontModel);
updatePropertyNonNegativeIntValue(ontCls,DISPLAY_LIMIT,cls.getDisplayLimit(),ontModel);
updatePropertyNonNegativeIntValue(ontCls,DISPLAY_RANK_ANNOT,cls.getDisplayRank(),ontModel);
updatePropertyFloatValue(ontCls, SEARCH_BOOST_ANNOT, cls.getSearchBoost(), ontModel);
if (cls.getHiddenFromDisplayBelowRoleLevel() != null) {

View file

@ -1,23 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.listener.impl;
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
import edu.cornell.mannlib.vedit.listener.EditPreProcessor;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
public class KeywordPreProcessor implements EditPreProcessor {
private String stemStr = null;
public KeywordPreProcessor(String stem) {
this.stemStr = stem;
}
public void process(Object o, EditProcessObject epo) {
try {
((Keyword) o).setStem(stemStr);
} catch (ClassCastException e) {}
}
}

View file

@ -1,24 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.listener.impl;
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
import edu.cornell.mannlib.vedit.listener.ChangeListener;
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexBuilder;
public class KeywordSearchReindexer implements ChangeListener {
public void doInserted(Object newObj, EditProcessObject epo){
IndexBuilder builder = (IndexBuilder)epo.getSession().getServletContext().getAttribute(IndexBuilder.class.getName());
builder.doUpdateIndex();
}
public void doUpdated(Object oldObj, Object newObj, EditProcessObject epo){
doInserted(newObj, epo);
}
public void doDeleted(Object oldObj, EditProcessObject epo){
doInserted(null, epo);
}
}

View file

@ -198,7 +198,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
}
for (ObjectProperty op : opList) {
if (op.getURI() != null && op.getURI().equals(pi.getPropertyURI())) {
return op.isSubjectSide() == pi.getSubjectSide();
return true;
}
}
return false;
@ -402,13 +402,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
return dp.getDisplayTier();
} else if (p instanceof ObjectProperty) {
ObjectProperty op = (ObjectProperty) p;
String tierStr = op.getDomainDisplayTier();
try {
return Integer.parseInt(tierStr);
} catch (NumberFormatException ex) {
log.error("Cannot decode object property display tier value "
+ tierStr + " as an integer");
}
return op.getDomainDisplayTier();
} else {
log.error("Property is of unknown class in PropertyRanker()");
}

View file

@ -146,9 +146,8 @@ public abstract class ObjectPropertyTemplateModel extends PropertyTemplateModel
@Override
protected int getPropertyDisplayTier(Property p) {
// For some reason ObjectProperty.getDomainDisplayTier() returns a String
// rather than an int. That should probably be fixed.
return Integer.parseInt(((ObjectProperty)p).getDomainDisplayTier());
Integer displayTier = ((ObjectProperty)p).getDomainDisplayTier();
return (displayTier != null) ? displayTier : -1;
}
@Override

View file

@ -10,7 +10,6 @@ import java.util.Map;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.Keyword;
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;