Merge r5959 from nihvivo-rel-1.1-maint

This commit is contained in:
rjy7 2010-09-28 15:13:34 +00:00
parent 22cec61b5e
commit 0fea772da9

View file

@ -120,22 +120,9 @@ public class PropertyEditLinks extends TagSupport{
contextPath = "/" + contextPath; contextPath = "/" + contextPath;
if( item instanceof ObjectPropertyStatement ){ if( item instanceof ObjectPropertyStatement ){
ObjectPropertyStatement prop = (ObjectPropertyStatement)item; ObjectPropertyStatement ops = (ObjectPropertyStatement)item;
ops = getObjectPropertyStatementForCustomLinks(ops);
// rjy7 Another ugly hack to support collation of authorships by publication subclasses links = doObjPropStmt( ops, policyToAccess(ids, policy, ops), contextPath );
// (NIHVIVO-1158). To display authorships this way, we've replaced the person-to-authorship
// statements with authorship-to-publication statements. Now we have to hack the edit links
// to edit the authorInAuthorship property statement rather than the linkedInformationResource
// statement.
String propertyUri = prop.getPropertyURI();
if (propertyUri.equals("http://vivoweb.org/ontology/core#linkedInformationResource")) {
String objectUri = prop.getSubjectURI();
String predicateUri = "http://vivoweb.org/ontology/core#authorInAuthorship";
String subjectUri = ((Individual)pageContext.getRequest().getAttribute("entity")).getURI();
prop = new ObjectPropertyStatementImpl(subjectUri, predicateUri, objectUri);
}
links = doObjPropStmt( prop, policyToAccess(ids, policy, prop), contextPath );
} else if( item instanceof DataPropertyStatement ){ } else if( item instanceof DataPropertyStatement ){
DataPropertyStatement prop = (DataPropertyStatement)item; DataPropertyStatement prop = (DataPropertyStatement)item;
@ -208,6 +195,22 @@ public class PropertyEditLinks extends TagSupport{
return SKIP_BODY; return SKIP_BODY;
} }
private ObjectPropertyStatement getObjectPropertyStatementForCustomLinks(ObjectPropertyStatement ops) {
// rjy7 Another ugly hack to support collation of authorships by publication subclasses
// (NIHVIVO-1158). To display authorships this way, we've replaced the person-to-authorship
// statements with authorship-to-publication statements. Now we have to hack the edit links
// to edit the authorInAuthorship property statement rather than the linkedInformationResource
// statement.
String propertyUri = ops.getPropertyURI();
if (propertyUri.equals("http://vivoweb.org/ontology/core#linkedInformationResource")) {
String objectUri = ops.getSubjectURI();
String predicateUri = "http://vivoweb.org/ontology/core#authorInAuthorship";
String subjectUri = ((Individual)pageContext.getRequest().getAttribute("entity")).getURI();
ops = new ObjectPropertyStatementImpl(subjectUri, predicateUri, objectUri);
}
return ops;
}
protected LinkStruct[] doDataProp(DataProperty dprop, Individual entity, EditLinkAccess[] allowedAccessTypeArray, String contextPath) { protected LinkStruct[] doDataProp(DataProperty dprop, Individual entity, EditLinkAccess[] allowedAccessTypeArray, String contextPath) {
if( allowedAccessTypeArray == null || dprop == null || allowedAccessTypeArray.length == 0 ) { if( allowedAccessTypeArray == null || dprop == null || allowedAccessTypeArray.length == 0 ) {
log.debug("null or empty access type array in doDataProp for dprop "+dprop.getPublicName()+"; most likely just a property prohibited from editing"); log.debug("null or empty access type array in doDataProp for dprop "+dprop.getPublicName()+"; most likely just a property prohibited from editing");