From 8c988d8485e822e39e6c670de970e60ffc1e5379 Mon Sep 17 00:00:00 2001 From: ryounes Date: Tue, 5 Apr 2011 20:34:17 +0000 Subject: [PATCH] NIHVIVO-2452 Remove more unused code from former front end vitro namespace property editing --- .../webapp/utils/FrontEndEditingUtils.java | 78 +------------------ .../edit/editDatapropStmtRequestDispatch.jsp | 2 +- 2 files changed, 2 insertions(+), 78 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/FrontEndEditingUtils.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/FrontEndEditingUtils.java index 76e73cf17..31d4eadbb 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/FrontEndEditingUtils.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/utils/FrontEndEditingUtils.java @@ -25,86 +25,10 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.ObjectPropertyDaoJena; public class FrontEndEditingUtils { private static final Log log = LogFactory.getLog(FrontEndEditingUtils.class); - - // NB List includes only those properties currently editable from the front end. - private static final List VITRO_NS_DATA_PROPS = Arrays.asList(VitroVocabulary.BLURB, - VitroVocabulary.CITATION, - VitroVocabulary.DESCRIPTION, - VitroVocabulary.LABEL, - VitroVocabulary.MONIKER - // VitroVocabulary.RDF_TYPE, - // VitroVocabulary.TIMEKEY - ); - - // NB List includes only those properties currently editable from the front end. - private static final List VITRO_NS_OBJECT_PROPS = Arrays.asList(VitroVocabulary.ADDITIONAL_LINK, - VitroVocabulary.PRIMARY_LINK - ); - + public static enum EditMode { ADD, EDIT, REPAIR, ERROR; } - public static String getVitroNsPropDatatypeUri(String propName) { - //Resource datatype = propName == TIMEKEY ? XSD.dateTime : XSD.xstring; - //return datatype.getURI(); - return XSD.xstring.getURI(); - } - -// public static final Map VITRO_NS_PROPERTIES = new HashMap() { -// { -// put(BLURB, XSD.xstring.getURI()); -// put(CITATION, XSD.xstring.getURI()); -// put(DESCRIPTION, XSD.xstring.getURI()); -// put(LABEL, XSD.xstring.getURI()); -// put(LINK_ANCHOR, XSD.xstring.getURI()); -// put(MONIKER, XSD.xstring.getURI()); -// put(PRIMARY_LINK, XSD.xstring.getURI()); -// put(RDF_TYPE, XSD.xstring.getURI()); -// put(TIMEKEY, XSD.dateTime.getURI()); -// } -//}; - - public static boolean isVitroNsDataProp(String propertyUri) { - return VITRO_NS_DATA_PROPS.contains(propertyUri); - } - - public static boolean isVitroNsObjProp(String propertyUri) { - return VITRO_NS_OBJECT_PROPS.contains(propertyUri); - } - - public static String getVitroNsObjDisplayName(String predicateUri, Individual object, Model model) { - - String displayName = null; - - // These are the only Vitro namespace object properties that are editable on the front end at this point. - if ( predicateUri.equals(VitroVocabulary.PRIMARY_LINK) || predicateUri.equals(VitroVocabulary.ADDITIONAL_LINK) ) { - String linkAnchor = getLiteralValue(model, object, VitroVocabulary.LINK_ANCHOR); - String linkUrl = getLiteralValue(model, object, VitroVocabulary.LINK_URL); - displayName = "" + linkAnchor + ""; - } - - return displayName; - - } - - private static String getLiteralValue(Model model, Individual ind, String predicateUri) { - - String value = null; - StmtIterator stmts = model.listStatements(model.createResource(ind.getURI()), - model.getProperty(predicateUri), - (RDFNode)null); - while (stmts.hasNext()) { - Statement stmt = stmts.nextStatement(); - RDFNode node = stmt.getObject(); - if (node.isLiteral()) { - Literal lit = (Literal) node.as(Literal.class); - value = lit.getLexicalForm(); - } - } - - return value; - - } /* Determine whether a property editing form is in add, edit, or repair mode. */ public static EditMode getEditMode(HttpServletRequest request, String relatedPropertyUri) { diff --git a/webapp/web/edit/editDatapropStmtRequestDispatch.jsp b/webapp/web/edit/editDatapropStmtRequestDispatch.jsp index 1d40010d5..818e3ea02 100644 --- a/webapp/web/edit/editDatapropStmtRequestDispatch.jsp +++ b/webapp/web/edit/editDatapropStmtRequestDispatch.jsp @@ -84,7 +84,7 @@ DataProperty dataproperty = wdf.getDataPropertyDao().getDataPropertyByURI( predicateUri ); if( dataproperty == null) { // No dataproperty will be returned for rdfs:label, but we shouldn't throw an error. - // RY ** Consider instead getting rdfs:label included in what's returned + // This is controlled by the Jena layer, so we can't change the behavior. if (! predicateUri.equals(VitroVocabulary.LABEL)) { log.error("Could not find data property '"+predicateUri+"' in model"); throw new Error("editDatapropStmtRequest.jsp: Could not find DataProperty in model: " + predicateUri);