Adding some chagnes to ProcessRdfForm.java

This commit is contained in:
briancaruso 2011-04-11 17:23:50 +00:00
parent 543c1cd945
commit 15f6bbce5c

View file

@ -31,7 +31,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.TemplateProcessingHelper.TemplateProcessingException;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ForwardResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.InsertException; import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
@ -49,6 +48,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.ModelChangePreprocessor;
* This servlet will process EditConfigurations with query parameters * This servlet will process EditConfigurations with query parameters
* to perform an edit. * to perform an edit.
* *
* TODO: rename this class ProcessN3Edit
*/ */
public class ProcessRdfForm extends FreemarkerHttpServlet{ public class ProcessRdfForm extends FreemarkerHttpServlet{
@ -114,6 +114,7 @@ public class ProcessRdfForm extends FreemarkerHttpServlet{
/** /**
* Execute any modelChangePreprocessors in the editConfiguration; * Execute any modelChangePreprocessors in the editConfiguration;
* Move to EditN3Utils
*/ */
protected void preprocessModels(AdditionsAndRetractions changes, EditConfiguration editConfiguration, VitroRequest request){ protected void preprocessModels(AdditionsAndRetractions changes, EditConfiguration editConfiguration, VitroRequest request){
@ -126,6 +127,7 @@ public class ProcessRdfForm extends FreemarkerHttpServlet{
} }
} }
//Move to EditN3Utils
protected AdditionsAndRetractions getMinimalChanges( AdditionsAndRetractions changes ){ protected AdditionsAndRetractions getMinimalChanges( AdditionsAndRetractions changes ){
//make a model with all the assertions and a model with all the //make a model with all the assertions and a model with all the
//retractions, do a diff on those and then only add those to the jenaOntModel //retractions, do a diff on those and then only add those to the jenaOntModel
@ -149,6 +151,7 @@ public class ProcessRdfForm extends FreemarkerHttpServlet{
return changes; return changes;
} }
protected void applyChangesToWriteModel(AdditionsAndRetractions changes, OntModel queryModel, OntModel writeModel, String editorUri) { protected void applyChangesToWriteModel(AdditionsAndRetractions changes, OntModel queryModel, OntModel writeModel, String editorUri) {
//side effect: modify the write model with the changes //side effect: modify the write model with the changes
Lock lock = null; Lock lock = null;
@ -167,10 +170,8 @@ public class ProcessRdfForm extends FreemarkerHttpServlet{
} }
private EditConfiguration getEditConfiguration(HttpServletRequest request) { private EditConfiguration getEditConfiguration(HttpServletRequest request) {
HttpSession session = request.getSession(); HttpSession session = request.getSession();
EditConfiguration editConfiguration = EditConfiguration.getConfigFromSession(session, request); EditConfiguration editConfiguration = EditConfiguration.getConfigFromSession(session, request);
return editConfiguration; return editConfiguration;
} }
@ -365,8 +366,7 @@ public class ProcessRdfForm extends FreemarkerHttpServlet{
requestDispatcher.forward(vreq, response); requestDispatcher.forward(vreq, response);
} }
//Move to EditN3Utils but keep make new uris here
public static class Utilities { public static class Utilities {
private static Log log = LogFactory.getLog(ProcessRdfForm.class); private static Log log = LogFactory.getLog(ProcessRdfForm.class);
@ -485,6 +485,8 @@ public class ProcessRdfForm extends FreemarkerHttpServlet{
/** /**
* This is a data structure to allow a method to return * This is a data structure to allow a method to return
* a pair of Model objects for additions and retractions. * a pair of Model objects for additions and retractions.
*
* Move this to its own class
*/ */
protected class AdditionsAndRetractions { protected class AdditionsAndRetractions {
Model additions; Model additions;