Changes for NHVIVO-3086, NIHVIVO-2980 and its subtasks: restructuring page data getters and extracting any internal class data getter or setup code from VITRO.
This commit is contained in:
parent
d1c0bbad51
commit
4d212a4aec
20 changed files with 676 additions and 736 deletions
|
@ -362,15 +362,6 @@
|
|||
<url-pattern>/processEditDisplayModel</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>InstitutionalInternalClassController</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.InstitutionalInternalClassController</servlet-class>
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>InstitutionalInternalClassController</servlet-name>
|
||||
<url-pattern>/processInstitutionalInternalClass</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>ajaxSparqlQuery</servlet-name>
|
||||
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.ajax.SparqlQueryAjaxController</servlet-class>
|
||||
|
|
|
@ -26,4 +26,10 @@ display:Home
|
|||
a display:HomePage ;
|
||||
a display:Page ;
|
||||
display:title "Home" ;
|
||||
display:urlMapping "/" .
|
||||
display:urlMapping "/" ;
|
||||
display:hasDataGetter display:homeDataGetter .
|
||||
|
||||
########## Data Getter ############
|
||||
|
||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#homeDataGetter>
|
||||
a <java:edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.BrowseDataGetter> .
|
|
@ -99,7 +99,8 @@ owl:versionInfo
|
|||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasMenuText>
|
||||
a owl:DatatypeProperty .
|
||||
|
||||
|
||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#usesDataGetterClass>
|
||||
a owl:DatatypeProperty .
|
||||
|
||||
|
||||
######### Object Properties#########
|
||||
|
@ -171,3 +172,5 @@ owl:topObjectProperty
|
|||
|
||||
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#restrictResultsByClass>
|
||||
a owl:ObjectProperty .
|
||||
|
||||
|
||||
|
|
|
@ -2,32 +2,21 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
|
@ -38,21 +27,10 @@ import com.hp.hpl.jena.shared.Lock;
|
|||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
|
||||
import edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.Field;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Generator;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditN3Utils;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.processEdit.EditSubmission;
|
||||
import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServletRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.MailUtil;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.SelectDataGetterUtils;
|
||||
|
||||
/**
|
||||
*Process edits from display model editing, so form should submit to this page which should
|
||||
|
@ -349,64 +327,13 @@ public class MenuManagementEdit extends VitroHttpServlet {
|
|||
dataGetterResource,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.FOR_CLASSGROUP),
|
||||
classGroupResource));
|
||||
//If "All selected" then use class group else use individuals for classes
|
||||
Model dataGetterModel = ModelFactory.createDefaultModel();
|
||||
if(!internalClassSelected(vreq) && allClassesSelected(vreq)) {
|
||||
dataGetterModel = getClassGroupDataGetter(vreq, dataGetterResource, addModel, displayModel);
|
||||
} else {
|
||||
dataGetterModel = getIndividualsForClassesDataGetter(vreq, dataGetterResource, addModel, displayModel, pageResource);
|
||||
}
|
||||
|
||||
//Get the model corresponding to the data getter to be employed and return
|
||||
Model dataGetterModel = SelectDataGetterUtils.createDataGetterModel(vreq, dataGetterResource);
|
||||
addModel.add(dataGetterModel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean allClassesSelected(VitroRequest vreq) {
|
||||
String allClasses = vreq.getParameter("allSelected");
|
||||
return (allClasses != null && !allClasses.isEmpty());
|
||||
}
|
||||
|
||||
private boolean internalClassSelected(VitroRequest vreq) {
|
||||
String internalClass = vreq.getParameter("display-internalClass");
|
||||
return (internalClass != null && !internalClass.isEmpty());
|
||||
}
|
||||
|
||||
private Model getIndividualsForClassesDataGetter(VitroRequest vreq, Resource dataGetterResource,
|
||||
Model addModel, OntModel displayModel, Resource pageResource) {
|
||||
String[] selectedClasses = vreq.getParameterValues("classInClassGroup");
|
||||
Model dgModel = ModelFactory.createDefaultModel();
|
||||
dgModel.add(dgModel.createStatement(dataGetterResource,
|
||||
RDF.type,
|
||||
ResourceFactory.createResource(DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE)));
|
||||
for(String classUri: selectedClasses) {
|
||||
dgModel.add(dgModel.createStatement(
|
||||
dataGetterResource,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS),
|
||||
ResourceFactory.createResource(classUri)));
|
||||
}
|
||||
|
||||
//Also check if internal class checked
|
||||
if(internalClassSelected(vreq)) {
|
||||
String internalClass = vreq.getParameter("display-internalClass");
|
||||
//The value should be the internal class uri
|
||||
dgModel.add(dgModel.createStatement(
|
||||
dataGetterResource,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL),
|
||||
dgModel.createLiteral("true")));
|
||||
}
|
||||
return dgModel;
|
||||
}
|
||||
|
||||
private Model getClassGroupDataGetter(VitroRequest vreq, Resource dataGetterResource, Model addModel,
|
||||
OntModel displayModel) {
|
||||
Model dgModel = ModelFactory.createDefaultModel();
|
||||
dgModel.add(dgModel.createStatement(dataGetterResource,
|
||||
RDF.type,
|
||||
ResourceFactory.createResource(DisplayVocabulary.CLASSGROUP_PAGE_TYPE)));
|
||||
return dgModel;
|
||||
}
|
||||
|
||||
//For now returning the first "data getter" we have - this will be a more complex operation
|
||||
//if multiple data getters possible as then will have to determine which data getter required
|
||||
//Based on whether this is an add or edit operation, return the appropriate data getter resource
|
||||
|
|
|
@ -4,7 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -13,6 +13,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Res
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.PageDataGetter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.DataGetterUtils;
|
||||
|
||||
public class HomePageController extends FreemarkerHttpServlet {
|
||||
|
||||
|
@ -25,13 +26,8 @@ public class HomePageController extends FreemarkerHttpServlet {
|
|||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
// VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache( getServletContext() );
|
||||
// List<VClassGroup> vClassGroups = vcgc.getGroups(vreq.getPortalId());
|
||||
// body.put("vClassGroups", vClassGroups);
|
||||
|
||||
PageDataGetter dataGetter =
|
||||
PageController.getPageDataGetterMap(getServletContext())
|
||||
.get(DisplayVocabulary.HOME_PAGE_TYPE);
|
||||
List<PageDataGetter> dataGetters = DataGetterUtils.getDataGetterObjects(vreq, DisplayVocabulary.HOME_PAGE_URI);
|
||||
for(PageDataGetter dataGetter: dataGetters) {
|
||||
if( dataGetter != null ){
|
||||
String uriOfPageInDisplayModel = "not defined";
|
||||
Map<String, Object> pageData =
|
||||
|
@ -40,6 +36,7 @@ public class HomePageController extends FreemarkerHttpServlet {
|
|||
if(pageData != null)
|
||||
body.putAll(pageData);
|
||||
}
|
||||
}
|
||||
body.put("dataServiceUrlVClassesForVClassGroup", UrlBuilder.getUrl("/dataservice?getVClassesForVClassGroup=1&classgroupUri="));
|
||||
|
||||
return new TemplateResponseValues(BODY_TEMPLATE, body);
|
||||
|
|
|
@ -1,261 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageMenus;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues;
|
||||
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.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.LocalNamespaceClassUtils;
|
||||
/*
|
||||
* Custom controller for menu management. This will be replaced later once N3 Editing
|
||||
* has been successfully refactored and integrated with menu management.
|
||||
*/
|
||||
public class InstitutionalInternalClassController extends FreemarkerHttpServlet {
|
||||
private static final Log log = LogFactory.getLog(InstitutionalInternalClassController.class);
|
||||
|
||||
private static final String EDIT_FORM = "/processInstitutionalInternalClass";
|
||||
public final static Actions REQUIRED_ACTIONS = new Actions(new ManageMenus());
|
||||
private static final String DISPLAY_FORM = "/institutionalInternalClassForm.ftl";
|
||||
private static HashMap<String, String> localNamespaces = new HashMap<String, String>();
|
||||
private static HashMap<String, String> localNamespaceClasses = new HashMap<String, String>();
|
||||
private static final String CREATE_CLASS_PARAM = "createClass";
|
||||
private static final String REDIRECT_PAGE = "/siteAdmin";
|
||||
@Override
|
||||
protected Actions requiredActions(VitroRequest vreq) {
|
||||
return REQUIRED_ACTIONS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResponseValues processRequest(VitroRequest vreq) {
|
||||
|
||||
//Based on existing of local namespaces and number of local classes present
|
||||
//as well as command parameter, execute command
|
||||
|
||||
Map<String, Object> data = new HashMap<String,Object>();
|
||||
//Get all local classes and namespace information
|
||||
retrieveLocalClasses(vreq, data);
|
||||
if(isSubmission(vreq)){
|
||||
processSubmission(vreq, data);
|
||||
} else if(isCreateNewClass(vreq)) {
|
||||
//Local namespace(s) exist and user wishes to create a new class
|
||||
//Either cmd = create new or no local classes exist at all and one must be created
|
||||
processCreateNewClass(vreq, data);
|
||||
} else if(isSelectExistingClass(vreq)) {
|
||||
//Local namespace(s) exist and user can select an existing class
|
||||
processSelectExistingClass(vreq, data);
|
||||
} else if(isCreateOntologies(vreq)) {
|
||||
//Not being handled expliclity but message will display indicating
|
||||
//no local namespaces exist and one must be created
|
||||
processCreateOntologies(vreq, data);
|
||||
} else {
|
||||
|
||||
}
|
||||
//Retrieve local namespaces
|
||||
|
||||
|
||||
//Check if existing local namespaces
|
||||
|
||||
data.put("formUrl", vreq.getContextPath() + EDIT_FORM);
|
||||
data.put("cancelUrl", vreq.getContextPath() + REDIRECT_PAGE);
|
||||
|
||||
//if no local namespaces, then provide message to display
|
||||
//if existing namespace(s), then check
|
||||
//if single namespace, retrieve all classes belonging to that local namespace
|
||||
//if multiple namespaces, generate select list with namespaces
|
||||
//for instertion: VClassDaoJena.insertVClass
|
||||
//
|
||||
if(isSubmission(vreq)){
|
||||
return redirectToSiteAdmin();
|
||||
}
|
||||
return new TemplateResponseValues(DISPLAY_FORM, data);
|
||||
|
||||
}
|
||||
|
||||
private boolean isSubmission(VitroRequest vreq) {
|
||||
String submit = vreq.getParameter("submitForm");
|
||||
return(submit!= null && !submit.isEmpty());
|
||||
}
|
||||
|
||||
private void processCreateOntologies(VitroRequest vreq, Map<String, Object> data) {
|
||||
data.put("submitAction", "");
|
||||
|
||||
}
|
||||
|
||||
private boolean isCreateOntologies(VitroRequest vreq) {
|
||||
//no local namespaces
|
||||
return (localNamespaces.size() == 0);
|
||||
|
||||
}
|
||||
|
||||
private void processCreateNewClass(VitroRequest vreq, Map<String, Object> data) {
|
||||
//this may need to be changed on the basis of how new classes interact with new ontologies
|
||||
data.put("submitAction", "Create Class");
|
||||
data.put("createNewClass", true);
|
||||
}
|
||||
|
||||
private boolean isCreateNewClass(VitroRequest vreq) {
|
||||
String command = vreq.getParameter("cmd");
|
||||
if(command != null && command.equals(CREATE_CLASS_PARAM)) {
|
||||
return true;
|
||||
}
|
||||
//If local namespace exists but no classes in local namespaces, then need to enable creation of new classes
|
||||
return(localNamespaces.size() > 0 && localNamespaceClasses.size() == 0);
|
||||
}
|
||||
|
||||
private void processSelectExistingClass(VitroRequest vreq, Map<String, Object> data) {
|
||||
//Check if local classes exist and use for selection
|
||||
data.put("useExistingLocalClass", true);
|
||||
data.put("submitAction", "Save");
|
||||
}
|
||||
|
||||
private boolean isSelectExistingClass(VitroRequest vreq) {
|
||||
//Local namespaces exist and there are existing classes within those namespaces
|
||||
return (localNamespaces.size() > 0 && localNamespaceClasses.size() > 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void retrieveLocalClasses(VitroRequest vreq, Map<String, Object> data) {
|
||||
localNamespaces = LocalNamespaceClassUtils.getLocalOntologyNamespaces(vreq);
|
||||
//Get classes for local namespaces
|
||||
localNamespaceClasses = LocalNamespaceClassUtils.getLocalNamespacesClasses(vreq, localNamespaces);
|
||||
data.put("existingLocalClasses", localNamespaceClasses);
|
||||
data.put("existingLocalNamespaces", localNamespaces);
|
||||
String noLocalOntologiesMessage = "There are currently no local ontologies. You must create a new ontology";
|
||||
data.put("noLocalOntologiesMessage", noLocalOntologiesMessage);
|
||||
if(localNamespaces.size() == 0) {
|
||||
data.put("ontologiesExist", false);
|
||||
}
|
||||
else {
|
||||
data.put("ontologiesExist", true);
|
||||
if(localNamespaces.size() > 1) {
|
||||
data.put("multipleLocalNamespaces", true);
|
||||
} else {
|
||||
data.put("multipleLocalNamespaces", false);
|
||||
data.put("existingLocalNamespace", localNamespaces.keySet().iterator().next());
|
||||
}
|
||||
//Get current internal class if it exists
|
||||
data.put("existingInternalClass", retrieveCurrentInternalClass());
|
||||
}
|
||||
//Place default namespace within data to pass back to template
|
||||
String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace();
|
||||
data.put("defaultNamespace", defaultNamespace);
|
||||
}
|
||||
|
||||
|
||||
//Process submission on submitting form
|
||||
private void processSubmission(VitroRequest vreq, Map<String, Object> data) {
|
||||
//If new class, need to generate new class
|
||||
String classUri = null;
|
||||
if(isNewClassSubmission(vreq)){
|
||||
VClass v= generateNewVClass(vreq.getParameter("localClassName"), vreq.getParameter("existingLocalNamespaces"));
|
||||
classUri = v.getURI();
|
||||
try {
|
||||
vreq.getWebappDaoFactory().getVClassDao().insertNewVClass(v);
|
||||
} catch(Exception ex) {
|
||||
log.error("Insertion of new class " + vreq.getParameter("name") + " resulted in error ", ex);
|
||||
}
|
||||
} else {
|
||||
//Existing class so get URI from that
|
||||
classUri = getExistingClassUri(vreq);
|
||||
}
|
||||
//If existing class, need to simply add a statement specifying existing class is an internal class
|
||||
if(classUri != null && !classUri.isEmpty()) {
|
||||
Model writeModel = ModelContext.getBaseOntModelSelector(getServletContext()).getTBoxModel();
|
||||
writeModel.enterCriticalSection(Lock.WRITE);
|
||||
writeModel.notifyEvent(new EditEvent(null,true));
|
||||
try {
|
||||
log.debug("Should be removing these statements " + writeModel.listStatements(null,
|
||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||
(RDFNode) null).toList().toString());
|
||||
//remove existing internal classes if there are any as assuming only one
|
||||
writeModel.removeAll(null,
|
||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||
(RDFNode) null);
|
||||
log.debug("Are there any statements left for internal class annotation: " + writeModel.listStatements(null,
|
||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||
(RDFNode) null).toList().toString());
|
||||
writeModel.add(
|
||||
writeModel.createStatement(
|
||||
ResourceFactory.createResource(classUri),
|
||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||
writeModel.createLiteral("true")));
|
||||
} catch(Exception ex) {
|
||||
log.error("Error occurred in adding statement for " + classUri + " becoming internal class", ex);
|
||||
} finally {
|
||||
writeModel.notifyEvent(new EditEvent(null,true));
|
||||
writeModel.leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private VClass generateNewVClass(String newClassName, String namespace) {
|
||||
VClass newClass = new VClass();
|
||||
newClass.setName(newClassName);
|
||||
newClass.setNamespace(namespace);
|
||||
String uri = namespace + newClassName.replaceAll(" ", "");
|
||||
newClass.setURI(uri);
|
||||
//How to g
|
||||
return newClass;
|
||||
}
|
||||
|
||||
private boolean isNewClassSubmission(VitroRequest vreq) {
|
||||
String localName = vreq.getParameter("localClassName");
|
||||
return (localName != null && !localName.isEmpty());
|
||||
}
|
||||
|
||||
private String getExistingClassUri(VitroRequest vreq) {
|
||||
return vreq.getParameter("existingLocalClasses");
|
||||
|
||||
}
|
||||
|
||||
private RedirectResponseValues redirectToSiteAdmin() {
|
||||
return new RedirectResponseValues(REDIRECT_PAGE, HttpServletResponse.SC_SEE_OTHER);
|
||||
}
|
||||
|
||||
//Get current internal class
|
||||
private String retrieveCurrentInternalClass() {
|
||||
String internalClassUri = "";
|
||||
Model mainModel = ModelContext.getBaseOntModelSelector(getServletContext()).getTBoxModel();;
|
||||
StmtIterator internalIt = mainModel.listStatements(null,
|
||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||
(RDFNode) null);
|
||||
while(internalIt.hasNext()){
|
||||
Statement s = internalIt.nextStatement();
|
||||
//The class IS an internal class so the subject is what we're looking for
|
||||
internalClassUri = s.getSubject().getURI();
|
||||
log.debug("Found internal class uri " + internalClassUri);
|
||||
}
|
||||
return internalClassUri;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,6 +10,8 @@ import java.util.ArrayList;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.MenuManagementDataUtils;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageMenus;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
|
@ -30,6 +32,10 @@ import com.hp.hpl.jena.rdf.model.Statement;
|
|||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.PageDataGetter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.DataGetterUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.SelectDataGetterUtils;
|
||||
|
||||
/*
|
||||
* Custom controller for menu management. This will be replaced later once N3 Editing
|
||||
* has been successfully refactored and integrated with menu management.
|
||||
|
@ -84,8 +90,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
private void initializeData(Map<String, Object> data, VitroRequest vreq) {
|
||||
data.put("formUrls", vreq.getContextPath() + SUBMIT_FORM);
|
||||
data.put("cancelUrl", vreq.getContextPath() + CANCEL_FORM);
|
||||
data.put("internalClassUri", "");
|
||||
|
||||
MenuManagementDataUtils.includeRequiredSystemData(getServletContext(), data);
|
||||
}
|
||||
|
||||
//Based on parameters, ascertain command
|
||||
|
@ -116,7 +121,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
//not a page already assigned a class group
|
||||
data.put("isClassGroupPage", false);
|
||||
data.put("includeAllClasses", false);
|
||||
data.put("classGroups", this.getClassGroups());
|
||||
data.put("classGroups", DataGetterUtils.getClassGroups(getServletContext()));
|
||||
data.put("selectedTemplateType", "default");
|
||||
//
|
||||
this.getMenuItemData(vreq, menuItem, data);
|
||||
|
@ -136,11 +141,9 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
//not a page already assigned a class group
|
||||
data.put("isClassGroupPage", false);
|
||||
data.put("includeAllClasses", false);
|
||||
data.put("classGroups", this.getClassGroups());
|
||||
data.put("classGroups", DataGetterUtils.getClassGroups(getServletContext()));
|
||||
data.put("selectedTemplateType", "default");
|
||||
//defaults to regular class group page
|
||||
//Check whether institutional internal class exists
|
||||
this.checkInstitutionalInternalClass(data);
|
||||
}
|
||||
|
||||
private void processEditMenuItem(VitroRequest vreq, Map<String, Object> data) {
|
||||
|
@ -153,9 +156,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
data.put("menuItem", menuItem);
|
||||
data.put("menuAction", "Edit");
|
||||
//Get All class groups
|
||||
data.put("classGroups", this.getClassGroups());
|
||||
//Check whether institutional internal class exists
|
||||
this.checkInstitutionalInternalClass(data);
|
||||
data.put("classGroups", DataGetterUtils.getClassGroups(getServletContext()));
|
||||
//Get data for menu item and associated page
|
||||
this.getMenuItemData(vreq, menuItem, data);
|
||||
this.getPageData(vreq, data);
|
||||
|
@ -219,7 +220,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
this.getCustomTemplate(writeModel, page, data);
|
||||
//retrieve information for page based on the data getter, with class group and individuals for classes getting different information
|
||||
//the browse page does not have a "data getter"
|
||||
this.getPageDataGetterInfo(writeModel, page, data);
|
||||
this.getPageDataGetterInfo(vreq, writeModel, page, data);
|
||||
//This is an all statement iterator
|
||||
log.debug("Debug statements: all statements in model for debugger");
|
||||
StmtIterator debugIt = writeModel.listStatements(page, null, (RDFNode) null);
|
||||
|
@ -261,9 +262,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
//Get data getter related info
|
||||
//All items will have data getter except for Browse or Home page
|
||||
//Home can be edited but not removed
|
||||
private void getPageDataGetterInfo(OntModel writeModel, Resource page, Map<String, Object> data) {
|
||||
|
||||
|
||||
private void getPageDataGetterInfo(VitroRequest vreq, OntModel writeModel, Resource page, Map<String, Object> data) {
|
||||
//Alternative is to do this via sparql query
|
||||
StmtIterator dataGetterIt = writeModel.listStatements(page, ResourceFactory.createProperty(DisplayVocabulary.HAS_DATA_GETTER), (RDFNode) null);
|
||||
while(dataGetterIt.hasNext()) {
|
||||
|
@ -273,141 +272,31 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
|||
StmtIterator dataGetterTypes = writeModel.listStatements(dataGetter, RDF.type, (RDFNode) null);
|
||||
while(dataGetterTypes.hasNext()) {
|
||||
String dataGetterType = dataGetterTypes.nextStatement().getResource().getURI();
|
||||
if(dataGetterType.equals(DisplayVocabulary.CLASSGROUP_PAGE_TYPE)) {
|
||||
this.retrieveClassGroupPage(writeModel, dataGetter, data);
|
||||
} else if(dataGetterType.equals(DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE)) {
|
||||
this.retrieveIndividualsForClassesPage(writeModel, dataGetter, data);
|
||||
} else {
|
||||
//Not sure what to do here
|
||||
}
|
||||
this.retrieveData(vreq, page, dataGetterType, data);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Based on institutional internal page and not general individualsForClasses
|
||||
private void retrieveIndividualsForClassesPage(OntModel writeModel,
|
||||
Resource dataGetter, Map<String, Object> data) {
|
||||
data.put("isIndividualsForClassesPage", true);
|
||||
data.put("isClassGroupPage", false);
|
||||
data.put("includeAllClasses", false);
|
||||
//Get the classes and put them here
|
||||
this.getClassesForInternalDataGetter(writeModel, dataGetter, data);
|
||||
//Also save the class group for display
|
||||
this.getClassGroupForDataGetter(writeModel, dataGetter, data);
|
||||
this.checkIfPageInternal(writeModel, data);
|
||||
private void retrieveData(VitroRequest vreq, Resource page, String dataGetterType, Map<String, Object> templateData) {
|
||||
//Data Getter type is now a class name
|
||||
String className = DataGetterUtils.getClassNameFromUri(dataGetterType);
|
||||
try{
|
||||
String pageURI = page.getURI();
|
||||
PageDataGetter pg = (PageDataGetter) Class.forName(className).newInstance();
|
||||
Map<String, Object> pageInfo = DataGetterUtils.getMapForPage( vreq, pageURI );
|
||||
|
||||
Map<String, Object> pageData = DataGetterUtils.getAdditionalData(pageURI, dataGetterType, pageInfo, vreq, pg, getServletContext());
|
||||
SelectDataGetterUtils.processAndRetrieveData(vreq, getServletContext(), pageData, className, templateData);
|
||||
} catch(Exception ex) {
|
||||
log.error("Exception occurred in instantiation page data getter for " + className, ex);
|
||||
}
|
||||
|
||||
private void checkIfPageInternal(OntModel writeModel,
|
||||
Map<String, Object> data) {
|
||||
//if internal class exists, and data getter indicates page is internal
|
||||
if(data.containsKey("internalClass") && data.containsKey("isInternal")) {
|
||||
data.put("pageInternalOnly", true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void retrieveClassGroupPage(OntModel writeModel, Resource dataGetter,
|
||||
Map<String, Object> data) {
|
||||
//This is a class group page so
|
||||
data.put("isClassGroupPage", true);
|
||||
data.put("includeAllClasses", true);
|
||||
|
||||
//Get the class group
|
||||
this.getClassGroupForDataGetter(writeModel, dataGetter, data);
|
||||
|
||||
}
|
||||
|
||||
//Instead of returning vclasses, just returning class Uris as vclasses appear to need their own template
|
||||
//to show up correctly
|
||||
private void getClassesForInternalDataGetter(OntModel writeModel, Resource dataGetter,
|
||||
Map<String, Object> data) {
|
||||
|
||||
|
||||
StmtIterator classesIt = writeModel.listStatements(dataGetter,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS),
|
||||
(RDFNode) null);
|
||||
|
||||
//Just need the class uris
|
||||
List<String> classUris = new ArrayList<String>();
|
||||
|
||||
while(classesIt.hasNext()) {
|
||||
String classUri = classesIt.nextStatement().getResource().getURI();
|
||||
classUris.add(classUri);
|
||||
}
|
||||
data.put("includeClasses", classUris);
|
||||
|
||||
//This checks whether restrict classes returned and include institutional internal class
|
||||
//TODO: Create separate method to get restricted classes
|
||||
//Get restrict classes - specifically internal class
|
||||
|
||||
StmtIterator internalIt = writeModel.listStatements(dataGetter,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL),
|
||||
(RDFNode) null);
|
||||
if(internalIt.hasNext()) {
|
||||
data.put("isInternal", internalIt.nextStatement().getLiteral().getString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Check whether any classes exist with internal class restrictions
|
||||
private void checkInstitutionalInternalClass(Map<String, Object> data) {
|
||||
//TODO: replace with more generic ModelContext retrieval method
|
||||
OntModel mainModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
||||
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
||||
//List<String> internalClasses = new ArrayList<String>();
|
||||
if(internalIt.hasNext()) {
|
||||
String internalClass = internalIt.nextStatement().getSubject().getURI();
|
||||
data.put("internalClass", internalClass);
|
||||
data.put("internalClassUri", internalClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Get the class page
|
||||
private void getClassGroupForDataGetter(OntModel writeModel, Resource dataGetter,
|
||||
Map<String, Object> data) {
|
||||
StmtIterator classGroupIt = writeModel.listStatements(dataGetter,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.FOR_CLASSGROUP),
|
||||
(RDFNode) null);
|
||||
//Assuming just one class group per page/item
|
||||
if(classGroupIt.hasNext()) {
|
||||
String classGroup = classGroupIt.nextStatement().getResource().getURI();
|
||||
VClassGroup vclassGroup = getClassGroup(classGroup);
|
||||
data.put("classGroup", vclassGroup);
|
||||
data.put("associatedPage", vclassGroup.getPublicName());
|
||||
data.put("associatedPageURI", vclassGroup.getURI());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Get classes in class group, useful in case of edit
|
||||
private VClassGroup getClassGroup(String classGroupUri) {
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||
VClassGroup group = vcgc.getGroup(classGroupUri);
|
||||
return group;
|
||||
}
|
||||
|
||||
//Get All VClass Groups
|
||||
private List<HashMap<String, String>> getClassGroups() {
|
||||
//Wanted this to be
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||
List<VClassGroup> vcgList = vcgc.getGroups();
|
||||
//For now encoding as hashmap with label and URI as trying to retrieve class group
|
||||
//results in errors for some reason
|
||||
//TODO: Check how to do this properly
|
||||
List<HashMap<String, String>> classGroups = new ArrayList<HashMap<String, String>>();
|
||||
for(VClassGroup vcg: vcgList) {
|
||||
HashMap<String, String> hs = new HashMap<String, String>();
|
||||
hs.put("publicName", vcg.getPublicName());
|
||||
hs.put("URI", vcg.getURI());
|
||||
classGroups.add(hs);
|
||||
}
|
||||
return classGroups;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,14 +2,10 @@
|
|||
|
||||
package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
|
@ -20,11 +16,6 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ExceptionResponseValues;
|
||||
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.utils.pageDataGetter.BrowseDataGetter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.PageDataGetter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.ClassGroupPageData;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.IndividualsForClassesDataGetter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.InternalClassesDataGetter;
|
||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.DataGetterUtils;
|
||||
/**
|
||||
* Controller for getting data for pages defined in the display model.
|
||||
|
@ -122,32 +113,10 @@ public class PageController extends FreemarkerHttpServlet{
|
|||
throw new Exception("no page found for " + vreq.getRequestURI() );
|
||||
}
|
||||
|
||||
public static Map<String,PageDataGetter> getPageDataGetterMap(ServletContext sc){
|
||||
setupDataGetters(sc);
|
||||
return (Map<String,PageDataGetter>)sc.getAttribute(DATA_GETTER_MAP);
|
||||
}
|
||||
|
||||
public static void putPageUri(HttpServletRequest req, String pageUri){
|
||||
req.setAttribute("pageURI", pageUri);
|
||||
}
|
||||
|
||||
public static void setupDataGetters(ServletContext context ){
|
||||
if( context != null && context.getAttribute(DATA_GETTER_MAP) == null ){
|
||||
context.setAttribute(DATA_GETTER_MAP, new HashMap<String,PageDataGetter>());
|
||||
|
||||
/* register all page data getters with the PageController servlet.
|
||||
* There should be a better way of doing this. */
|
||||
ClassGroupPageData cgpd = new ClassGroupPageData();
|
||||
getPageDataGetterMap(context).put(cgpd.getType(), cgpd);
|
||||
BrowseDataGetter bdg = new BrowseDataGetter();
|
||||
getPageDataGetterMap(context).put(bdg.getType(), bdg);
|
||||
IndividualsForClassesDataGetter cidg = new IndividualsForClassesDataGetter();
|
||||
getPageDataGetterMap(context).put(cidg.getType(), cidg);
|
||||
InternalClassesDataGetter internalCdg = new InternalClassesDataGetter();
|
||||
getPageDataGetterMap(context).put(internalCdg.getType(), internalCdg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public class DisplayVocabulary {
|
|||
|
||||
/* Individuals */
|
||||
public static final String DEFAULT_MENU = NS + "DefaultMenu";
|
||||
public static final String HOME_PAGE_URI = NS + "Home";
|
||||
public static final String SEARCH_INDEX_URI = NS + "SearchIndex";
|
||||
|
||||
//bk392 for extracting properties beyond context nodes.
|
||||
|
@ -36,6 +37,8 @@ public class DisplayVocabulary {
|
|||
//Corresponding to statements in menu management that define class of data getter to be used
|
||||
public static final String PAGE_TYPE = NS + "Page";
|
||||
public static final String HOME_PAGE_TYPE = NS + "HomePage";
|
||||
|
||||
|
||||
public static final String CLASSGROUP_PAGE_TYPE = NS + "ClassGroupPage";
|
||||
public static final String CLASSINDIVIDUALS_PAGE_TYPE = NS + "IndividualsForClassesPage";
|
||||
public static final String CLASSINDIVIDUALS_INTERNAL_TYPE = NS + "InternalClassesPage";
|
||||
|
@ -46,6 +49,7 @@ public class DisplayVocabulary {
|
|||
public static final String HAS_CLASS_INTERSECTION = NS + "hasClassIntersection";
|
||||
public static final String ITEM_TO_PAGE = NS + "toPage";
|
||||
public static final String HAS_ELEMENT = NS + "hasElement";
|
||||
public static final String USES_DATAGETTER_CLASS = NS + "usesDataGetterClass";
|
||||
|
||||
/**Data Getter object properties **/
|
||||
public static final String HAS_DATA_GETTER = NS + "hasDataGetter";
|
||||
|
|
|
@ -23,8 +23,10 @@ public interface PageDao {
|
|||
|
||||
String getClassGroupPage(String pageUri);
|
||||
|
||||
Map<String, List<String>> getClassesAndRestrictionsForPage(String pageUri);
|
||||
Map<String, Object> getClassesAndRestrictionsForPage(String pageUri);
|
||||
|
||||
Map<String, Object> getClassesAndCheckInternal(String pageUri);
|
||||
|
||||
List<String> getDataGetterClass(String pageUri);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.hp.hpl.jena.rdf.model.Model;
|
|||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
||||
|
@ -45,7 +46,7 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
|||
static protected Query individualsForClassesRestrictedQuery;
|
||||
static protected Query institutionalInternalClassQuery;
|
||||
static protected Query individualsForClassesInternalQuery;
|
||||
|
||||
static protected Query dataGetterClassQuery;
|
||||
|
||||
static final String prefixes =
|
||||
"PREFIX rdf: <" + VitroVocabulary.RDF +"> \n" +
|
||||
|
@ -89,26 +90,22 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
|||
" ?pageUri rdf:type <" + DisplayVocabulary.HOME_PAGE_TYPE + "> .\n"+
|
||||
"} \n" ;
|
||||
|
||||
/*
|
||||
static final protected String classGroupPageQueryString =
|
||||
prefixes + "\n" +
|
||||
"SELECT ?classGroup WHERE { ?pageUri <" + DisplayVocabulary.FOR_CLASSGROUP + "> ?classGroup . }";
|
||||
*/
|
||||
//Updated class group page query string
|
||||
|
||||
//Updated class group page query string so no longer check for type, as types have changed
|
||||
|
||||
static final protected String classGroupPageQueryString =
|
||||
prefixes + "\n" +
|
||||
"SELECT ?classGroup WHERE {\n" +
|
||||
" ?pageUri display:hasDataGetter ?dg .\n"+
|
||||
" ?dg rdf:type <" + DisplayVocabulary.CLASSGROUP_PAGE_TYPE + ">. \n" +
|
||||
" ?dg <" + DisplayVocabulary.FOR_CLASSGROUP + "> ?classGroup . \n" +
|
||||
"} \n" ;
|
||||
|
||||
//Query to get what classes are to be employed on the page
|
||||
//TODO: Commented out type but check if should include correct type
|
||||
static final protected String individualsForClassesDataGetterQueryString =
|
||||
prefixes + "\n" +
|
||||
"SELECT ?dg ?class ?restrictClass WHERE {\n" +
|
||||
" ?pageUri display:hasDataGetter ?dg .\n"+
|
||||
" ?dg rdf:type <" + DisplayVocabulary.CLASSINDIVIDUALS_PAGE_TYPE + ">. \n" +
|
||||
" ?pageUri display:hasDataGetter ?dg .\n"+ //" ?dg rdf:type <" + DisplayVocabulary.CLASSINDIVIDUALS_PAGE_TYPE + ">. \n" +
|
||||
" ?dg <" + DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS + "> ?class . \n" +
|
||||
" OPTIONAL {?dg <"+ DisplayVocabulary.RESTRICT_RESULTS_BY + "> ?restrictClass } .\n" +
|
||||
"} \n" ;
|
||||
|
@ -129,16 +126,21 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
|||
|
||||
//Query to get classes employed on internal class page
|
||||
//and restriction classes if they exist
|
||||
//TODO: Check if need to substitute class name type instead
|
||||
static final protected String individualsForClassesInternalQueryString =
|
||||
prefixes + "\n" +
|
||||
"SELECT ?dg ?class ?isInternal WHERE {\n" +
|
||||
" ?pageUri display:hasDataGetter ?dg .\n"+
|
||||
" ?dg rdf:type <" + DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE + ">. \n" +
|
||||
" ?pageUri display:hasDataGetter ?dg .\n"+ // " ?dg rdf:type <" + DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE + ">. \n" +
|
||||
" ?dg <" + DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS + "> ?class . \n" +
|
||||
" OPTIONAL { ?dg <"+ DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL + "> ?isInternal } .\n" +
|
||||
"} \n" ;
|
||||
|
||||
|
||||
static final protected String usesDataGetterClassQueryString =
|
||||
prefixes + "\n" +
|
||||
"SELECT ?dgClass WHERE {\n" +
|
||||
" ?pageUri display:hasDataGetter ?dg .\n"+
|
||||
" ?dg <" + RDF.type.getURI() + "> ?dgClass . \n" +
|
||||
"} \n" ;
|
||||
static{
|
||||
try{
|
||||
pageQuery=QueryFactory.create(pageQueryString);
|
||||
|
@ -203,6 +205,13 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
|||
log.error("could not create SPARQL query for individualsForClassesInternalQuery " + th.getMessage());
|
||||
log.error(individualsForClassesInternalQueryString);
|
||||
}
|
||||
//Check what class to use for data getter - returns java class name
|
||||
try{
|
||||
dataGetterClassQuery = QueryFactory.create(usesDataGetterClassQueryString);
|
||||
}catch(Throwable th){
|
||||
log.error("could not create SPARQL query for dataGetterClassQuery " + th.getMessage());
|
||||
log.error(usesDataGetterClassQueryString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -379,8 +388,8 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
|||
* Although to be used specifically for internal class filtering and will usually be one class returned,
|
||||
* allowing for multiple classes to be returned.
|
||||
*/
|
||||
public Map<String, List<String>> getClassesAndRestrictionsForPage(String pageUri) {
|
||||
Map<String, List<String>> classesAndRestrictions = new HashMap<String, List<String>>();
|
||||
public Map<String,Object> getClassesAndRestrictionsForPage(String pageUri) {
|
||||
Map<String, Object> classesAndRestrictions = new HashMap<String, Object>();
|
||||
QuerySolutionMap initialBindings = new QuerySolutionMap();
|
||||
initialBindings.add("pageUri", ResourceFactory.createResource(pageUri));
|
||||
List<String> classes = new ArrayList<String>();
|
||||
|
@ -460,6 +469,36 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
|||
}
|
||||
}
|
||||
|
||||
public List<String> getDataGetterClass(String pageUri) {
|
||||
QuerySolutionMap initialBindings = new QuerySolutionMap();
|
||||
initialBindings.add("pageUri", ResourceFactory.createResource(pageUri));
|
||||
List<String> dataGetterClasses = new ArrayList<String>();
|
||||
|
||||
Model displayModel = getOntModelSelector().getDisplayModel();
|
||||
displayModel.enterCriticalSection(false);
|
||||
try{
|
||||
QueryExecution qexec = QueryExecutionFactory.create( dataGetterClassQuery, displayModel , initialBindings);
|
||||
try{
|
||||
ResultSet resultSet = qexec.execSelect();
|
||||
while(resultSet.hasNext()){
|
||||
QuerySolution soln = resultSet.next();
|
||||
dataGetterClasses.add( nodeToString(soln.get("dgClass")) );
|
||||
}
|
||||
if( dataGetterClasses.size() == 0 ){
|
||||
log.debug("No data getter classes defined for "+ pageUri);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}finally{
|
||||
qexec.close();
|
||||
}
|
||||
}finally{
|
||||
displayModel.leaveCriticalSection();
|
||||
}
|
||||
return dataGetterClasses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* *************************** Utility methods ********************************* */
|
||||
|
|
|
@ -121,7 +121,7 @@ public class ClassGroupPageData implements PageDataGetter{
|
|||
}
|
||||
|
||||
public String getType(){
|
||||
return DisplayVocabulary.CLASSGROUP_PAGE_TYPE;
|
||||
return DataGetterUtils.generateDataGetterTypeURI(ClassGroupPageData.class.getName());
|
||||
}
|
||||
|
||||
//Get data servuice
|
||||
|
|
|
@ -29,6 +29,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListCont
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
|
||||
public class DataGetterUtils {
|
||||
protected static final String DATA_GETTER_MAP = "pageTypeToDataGetterMap";
|
||||
|
@ -37,26 +38,18 @@ public class DataGetterUtils {
|
|||
public static Map<String,Object> getDataForPage(String pageUri, VitroRequest vreq, ServletContext context) {
|
||||
//Based on page type get the appropriate data getter
|
||||
Map<String, Object> page = getMapForPage(vreq, pageUri);
|
||||
//Get data getters map
|
||||
Map<String, PageDataGetter> dataGetterMap = getPageDataGetterMap(context);
|
||||
//Get types associated with page
|
||||
Map<String,Object> data = new HashMap<String,Object>();
|
||||
List<String> dataGetters = (List<String>)page.get("dataGetters");
|
||||
log.debug("Retrieved data getters for Page " + pageUri + " = " + dataGetters.toString());
|
||||
if( dataGetters != null ){
|
||||
for( String dataGetter : dataGetters){
|
||||
Map<String,Object> moreData = null;
|
||||
PageDataGetter getter = dataGetterMap.get(dataGetter);
|
||||
log.debug("Retrieved data getter for " + dataGetter);
|
||||
List<PageDataGetter> dataGetters = getDataGetterObjects(vreq, pageUri);
|
||||
for(PageDataGetter getter: dataGetters) {
|
||||
try{
|
||||
moreData = getAdditionalData(pageUri, dataGetter, page, vreq, getter, context);
|
||||
Map<String,Object> moreData = null;
|
||||
moreData = getAdditionalData(pageUri, getter.getType(), page, vreq, getter, context);
|
||||
if( moreData != null)
|
||||
data.putAll(moreData);
|
||||
}catch(Throwable th){
|
||||
log.error(th,th);
|
||||
}
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -68,15 +61,12 @@ public class DataGetterUtils {
|
|||
public static JSONObject covertDataToJSONForPage(String pageUri, Map<String, Object> data, VitroRequest vreq, ServletContext context) {
|
||||
//Based on page type get the appropriate data getter
|
||||
Map<String, Object> page = getMapForPage(vreq, pageUri);
|
||||
//Get data getters map
|
||||
Map<String, PageDataGetter> dataGetterMap = getPageDataGetterMap(context);
|
||||
//Get types associated with page
|
||||
JSONObject rObj = null;
|
||||
List<String> types = (List<String>)page.get("types");
|
||||
if( types != null ){
|
||||
for( String type : types){
|
||||
List<PageDataGetter> dataGetters = getDataGetterObjects(vreq, pageUri);
|
||||
for(PageDataGetter getter: dataGetters) {
|
||||
JSONObject typeObj = null;
|
||||
PageDataGetter getter = dataGetterMap.get(type);
|
||||
try{
|
||||
typeObj = getter.convertToJSON(data, vreq);
|
||||
if( typeObj != null) {
|
||||
|
@ -84,17 +74,16 @@ public class DataGetterUtils {
|
|||
//TODO: Review how to handle duplicate keys, etc.
|
||||
if(rObj != null) {
|
||||
//For now, just nests as separate entry
|
||||
rObj.put(type, typeObj);
|
||||
rObj.put(getter.getType(), typeObj);
|
||||
} else {
|
||||
rObj = typeObj;
|
||||
}
|
||||
}
|
||||
|
||||
}catch(Throwable th){
|
||||
} catch(Throwable th){
|
||||
log.error(th,th);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rObj;
|
||||
}
|
||||
/*
|
||||
|
@ -105,38 +94,7 @@ public class DataGetterUtils {
|
|||
return vreq.getWebappDaoFactory().getPageDao().getPage(pageUri);
|
||||
}
|
||||
|
||||
public static void setupDataGetters(ServletContext context){
|
||||
if( context != null && context.getAttribute(DATA_GETTER_MAP) == null ){
|
||||
context.setAttribute(DATA_GETTER_MAP, new HashMap<String,PageDataGetter>());
|
||||
|
||||
/* register all page data getters with the PageController servlet.
|
||||
* There should be a better way of doing this. */
|
||||
ClassGroupPageData cgpd = new ClassGroupPageData();
|
||||
getPageDataGetterMap(context).put(cgpd.getType(), cgpd);
|
||||
BrowseDataGetter bdg = new BrowseDataGetter();
|
||||
getPageDataGetterMap(context).put(bdg.getType(), bdg);
|
||||
//TODO: Check if can include by type here
|
||||
IndividualsForClassesDataGetter cidg = new IndividualsForClassesDataGetter();
|
||||
getPageDataGetterMap(context).put(cidg.getType(), cidg);
|
||||
InternalClassesDataGetter internalCdg = new InternalClassesDataGetter();
|
||||
getPageDataGetterMap(context).put(internalCdg.getType(), internalCdg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static Map<String,PageDataGetter> getPageDataGetterMap(ServletContext sc){
|
||||
setupDataGetters(sc);
|
||||
return (Map<String,PageDataGetter>)sc.getAttribute(DATA_GETTER_MAP);
|
||||
}
|
||||
/*
|
||||
//Based on page Uri, do conversions
|
||||
public static PageDataGetter getDataGetterForType(String type, ServletContext sc) {
|
||||
Map<String, PageDataGetter> map = getPageDataGetterMap(sc);
|
||||
PageDataGetter pdg = (PageDataGetter) map.get(type);
|
||||
return pdg;
|
||||
}*/
|
||||
|
||||
protected static Map<String,Object> getAdditionalData(
|
||||
public static Map<String,Object> getAdditionalData(
|
||||
String pageUri, String dataGetterName, Map<String, Object> page, VitroRequest vreq, PageDataGetter getter, ServletContext context) {
|
||||
if(dataGetterName == null || dataGetterName.isEmpty())
|
||||
return Collections.emptyMap();
|
||||
|
@ -155,6 +113,42 @@ public class DataGetterUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* For the page, get the actual Data Getters to be employed
|
||||
*/
|
||||
public static List<PageDataGetter> getDataGetterObjects(VitroRequest vreq, String pageUri) {
|
||||
List<PageDataGetter> dataGetterObjects = new ArrayList<PageDataGetter>();
|
||||
try {
|
||||
List<String> dataGetterClassNames = vreq.getWebappDaoFactory().getPageDao().getDataGetterClass(pageUri);
|
||||
|
||||
|
||||
for(String dgClassName: dataGetterClassNames) {
|
||||
String className = getClassNameFromUri(dgClassName);
|
||||
PageDataGetter pg = (PageDataGetter) Class.forName(className).newInstance();
|
||||
if(pg != null) {
|
||||
dataGetterObjects.add(pg);
|
||||
} else {
|
||||
log.error("Data getter does not exist for " + className);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex) {
|
||||
log.error("Error occurred in retrieving data getter class names for "+ pageUri, ex);
|
||||
}
|
||||
return dataGetterObjects;
|
||||
}
|
||||
|
||||
//Class uris returned include "java:" and to instantiate object need to remove java: portion
|
||||
public static String getClassNameFromUri(String dataGetterClassUri) {
|
||||
if(dataGetterClassUri.contains("java:")) {
|
||||
String[] splitArray = dataGetterClassUri.split("java:");
|
||||
if(splitArray.length > 1) {
|
||||
return splitArray[1];
|
||||
}
|
||||
}
|
||||
return dataGetterClassUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Individual count for Solr query for intersection of multiple classes
|
||||
*/
|
||||
|
@ -306,5 +300,43 @@ public class DataGetterUtils {
|
|||
}
|
||||
|
||||
|
||||
//Get All VClass Groups information
|
||||
//Used within menu management and processing
|
||||
//TODO: Check if more appropriate location possible
|
||||
public static List<HashMap<String, String>> getClassGroups(ServletContext context) {
|
||||
//Wanted this to be
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context);
|
||||
List<VClassGroup> vcgList = vcgc.getGroups();
|
||||
//For now encoding as hashmap with label and URI as trying to retrieve class group
|
||||
//results in errors for some reason
|
||||
List<HashMap<String, String>> classGroups = new ArrayList<HashMap<String, String>>();
|
||||
for(VClassGroup vcg: vcgList) {
|
||||
HashMap<String, String> hs = new HashMap<String, String>();
|
||||
hs.put("publicName", vcg.getPublicName());
|
||||
hs.put("URI", vcg.getURI());
|
||||
classGroups.add(hs);
|
||||
}
|
||||
return classGroups;
|
||||
}
|
||||
|
||||
//Return data getter type to be employed in display model
|
||||
public static String generateDataGetterTypeURI(String dataGetterClassName) {
|
||||
return "java:" + dataGetterClassName;
|
||||
}
|
||||
|
||||
//TODO: Check whether this needs to be put here or elsewhere, as this is data getter specific
|
||||
//with respect to class groups
|
||||
//Need to use VClassGroupCache to retrieve class group information - this is the information returned from "for class group"
|
||||
public static void getClassGroupForDataGetter(ServletContext context, Map<String, Object> pageData, Map<String, Object> templateData) {
|
||||
//Get the class group from VClassGroup, this is the same as the class group for the class group page data getter
|
||||
//and the associated class group (not custom) for individuals datagetter
|
||||
String classGroupUri = (String) pageData.get("classGroupUri");
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context);
|
||||
VClassGroup group = vcgc.getGroup(classGroupUri);
|
||||
|
||||
templateData.put("classGroup", group);
|
||||
templateData.put("associatedPage", group.getPublicName());
|
||||
templateData.put("associatedPageURI", group.getURI());
|
||||
}
|
||||
|
||||
}
|
|
@ -17,6 +17,12 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
|
@ -24,6 +30,9 @@ import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
|||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
|
||||
|
||||
|
@ -34,20 +43,24 @@ import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateMo
|
|||
*/
|
||||
public class IndividualsForClassesDataGetter implements PageDataGetter{
|
||||
private static final Log log = LogFactory.getLog(IndividualsForClassesDataGetter.class);
|
||||
protected static String restrictClassesTemplateName = "restricted";
|
||||
protected static String restrictClassesTemplateName = null;
|
||||
public Map<String,Object> getData(ServletContext context, VitroRequest vreq, String pageUri, Map<String, Object> page ){
|
||||
this.setTemplateName();
|
||||
HashMap<String, Object> data = new HashMap<String,Object>();
|
||||
//This is the old technique of getting class intersections
|
||||
Map<String, List<String>> classIntersectionsMap = vreq.getWebappDaoFactory().getPageDao().getClassesAndRestrictionsForPage(pageUri);
|
||||
PageDao pageDao = vreq.getWebappDaoFactory().getPageDao();
|
||||
Map<String, Object> classIntersectionsMap = getClassIntersectionsMap(pageDao, pageUri);
|
||||
|
||||
try{
|
||||
List<String> classes = classIntersectionsMap.get("classes");
|
||||
List<String> restrictClasses = classIntersectionsMap.get("restrictClasses");
|
||||
List<String> classes = retrieveClasses(context, classIntersectionsMap);
|
||||
List<String> restrictClasses = retrieveRestrictClasses(context, classIntersectionsMap);
|
||||
log.debug("Retrieving classes for " + classes.toString() + " and restricting by " + restrictClasses.toString());
|
||||
processClassesAndRestrictions(vreq, context, data, classes, restrictClasses);
|
||||
//Also add data service url
|
||||
//Hardcoding for now, need a more dynamic way of doing this
|
||||
data.put("dataServiceUrlIndividualsByVClass", this.getDataServiceUrl());
|
||||
//this is the class group associated with the data getter utilized for display on menu editing, not the custom one created
|
||||
data.put("classGroupUri", pageDao.getClassGroupPage(pageUri));
|
||||
} catch(Exception ex) {
|
||||
log.error("An error occurred retrieving Vclass Intersection individuals", ex);
|
||||
}
|
||||
|
@ -55,13 +68,38 @@ public class IndividualsForClassesDataGetter implements PageDataGetter{
|
|||
return data;
|
||||
}
|
||||
|
||||
protected void setTemplateName() {
|
||||
this.restrictClassesTemplateName = "restricted";
|
||||
}
|
||||
|
||||
protected Map<String, Object> getClassIntersectionsMap(PageDao pageDao,
|
||||
String pageUri) {
|
||||
// TODO Auto-generated method stub
|
||||
return pageDao.getClassesAndRestrictionsForPage(pageUri);
|
||||
}
|
||||
|
||||
protected List<String> retrieveClasses(
|
||||
ServletContext context, Map<String, Object> classIntersectionsMap) {
|
||||
List<String> restrictClasses = (List<String>) classIntersectionsMap.get("classes");
|
||||
return restrictClasses;
|
||||
}
|
||||
|
||||
protected List<String> retrieveRestrictClasses(
|
||||
ServletContext context, Map<String, Object> classIntersectionsMap) {
|
||||
List<String> restrictClasses = (List<String>) classIntersectionsMap.get("restrictClasses");
|
||||
return restrictClasses;
|
||||
}
|
||||
|
||||
protected void processClassesAndRestrictions(VitroRequest vreq, ServletContext context,
|
||||
HashMap<String, Object> data, List<String> classes, List<String> restrictClasses ) {
|
||||
processClassesForDisplay(context, data, classes);
|
||||
processRestrictionClasses(vreq, context, data, restrictClasses);
|
||||
processIntersections(vreq, context, data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//At this point, data specifices whether or not intersections included
|
||||
private void processIntersections(VitroRequest vreq,
|
||||
ServletContext context, HashMap<String, Object> data) {
|
||||
|
@ -122,7 +160,6 @@ public class IndividualsForClassesDataGetter implements PageDataGetter{
|
|||
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context);
|
||||
for(String classUri: classes) {
|
||||
//VClass vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(classUri);
|
||||
//Retrieve vclass from cache to get the count
|
||||
VClass vclass = vcgc.getCachedVClass(classUri);
|
||||
if(vclass != null) {
|
||||
|
@ -152,10 +189,15 @@ public class IndividualsForClassesDataGetter implements PageDataGetter{
|
|||
List<VClass> restrictVClasses = new ArrayList<VClass>();
|
||||
|
||||
List<String> urlEncodedRestrictClasses = new ArrayList<String>();
|
||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(context);
|
||||
|
||||
if(restrictClasses.size() > 0) {
|
||||
//classes for restriction are not displayed so don't need to include their class individual counts
|
||||
for(String restrictClassUri: restrictClasses) {
|
||||
VClass vclass = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(restrictClassUri);
|
||||
//Also uses cache to remain consistent with process classes and also allow
|
||||
//vclasses to be returned even if switched to display model, although
|
||||
//uris used within display model editing and not vclass objects
|
||||
VClass vclass = vcgc.getCachedVClass(restrictClassUri);
|
||||
if(vclass != null) {
|
||||
log.debug("Found restrict class and adding to list " + restrictClassUri);
|
||||
restrictVClasses.add(vclass);
|
||||
|
@ -226,7 +268,7 @@ public class IndividualsForClassesDataGetter implements PageDataGetter{
|
|||
}
|
||||
|
||||
public String getType(){
|
||||
return DisplayVocabulary.CLASSINDIVIDUALS_PAGE_TYPE;
|
||||
return DataGetterUtils.generateDataGetterTypeURI(IndividualsForClassesDataGetter.class.getName());
|
||||
}
|
||||
|
||||
//Get data servuice
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Statement;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
||||
|
||||
/**
|
||||
* This will pass these variables to the template:
|
||||
* classGroupUri: uri of the classgroup associated with this page.
|
||||
* vClassGroup: a data structure that is the classgroup associated with this page.
|
||||
*/
|
||||
public class InternalClassesDataGetter extends IndividualsForClassesDataGetter{
|
||||
private static final Log log = LogFactory.getLog(InternalClassesDataGetter.class);
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getData(ServletContext context, VitroRequest vreq, String pageUri, Map<String, Object> page ){
|
||||
//Set restricted classes template
|
||||
super.restrictClassesTemplateName = "internalClass";
|
||||
HashMap<String, Object> data = new HashMap<String,Object>();
|
||||
//This is the old technique of getting class intersections
|
||||
Map<String, Object> classIntersectionsMap = vreq.getWebappDaoFactory().getPageDao().getClassesAndCheckInternal(pageUri);
|
||||
|
||||
|
||||
//Use Individual List Controller to get all the individuals and related data
|
||||
List<Individual> inds = new ArrayList<Individual>();
|
||||
try{
|
||||
List<String> classes = (List<String>)classIntersectionsMap.get("classes");
|
||||
List<String> restrictClasses = retrieveRestrictClasses(context, classIntersectionsMap);
|
||||
log.debug("Retrieving classes for " + classes.toString() + " and restricting by " + restrictClasses.toString());
|
||||
processClassesAndRestrictions(vreq, context, data, classes, restrictClasses);
|
||||
//Also add data service url
|
||||
//Hardcoding for now, need a more dynamic way of doing this
|
||||
data.put("dataServiceUrlIndividualsByVClass", this.getDataServiceUrl());
|
||||
log.debug("Using data service url " + this.getDataServiceUrl());
|
||||
} catch(Exception ex) {
|
||||
log.error("An error occurred retrieving Vclass Intersection individuals", ex);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private List<String> retrieveRestrictClasses(
|
||||
ServletContext context, Map<String, Object> classIntersectionsMap) {
|
||||
List<String> restrictClasses = new ArrayList<String>();
|
||||
String internalClass = (String) classIntersectionsMap.get("isInternal");
|
||||
//if internal class restriction specified and is true
|
||||
if(internalClass != null && internalClass.equals("true")) {
|
||||
//Get internal class
|
||||
Model mainModel = ModelContext.getBaseOntModelSelector(context).getTBoxModel();;
|
||||
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
||||
//Checks for just one statement
|
||||
if(internalIt.hasNext()){
|
||||
Statement s = internalIt.nextStatement();
|
||||
//The class IS an internal class so the subject is what we're looking for
|
||||
String internalClassUri = s.getSubject().getURI();
|
||||
log.debug("Found internal class uri " + internalClassUri);
|
||||
restrictClasses.add(internalClassUri);
|
||||
}
|
||||
}
|
||||
|
||||
return restrictClasses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType(){
|
||||
return DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.JsonServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
|
||||
/*
|
||||
* This class includes methods that help in selecting a data getter based on
|
||||
* parameters, and VIVO will have its own version or extend this
|
||||
*/
|
||||
public class MenuManagementDataUtils {
|
||||
private static final Log log = LogFactory.getLog(MenuManagementDataUtils.class);
|
||||
|
||||
//Data that is to be returned to template that does not involve data getters
|
||||
//e.g. what are the current class groups, etc.
|
||||
public static void includeRequiredSystemData(ServletContext context, Map<String, Object> templateData) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.JsonServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
|
||||
/*
|
||||
* Handle processing of data retrieved from ClassGroupPage data getter to return to form template
|
||||
* and handle processing of form submission to create the appropriate individuals for classes data getter
|
||||
*/
|
||||
public class ProcessClassGroup implements ProcessDataGetter{
|
||||
private static final Log log = LogFactory.getLog(ProcessClassGroup.class);
|
||||
|
||||
//template data represents what needs to be modified and returned to template
|
||||
//page data is data retrieved from data getter
|
||||
public void populateTemplate(ServletContext context, Map<String, Object> pageData, Map<String, Object> templateData) {
|
||||
//This is a class group page so
|
||||
templateData.put("isClassGroupPage", true);
|
||||
templateData.put("includeAllClasses", true);
|
||||
|
||||
//Get the class group from VClassGroup
|
||||
DataGetterUtils.getClassGroupForDataGetter(context, pageData, templateData);
|
||||
}
|
||||
|
||||
|
||||
//Process submission
|
||||
|
||||
public Model processSubmission(VitroRequest vreq, Resource dataGetterResource) {
|
||||
ClassGroupPageData cpg = new ClassGroupPageData();
|
||||
Model dgModel = ModelFactory.createDefaultModel();
|
||||
String dataGetterTypeUri = cpg.getType();
|
||||
dgModel.add(dgModel.createStatement(dataGetterResource,
|
||||
RDF.type,
|
||||
ResourceFactory.createResource(dataGetterTypeUri)));
|
||||
return dgModel;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
|
||||
public interface ProcessDataGetter{
|
||||
public void populateTemplate(ServletContext context, Map<String, Object> pageData, Map<String, Object> templateData);
|
||||
|
||||
public Model processSubmission(VitroRequest vreq, Resource dataGetterResource);
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.JsonServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
|
||||
/*
|
||||
* Handle processing of data retrieved from IndividualsForClasses data getter to return to form template
|
||||
* and handle processing of form submission to create the appropriate individuals for classes data getter
|
||||
*/
|
||||
public class ProcessIndividualsForClasses implements ProcessDataGetter {
|
||||
private static final Log log = LogFactory.getLog(ProcessIndividualsForClasses.class);
|
||||
|
||||
/**Retrieve and populate**/
|
||||
|
||||
//Based on institutional internal page and not general individualsForClasses
|
||||
public void populateTemplate(ServletContext context, Map<String, Object> pageData, Map<String, Object> templateData) {
|
||||
initTemplateData(templateData);
|
||||
populateIncludedClasses(pageData, templateData);
|
||||
populateRestrictedClasses(pageData, templateData);
|
||||
//Also save the class group for display
|
||||
DataGetterUtils.getClassGroupForDataGetter(context, pageData, templateData);
|
||||
|
||||
}
|
||||
|
||||
protected void initTemplateData(Map<String,Object> templateData) {
|
||||
templateData.put("isIndividualsForClassesPage", true);
|
||||
templateData.put("isClassGroupPage", false);
|
||||
templateData.put("includeAllClasses", false);
|
||||
}
|
||||
|
||||
protected void populateIncludedClasses(Map<String, Object> pageData, Map<String, Object> templateData) {
|
||||
//what classes are to be included on page, note this should be a list of string uris
|
||||
VClassGroup includedClasses = (VClassGroup) pageData.get("vClassGroup");
|
||||
templateData.put("includeClasses", getClassUrisAsList(includedClasses));
|
||||
}
|
||||
|
||||
protected void populateRestrictedClasses(Map<String, Object> pageData, Map<String, Object> templateData) {
|
||||
VClassGroup restrictedClasses = (VClassGroup) pageData.get("restrictVClassGroup");
|
||||
templateData.put("restricted", getClassUrisAsList(restrictedClasses));
|
||||
}
|
||||
|
||||
protected List<String> getClassUrisAsList(VClassGroup includedClasses) {
|
||||
List<String> classUris = new ArrayList<String>();
|
||||
List<VClass> classList = includedClasses.getVitroClassList();
|
||||
for(VClass v:classList) {
|
||||
classUris.add(v.getURI());
|
||||
}
|
||||
return classUris;
|
||||
}
|
||||
|
||||
/**Process submission**/
|
||||
//Check and see if we should use this process
|
||||
//Use this if either internal class is selected or all classes have been selected
|
||||
//No separate inputs for classes to restrict by yet so check if this includes a subset of classes
|
||||
public boolean useProcessor(VitroRequest vreq) {
|
||||
return(!allClassesSelected(vreq));
|
||||
}
|
||||
public Model processSubmission(VitroRequest vreq, Resource dataGetterResource) {
|
||||
String[] selectedClasses = vreq.getParameterValues("classInClassGroup");
|
||||
String dataGetterTypeUri = new IndividualsForClassesDataGetter().getType();
|
||||
Model dgModel = ModelFactory.createDefaultModel();
|
||||
dgModel.add(dgModel.createStatement(dataGetterResource,
|
||||
RDF.type,
|
||||
ResourceFactory.createResource(dataGetterTypeUri)));
|
||||
for(String classUri: selectedClasses) {
|
||||
dgModel.add(dgModel.createStatement(
|
||||
dataGetterResource,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS),
|
||||
ResourceFactory.createResource(classUri)));
|
||||
}
|
||||
|
||||
//This code can be uncommented when the form includes inputs for restricted class uris
|
||||
//At that time, use the input that returns the uris for restriction classes and replace below
|
||||
/*
|
||||
if(restrictionClassesSelected(vreq)) {
|
||||
String[] restrictedClasses = vreq.getParameterValues("restrictedClassUris");
|
||||
for(String restrictedClassUri: restrictedClasses) {
|
||||
dgModel.add(dgModel.createStatement(
|
||||
dataGetterResource,
|
||||
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY),
|
||||
dgModel.createLiteral(restrictedClassUri)));
|
||||
}
|
||||
}*/
|
||||
return dgModel;
|
||||
}
|
||||
|
||||
private boolean allClassesSelected(VitroRequest vreq) {
|
||||
String allClasses = vreq.getParameter("allSelected");
|
||||
return (allClasses != null && !allClasses.isEmpty());
|
||||
}
|
||||
|
||||
//This code can be uncommented when the form includes inputs for restricted class uris
|
||||
//At that time, use the input that returns the uris for restriction classes and replace below
|
||||
/*
|
||||
private boolean restrictionClassesSelected(VitroRequest vreq) {
|
||||
String restrictedClasses = vreq.getParameter("restrictedClassUri");
|
||||
return (restrictedClasses != null && !restrictedClasses.isEmpty());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
|
||||
package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.vocabulary.RDF;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.JsonServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController.PageRecord;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
|
||||
/*
|
||||
* This class includes methods that help in selecting a data getter based on
|
||||
* parameters, and VIVO will have its own version or extend this
|
||||
*/
|
||||
public class SelectDataGetterUtils {
|
||||
private static final Log log = LogFactory.getLog(SelectDataGetterUtils.class);
|
||||
|
||||
/**Get data for an existing page and set variables for the template accordingly**/
|
||||
|
||||
|
||||
public static void processAndRetrieveData(VitroRequest vreq, ServletContext context, Map<String, Object> pageData, String dataGetterClass, Map<String, Object> templateData) {
|
||||
//The type of the data getter will show how to process the data from the data getter
|
||||
ProcessDataGetter processor = selectProcessor(dataGetterClass);
|
||||
processor.populateTemplate(context, pageData, templateData);
|
||||
}
|
||||
|
||||
//This will be different in VIVO than in VITRO
|
||||
private static ProcessDataGetter selectProcessor(String dataGetterClass) {
|
||||
if(dataGetterClass.equals(ClassGroupPageData.class.getName())) {
|
||||
return new ProcessClassGroup();
|
||||
} else if(dataGetterClass.equals(IndividualsForClassesDataGetter.class.getName())) {
|
||||
//below should be for vitro specific version
|
||||
return new ProcessIndividualsForClasses();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**Process parameters from form and select appropriate data getter on this basis **/
|
||||
public static Model createDataGetterModel(VitroRequest vreq, Resource dataGetterResource) {
|
||||
Model dataGetterModel = null;
|
||||
if(dataGetterResource != null) {
|
||||
//If "All selected" then use class group else use individuals for classes
|
||||
dataGetterModel = ModelFactory.createDefaultModel();
|
||||
|
||||
ProcessIndividualsForClasses individualsProcess = new ProcessIndividualsForClasses();
|
||||
|
||||
ProcessClassGroup classGroupProcess = new ProcessClassGroup();
|
||||
if(individualsProcess.useProcessor(vreq)) {
|
||||
dataGetterModel = individualsProcess.processSubmission(vreq, dataGetterResource);
|
||||
} else {
|
||||
dataGetterModel = classGroupProcess.processSubmission(vreq, dataGetterResource);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
log.error("Data getter is null ");
|
||||
}
|
||||
return dataGetterModel;
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue