diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyEditController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyEditController.java new file mode 100644 index 000000000..73559b00a --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyEditController.java @@ -0,0 +1,12 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller.edit; + +import edu.cornell.mannlib.vedit.controller.BaseEditController; + +/** + * TODO + */ +public class FauxPropertyEditController extends BaseEditController { + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java new file mode 100644 index 000000000..57d771a50 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/FauxPropertyRetryController.java @@ -0,0 +1,31 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.controller.edit; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import edu.cornell.mannlib.vedit.controller.BaseEditController; +import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission; + +/** + * TODO + */ +public class FauxPropertyRetryController extends BaseEditController { + @Override + public void doPost(HttpServletRequest req, HttpServletResponse response) { + if (!isAuthorizedToDisplayPage(req, response, + SimplePermission.EDIT_ONTOLOGY.ACTION)) { + return; + } + + // TODO + } + + @Override + public void doGet (HttpServletRequest request, HttpServletResponse response) { + doPost(request, response); + } + + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/FauxPropertyDao.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/FauxPropertyDao.java new file mode 100644 index 000000000..68b1a0afd --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/FauxPropertyDao.java @@ -0,0 +1,10 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.dao; + +/** + * TODO + */ +public interface FauxPropertyDao { + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java index 5cfa5d278..37ad01170 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactory.java @@ -91,6 +91,11 @@ public interface WebappDaoFactory { * returns a Data Access Object for working with ontology class objects */ public VClassDao getVClassDao(); + + /** + * returns a Data Access Object for working with "faux" ObjectProperties. + */ + public FauxPropertyDao getFauxPropertyDao(); /* ==================== DAOs for ABox manipulation ===================== */ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/FauxPropertyDaoFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/FauxPropertyDaoFiltering.java new file mode 100644 index 000000000..ec9c9299b --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/FauxPropertyDaoFiltering.java @@ -0,0 +1,218 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.dao.filtering; + +import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao; +import edu.cornell.mannlib.vitro.webapp.dao.filtering.filters.VitroFilters; + +class FauxPropertyDaoFiltering extends BaseFiltering implements FauxPropertyDao{ + final FauxPropertyDao innerFauxPropertyDao; + final VitroFilters filters; + + public FauxPropertyDaoFiltering(FauxPropertyDao fauxPropertyDao, + VitroFilters filters) { + super(); + this.innerFauxPropertyDao = fauxPropertyDao; + this.filters = filters; + } + +// /* filtered methods */ +// public List getAllObjectProperties() { +// return filterAndWrap(innerFauxPropertyDao.getAllObjectProperties(), filters); +// } +// +// public List getObjectPropertiesForFauxPropertyStatements(List fauxPropertyStatements) { +// //assume that the objPropStmts are already filtered +// List list = +// innerFauxPropertyDao +// .getObjectPropertiesForFauxPropertyStatements(fauxPropertyStatements); +// return filterAndWrap(list, filters); +// } +// +// +// public FauxProperty getFauxPropertyByURI(String fauxPropertyURI) { +// FauxProperty newOprop=innerFauxPropertyDao.getFauxPropertyByURI(fauxPropertyURI); +// return (newOprop == null) ? null : new FauxPropertyFiltering(newOprop, filters); +// } +// +// public FauxProperty getFauxPropertyByURIs(String fauxPropertyURI, String domainURI, String rangeURI) { +// FauxProperty newOprop=innerFauxPropertyDao.getFauxPropertyByURIs(fauxPropertyURI, domainURI, rangeURI); +// return (newOprop == null) ? null : new FauxPropertyFiltering(newOprop, filters); +// } +// +// public FauxProperty getFauxPropertyByURIs(String fauxPropertyURI, String domainURI, String rangeURI, FauxProperty base) { +// FauxProperty newOprop=innerFauxPropertyDao.getFauxPropertyByURIs(fauxPropertyURI, domainURI, rangeURI, base); +// return (newOprop == null) ? null : new FauxPropertyFiltering(newOprop, filters); +// } +// +// public List getStatementsUsingFauxProperty(FauxProperty op) { +// return FauxPropertyStatementDaoFiltering.filterAndWrapList(innerFauxPropertyDao.getStatementsUsingFauxProperty(op),filters); +// } +// +// public List getRootObjectProperties() { +// return filterAndWrap(innerFauxPropertyDao.getRootObjectProperties(),filters); +// } +// +// +// /* other methods */ +// public void deleteFauxProperty(String fauxPropertyURI) { +// innerFauxPropertyDao.deleteFauxProperty(fauxPropertyURI); +// } +// +// +// public void deleteFauxProperty(FauxProperty fauxProperty) { +// innerFauxPropertyDao.deleteFauxProperty(fauxProperty); +// } +// +// +// public void fillObjectPropertiesForIndividual(Individual individual) { +// innerFauxPropertyDao.fillObjectPropertiesForIndividual(individual); +// } +// +// public int insertFauxProperty(FauxProperty fauxProperty) throws InsertException { +// return innerFauxPropertyDao.insertFauxProperty(fauxProperty); +// } +// +// public void updateFauxProperty(FauxProperty fauxProperty) { +// innerFauxPropertyDao.updateFauxProperty(fauxProperty); +// } +// +// public void addSuperproperty(FauxProperty property, FauxProperty superproperty) { +// innerFauxPropertyDao.addSuperproperty(property, superproperty); +// } +// +// public void addSuperproperty(String propertyURI, String superpropertyURI) { +// innerFauxPropertyDao.addSuperproperty(propertyURI, superpropertyURI); +// } +// +// public void removeSuperproperty(FauxProperty property, FauxProperty superproperty) { +// innerFauxPropertyDao.removeSuperproperty(property, superproperty); +// } +// +// public void removeSuperproperty(String propertyURI, String superpropertyURI) { +// innerFauxPropertyDao.removeSuperproperty(propertyURI, superpropertyURI); +// } +// +// public void addSubproperty(FauxProperty property, FauxProperty subproperty) { +// innerFauxPropertyDao.addSubproperty(property, subproperty); +// } +// +// public void addSubproperty(String propertyURI, String subpropertyURI) { +// innerFauxPropertyDao.addSubproperty(propertyURI, subpropertyURI); +// } +// +// public void removeSubproperty(FauxProperty property, FauxProperty subproperty) { +// innerFauxPropertyDao.removeSubproperty(property, subproperty); +// } +// +// public void removeSubproperty(String propertyURI, String subpropertyURI) { +// innerFauxPropertyDao.removeSubproperty(propertyURI, subpropertyURI); +// } +// +// public List getSubPropertyURIs(String propertyURI) { +// return innerFauxPropertyDao.getSubPropertyURIs(propertyURI); +// } +// +// public List getAllSubPropertyURIs(String propertyURI) { +// return innerFauxPropertyDao.getAllSubPropertyURIs(propertyURI); +// } +// +// public List getSuperPropertyURIs(String propertyURI, boolean direct) { +// return innerFauxPropertyDao.getSuperPropertyURIs(propertyURI, direct); +// } +// +// public List getAllSuperPropertyURIs(String propertyURI) { +// return innerFauxPropertyDao.getAllSuperPropertyURIs(propertyURI); +// } +// +// public static List filterAndWrap(List list, VitroFilters filters){ +// if( list == null ) return null; +// if( list.size() ==0 ) return list; +// +// List filtered = new LinkedList(); +// Filter.filter(list, +// new AndUnary(notNull,filters.getFauxPropertyFilter()), +// filtered); +// +// List wrapped = new LinkedList(); +// for( FauxProperty prop : filtered){ +// if( prop != null){ +// wrapped.add( new FauxPropertyFiltering(prop, filters)); +// } +// } +// return wrapped; +// } +// +// private static final UnaryFunctor notNull = +// new UnaryFunctor(){ +// @Override +// public Boolean fn(FauxProperty arg) { +// return arg != null; +// } +// }; +// +// public void addSubproperty(Property property, Property subproperty) { +// innerFauxPropertyDao.addSubproperty(property, subproperty); +// } +// +// public void addSuperproperty(Property property, Property superproperty) { +// innerFauxPropertyDao.addSuperproperty(property, superproperty); +// } +// +// public void removeSubproperty(Property property, Property subproperty) { +// innerFauxPropertyDao.removeSubproperty(property, subproperty); +// } +// +// public void removeSuperproperty(Property property, Property superproperty) { +// innerFauxPropertyDao.removeSuperproperty(property, superproperty); +// } +// +// public void addEquivalentProperty(String propertyURI, +// String equivalentPropertyURI) { +// innerFauxPropertyDao.addEquivalentProperty(propertyURI, equivalentPropertyURI); +// } +// +// public void addEquivalentProperty(Property property, +// Property equivalentProperty) { +// innerFauxPropertyDao.addEquivalentProperty(property, equivalentProperty); +// } +// +// public List getEquivalentPropertyURIs(String propertyURI) { +// return innerFauxPropertyDao.getEquivalentPropertyURIs(propertyURI); +// } +// +// public void removeEquivalentProperty(String propertyURI, +// String equivalentPropertyURI) { +// innerFauxPropertyDao.removeEquivalentProperty(propertyURI, equivalentPropertyURI); +// } +// +// public void removeEquivalentProperty(Property property, +// Property equivalentProperty) { +// innerFauxPropertyDao.removeEquivalentProperty(property, equivalentProperty); +// } +// +// public boolean skipEditForm(String predicateURI) { +// return innerFauxPropertyDao.skipEditForm(predicateURI); +// } +// +// public List getClassesWithRestrictionOnProperty(String propertyURI) { +// return innerFauxPropertyDao.getClassesWithRestrictionOnProperty(propertyURI); +// } +// +// @Override +// // This may need to be filtered at some point. +// public List getFauxPropertyList(Individual subject) { +// return innerFauxPropertyDao.getFauxPropertyList(subject); +// } +// +// @Override +// // This may need to be filtered at some point. +// public List getFauxPropertyList(String subjectUri) { +// return innerFauxPropertyDao.getFauxPropertyList(subjectUri); +// } +// +// @Override +// public String getCustomListViewConfigFileName(FauxProperty fauxProperty) { +// return innerFauxPropertyDao.getCustomListViewConfigFileName(fauxProperty); +// } +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java index b362daca8..82e7a7d1c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/filtering/WebappDaoFactoryFiltering.java @@ -10,6 +10,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao; import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao; +import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.MenuDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; @@ -57,6 +58,7 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory { transient private DataPropertyStatementDao filteringDataPropertyStatementDao=null; transient private IndividualDao filteringIndividualDao=null; transient private ObjectPropertyDao filteringObjectPropertyDao=null; + transient private FauxPropertyDao filteringFauxPropertyDao=null; transient private ObjectPropertyStatementDao filteringObjectPropertyStatementDao=null; transient private VClassDao filteringVClassDao=null; @@ -232,6 +234,14 @@ public class WebappDaoFactoryFiltering implements WebappDaoFactory { return filteringObjectPropertyDao; } + public FauxPropertyDao getFauxPropertyDao() { + if (filteringFauxPropertyDao == null ){ + filteringFauxPropertyDao = new FauxPropertyDaoFiltering(innerWebappDaoFactory.getFauxPropertyDao(), + filters); + } + return filteringFauxPropertyDao; + } + public VClassDao getVClassDao() { if (filteringVClassDao == null ){ diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/FauxPropertyDaoJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/FauxPropertyDaoJena.java new file mode 100644 index 000000000..3bfcddfe0 --- /dev/null +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/FauxPropertyDaoJena.java @@ -0,0 +1,33 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.dao.jena; + +import java.util.Map; + +import org.apache.jena.atlas.lib.Pair; + +import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; +import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao; +import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService; + +/** + * TODO + */ +public class FauxPropertyDaoJena implements FauxPropertyDao { + + /** + * @param rdfService + * @param dwf + * @param customListViewConfigFileMap + * @param webappDaoFactoryJena + */ + public FauxPropertyDaoJena( + RDFService rdfService, + DatasetWrapperFactory dwf, + Map>, String> customListViewConfigFileMap, + WebappDaoFactoryJena webappDaoFactoryJena) { + // TODO Auto-generated constructor stub + throw new RuntimeException("FauxPropertyDaoJena Constructor not implemented."); + } + +} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java index a74cada20..cc3e12677 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/jena/WebappDaoFactoryJena.java @@ -33,6 +33,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao; import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao; +import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.MenuDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; @@ -375,6 +376,15 @@ public class WebappDaoFactoryJena implements WebappDaoFactory { return objectPropertyDao; } + private FauxPropertyDao fauxPropertyDao = null; + @Override + public FauxPropertyDao getFauxPropertyDao() { + if( fauxPropertyDao == null ) + fauxPropertyDao = new FauxPropertyDaoJena( + rdfService, dwf, config.customListViewConfigFileMap, this); + return fauxPropertyDao; + } + private PropertyInstanceDao propertyInstanceDao = null; @Override public PropertyInstanceDao getPropertyInstanceDao() { diff --git a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java index 809aba701..a5ecbac35 100644 --- a/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java +++ b/webapp/test/stubs/edu/cornell/mannlib/vitro/webapp/dao/WebappDaoFactoryStub.java @@ -3,7 +3,6 @@ package stubs.edu.cornell.mannlib.vitro.webapp.dao; import java.util.List; -import java.util.Map; import java.util.Set; import edu.cornell.mannlib.vitro.webapp.dao.ApplicationDao; @@ -11,6 +10,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao; import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao; import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao; +import edu.cornell.mannlib.vitro.webapp.dao.FauxPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.MenuDao; import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao; @@ -42,6 +42,7 @@ public class WebappDaoFactoryStub implements WebappDaoFactory { private MenuDao menuDao; private ObjectPropertyDao objectPropertyDao; private ObjectPropertyStatementDao objectPropertyStatementDao; + private FauxPropertyDao fauxPropertyDao; private OntologyDao ontologyDao; private UserAccountsDao userAccountsDao; private VClassDao vClassDao; @@ -74,6 +75,10 @@ public class WebappDaoFactoryStub implements WebappDaoFactory { this.objectPropertyStatementDao = objectPropertyStatementDao; } + public void setFauxPropertyDao(FauxPropertyDao fauxPropertyDao) { + this.fauxPropertyDao = fauxPropertyDao; + } + public void setOntologyDao(OntologyDao ontologyDao) { this.ontologyDao = ontologyDao; } @@ -120,9 +125,15 @@ public class WebappDaoFactoryStub implements WebappDaoFactory { return this.objectPropertyDao; } + @Override + public FauxPropertyDao getFauxPropertyDao() { + return this.fauxPropertyDao; + } + @Override public ObjectPropertyStatementDao getObjectPropertyStatementDao() { -return this.objectPropertyStatementDao; } + return this.objectPropertyStatementDao; + } @Override public OntologyDao getOntologyDao() {