NIHVIVO-2452 Remove more unused code from former front end vitro namespace property editing

This commit is contained in:
ryounes 2011-04-05 20:34:17 +00:00
parent 3610974111
commit 8c988d8485
2 changed files with 2 additions and 78 deletions

View file

@ -26,85 +26,9 @@ 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<String> 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<String> 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<String, String> VITRO_NS_PROPERTIES = new HashMap<String, String>() {
// {
// 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 = "<a class='externalLink' href='" + linkUrl + "'>" + linkAnchor + "</a>";
}
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) {

View file

@ -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);