Class DataGetterUtils
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.utils.dataGetter.DataGetterUtils
-
public class DataGetterUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringDATA_GETTERS_FOR_PAGEAttribute name in request for DataGetters
-
Constructor Summary
Constructors Constructor Description DataGetterUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.node.ObjectNodecovertDataToJSONForPage(VitroRequest vreq, String pageUri, org.apache.jena.rdf.model.Model displayModel)Convert data to JSON for page uri based on type and related datagetters TODO: How to handle different data getters? Will this replace json fields or add to them?static DataGetterdataGetterForURI(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String dataGetterURI)Returns a DataGetter using information in the displayModel for the individual with the URI given by dataGetterURI to configure it.static StringgenerateDataGetterTypeURI(String dataGetterClassName)static voidgetClassGroupForDataGetter(javax.servlet.http.HttpServletRequest req, Map<String,Object> pageData, Map<String,Object> templateData)static StringgetClassGroupForDataGetter(org.apache.jena.rdf.model.Model displayModel, String dataGetterURI)static List<HashMap<String,String>>getClassGroups(javax.servlet.http.HttpServletRequest req)static StringgetClassNameFromUri(String dataGetterClassUri)For the page, get the actual Data Getters to be employed.static List<DataGetter>getDataGettersForClass(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String classURI)Get a list of DataGetter objects that are associated with a Vitro VClass.static List<DataGetter>getDataGettersForPage(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String pageURI)Get a list of DataGetter objects that are associated with a page.static List<DataGetter>getDataGettersForTemplate(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String templateName)Get a list of DataGetter objects that are associated with a Freemarker template.static StringgetJClassForDataGetterURI(org.apache.jena.rdf.model.Model displayModel, String dataGetterURI)protected static StringnodeToString(org.apache.jena.rdf.model.RDFNode node)static com.fasterxml.jackson.databind.node.ObjectNodeprocessVClassGroupJSON(VClassGroup vcg)
-
-
-
Field Detail
-
DATA_GETTERS_FOR_PAGE
public static final String DATA_GETTERS_FOR_PAGE
Attribute name in request for DataGetters- See Also:
- Constant Field Values
-
-
Method Detail
-
getDataGettersForPage
public static List<DataGetter> getDataGettersForPage(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String pageURI) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException
Get a list of DataGetter objects that are associated with a page. This should not return PageDataGetters and should not throw an exception if a page has PageDataGetters.
-
getDataGettersForClass
public static List<DataGetter> getDataGettersForClass(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String classURI) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException
Get a list of DataGetter objects that are associated with a Vitro VClass. This allows the individual profile for an individual of a specific class to be returned .
-
getDataGettersForTemplate
public static List<DataGetter> getDataGettersForTemplate(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String templateName) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException
Get a list of DataGetter objects that are associated with a Freemarker template.- Parameters:
templateName- a filename like "index.ftl", which will be used as a URI like "freemarker:index.ftl".- Throws:
InstantiationExceptionIllegalAccessExceptionClassNotFoundExceptionIllegalArgumentExceptionSecurityExceptionInvocationTargetException
-
dataGetterForURI
public static DataGetter dataGetterForURI(VitroRequest vreq, org.apache.jena.rdf.model.Model displayModel, String dataGetterURI) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IllegalArgumentException, InvocationTargetException, SecurityException
Returns a DataGetter using information in the displayModel for the individual with the URI given by dataGetterURI to configure it. May return null. This should not throw an exception if the URI exists and has a type that does not implement the DataGetter interface.
-
getJClassForDataGetterURI
public static String getJClassForDataGetterURI(org.apache.jena.rdf.model.Model displayModel, String dataGetterURI) throws IllegalAccessException
- Throws:
IllegalAccessException
-
nodeToString
protected static String nodeToString(org.apache.jena.rdf.model.RDFNode node)
-
generateDataGetterTypeURI
public static String generateDataGetterTypeURI(String dataGetterClassName)
-
getClassGroupForDataGetter
public static final String getClassGroupForDataGetter(org.apache.jena.rdf.model.Model displayModel, String dataGetterURI)
-
covertDataToJSONForPage
public static com.fasterxml.jackson.databind.node.ObjectNode covertDataToJSONForPage(VitroRequest vreq, String pageUri, org.apache.jena.rdf.model.Model displayModel) throws InstantiationException, IllegalAccessException, ClassNotFoundException
Convert data to JSON for page uri based on type and related datagetters TODO: How to handle different data getters? Will this replace json fields or add to them?
-
getClassNameFromUri
public static String getClassNameFromUri(String dataGetterClassUri)
For the page, get the actual Data Getters to be employed.
-
processVClassGroupJSON
public static com.fasterxml.jackson.databind.node.ObjectNode processVClassGroupJSON(VClassGroup vcg)
-
getClassGroups
public static List<HashMap<String,String>> getClassGroups(javax.servlet.http.HttpServletRequest req)
-
-