updates for edit submission preprocessor, passing vreq

This commit is contained in:
hudajkhan 2013-09-24 14:58:50 -04:00
parent 91fd8a4c1b
commit b6b96d12a7
5 changed files with 11 additions and 11 deletions

View file

@ -358,16 +358,14 @@ public class AddAssociatedConceptGenerator extends VivoBaseGenerator implements
//Add preprocessor
private void addPreprocessors(EditConfigurationVTwo editConfiguration,
OntModel ontModel,
WebappDaoFactory wdf) {
private void addPreprocessors(EditConfigurationVTwo editConfiguration) {
//An Edit submission preprocessor for enabling addition of multiple terms for a single search
//TODO: Check if this is the appropriate way of getting model
//Passing model to check for any URIs that are present
editConfiguration.addEditSubmissionPreprocessor(
new AddAssociatedConceptsPreprocessor(editConfiguration, ontModel, wdf));
new AddAssociatedConceptsPreprocessor(editConfiguration));
editConfiguration.addModelChangePreprocessor(new ConceptSemanticTypesPreprocessor());
}

View file

@ -34,6 +34,7 @@ import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.BaseEditSubmissionPreprocessorVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
@ -78,17 +79,18 @@ public class AddAssociatedConceptsPreprocessor extends
// Will be editing the edit configuration as well as edit submission here
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig, OntModel ontModel, WebappDaoFactory wadf) {
public AddAssociatedConceptsPreprocessor(EditConfigurationVTwo editConfig) {
super(editConfig);
this.ontModel = ontModel;
this.wdf = wadf;
this.labelVarToUriVarHash = new HashMap<String, String>();
//Saves values of concept type uris
this.conceptSemanticTypeURIVarToValueMap = new HashMap<String, List<String>>();
}
public void preprocess(MultiValueEditSubmission inputSubmission) {
public void preprocess(MultiValueEditSubmission inputSubmission, VitroRequest vreq) {
submission = inputSubmission;
this.wdf = vreq.getWebappDaoFactory();
this.ontModel = ModelAccess.on(vreq).getJenaOntModel();
//Set the models that we need here
// Get the input elements for concept node and concept label as well
// as vocab uri (which is based on thge
// For query parameters, check whether CUI

View file

@ -50,7 +50,7 @@ public class ConceptSemanticTypesPreprocessor implements ModelChangePreprocessor
@Override
public void preprocess(Model retractionsModel, Model additionsModel,
HttpServletRequest request) {
VitroRequest vreq = new VitroRequest(vreq);
VitroRequest vreq = new VitroRequest(request);
//Run a construct query against the additions model
String prefixes = "PREFIX rdfs:<" + RDFS.getURI() + "> " +
"PREFIX owl:<http://www.w3.org/2002/07/owl#> " +

View file

@ -50,7 +50,7 @@ public class RoleToActivityPredicatePreprocessor extends RoleToPredicatePreproce
this.itemToRolePredicate = "activityToRolePredicate";
}
protected String getItemType(MultiValueEditSubmission submission) {
protected String getItemType(MultiValueEditSubmission submission, VitroRequest vreq) {
String type = null;
Map<String, List<String>> urisFromForm = submission.getUrisFromForm();
//Get the type of the activity selected

View file

@ -56,7 +56,7 @@ public abstract class RoleToPredicatePreprocessor extends BaseEditSubmissionPrep
//Instantiate itemType etc. based on which version of preprocessor required
abstract protected void setupVariableNames();
public void preprocess(MultiValueEditSubmission submission) {
public void preprocess(MultiValueEditSubmission submission, VitroRequest vreq) {
//Query for all statements using the original roleIn predicate replace
//with the appropriate roleRealizedIn or roleContributesTo
//In addition, need to ensure the inverse predicate is also set correctly