VIVO-897 Fix broken display of faux properties.

Unpopulated faux properties don't display, except to root.
Populated faux properties are not editable, except by root.
GroupedPropertyList was calling vreq.getLanguageNeutralWebappDaoFactory() but expecting it to be policyNeutral as well.
This commit is contained in:
Jim Blake 2014-10-29 11:32:47 -04:00
parent 3b4e2bc012
commit 7069cf8079
6 changed files with 35 additions and 12 deletions

View file

@ -19,6 +19,7 @@ public class DisplayObjectProperty extends RequestedAction {
@Override
public String toString() {
return "DisplayObjectProperty[" + objectProperty.getLocalName() + "]";
return "DisplayObjectProperty[" + objectProperty + "]";
}
}

View file

@ -7,6 +7,8 @@ import java.util.Comparator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
public class Property extends BaseResourceBean implements ResourceBean {
private static Log log = LogFactory.getLog( Property.class );
@ -99,6 +101,23 @@ public class Property extends BaseResourceBean implements ResourceBean {
this.deleteLinkSuppressed = deleteLinkSuppressed;
}
@Override
public String toString() {
return this.getClass().getSimpleName() + "["
+ localNameFor(getURI())
+ ", domain=" + localNameFor(getDomainVClassURI())
+ ", range=" + localNameFor(getRangeVClassURI())
+ "]";
}
private String localNameFor(String uri) {
try {
return ResourceFactory.createResource(uri).getLocalName();
} catch (Exception e) {
return uri;
}
}
/**
* Sorts Property objects, by property rank, then alphanumeric.
* @author bdc34

View file

@ -11,7 +11,6 @@ import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.CONTENT;
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.LANGUAGE_NEUTRAL;
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.POLICY_NEUTRAL;
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames.DISPLAY;
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames.FULL_ASSERTIONS;
import java.text.Collator;
import java.util.Collections;
@ -105,10 +104,6 @@ public class VitroRequest extends HttpServletRequestWrapper {
return ModelAccess.on(this).getOntModel(ModelNames.FULL_UNION);
}
public OntModel getAssertionsOntModel() {
return ModelAccess.on(this).getOntModel(FULL_ASSERTIONS);
}
public OntModel getDisplayModel(){
return ModelAccess.on(this).getOntModel(DISPLAY);
}
@ -198,7 +193,10 @@ public class VitroRequest extends HttpServletRequestWrapper {
}
public WebappDaoFactory getLanguageNeutralWebappDaoFactory() {
return edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.on(this).getWebappDaoFactory(LANGUAGE_NEUTRAL);
// It is also policy neutral, because that's how it was originally
// implemented, and at least some of the client code expects it that
// way.
return ModelAccess.on(this).getWebappDaoFactory(LANGUAGE_NEUTRAL, POLICY_NEUTRAL);
}
// ----------------------------------------------------------------------

View file

@ -2,6 +2,8 @@
package edu.cornell.mannlib.vitro.webapp.controller.individual;
import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames.FULL_ASSERTIONS;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -35,6 +37,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RdfResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess;
import edu.cornell.mannlib.vitro.webapp.utils.jena.ExtendedLinkedDataUtils;
import edu.cornell.mannlib.vitro.webapp.utils.jena.JenaOutputUtils;
import edu.cornell.mannlib.vitro.webapp.web.ContentType;
@ -126,7 +129,8 @@ public class ExtendedRdfAssembler {
}
newModel = getLabelAndTypes(entity, contextModel, newModel );
newModel = getStatementsWithUntypedProperties(subj, contextModel, vreq.getAssertionsOntModel(), newModel);
newModel = getStatementsWithUntypedProperties(subj, contextModel,
ModelAccess.on(vreq).getOntModel(FULL_ASSERTIONS), newModel);
//bdc34: The following code adds all triples where entity is the Subject.
// contextModel.enterCriticalSection(Lock.READ);

View file

@ -72,10 +72,12 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory {
this.innerWebappDaoFactory = innerDao;
}
@Override
@Override
public String toString() {
return "WebappDaoFactoryFiltering[inner=" + innerWebappDaoFactory + "]";
return "WebappDaoFactoryFiltering[inner=" + innerWebappDaoFactory
+ ", filters=" + filters + "]";
}
/* ******************* filtering *********************** */

View file

@ -91,8 +91,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
if (log.isDebugEnabled()) {
for (ObjectProperty t : additions) {
log.debug(t.getDomainPublic() + " " + t.getGroupURI() + " domain " +
t.getDomainVClassURI());
log.debug("addition: " + t);
}
log.debug("Added " + additions.size() +
" properties due to application configuration ontology");