Class CreateAndLinkResourceController
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet
-
- edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet
-
- org.vivoweb.webapp.controller.freemarker.CreateAndLinkResourceController
-
- All Implemented Interfaces:
edu.cornell.mannlib.vitro.webapp.controller.MultipartRequestWrapper.ParsingStrategy,Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
@WebServlet(name="CreateAndLinkResource", urlPatterns="/createAndLink/*") public class CreateAndLinkResourceController extends edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServletMain controller class for claiming (creating and/or linking) resources to a profile- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classCreateAndLinkResourceController.PublicationType
-
Field Summary
-
Constructor Summary
Constructors Constructor Description CreateAndLinkResourceController()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddDateToResource(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Resource work, ResourceModel.DateField date)Add a date object to the resourceprotected StringcreateVIVOObject(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Model model, ResourceModel resourceModel, String typeUri)Create a new resource in VIVO, based on the values of the intermediate modelprotected StringfindInVIVO(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, ExternalIdentifiers ids, String profileUri, Citation citation)Try to find a resource in VIVO that defines one of the external identifiersstatic Set<String>getEnabledProviders(edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties props)protected org.apache.jena.rdf.model.ModelgetExistingResource(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, String uri)Find an existing resource in VIVO, and return a Model with the appropriate statementsprotected StringgetPublisherURI(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, String publisher)Get a URI for the publisher objectprotected StringgetVCardURI(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, String familyName, String givenName)Get a URI for a VCARD objectvoidinit(javax.servlet.ServletConfig config)protected booleanisResourceOfType(org.apache.jena.rdf.model.Resource resource, String typeUri)Check that the resource is declared to be of a particular typeprotected voidprocessRelationships(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Model model, String vivoUri, String userUri, String relationship)Adjust the in-memory model to create the appropriate relationships for the claimed user role (authorship, editorship, etc)protected edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValuesprocessRequest(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq)Main method for the resource claiming (create and link) workflowprotected voidproposeAuthorToLink(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, Citation citation, String profileUri)Method to find an author to propose for linkingstatic voidregisterProviders(edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties props)protected voidremoveAuthorship(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Model model, String vivoUri, int rank)Removes an existing authorship at a given position, when that position is claimed by the authorprotected voidremoveVCard(org.apache.jena.rdf.model.Model model, String vcardUri)Attempt to remove a VCARD from VIVO, ensuring that it is not being used firstprotected edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequestrequiredActions(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq)Ensure that we can only be called if the user has the correct permissionsprotected voidwriteChanges(edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService rdfService, org.apache.jena.rdf.model.Model existingModel, org.apache.jena.rdf.model.Model updatedModel)Determine the difference between the "existing" and "updated" models, and write the changes to VIVO-
Methods inherited from class edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet
doException, doForward, doGet, doPost, doRdf, doRedirect, doResponse, doTemplate, getBeansWrapper, getDisplayModelMenu, getFreemarkerComponentsForJsp, getPageTemplateName, getPageTemplateValues, getThemeDir, getTitle, handleException, processTemplate, processTemplateToString, wrap, wrap, write, writePage, writeTemplate, writeTemplate
-
Methods inherited from class edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet
dumpRequestParameters, isAuthorizedToDisplayPage, maximumMultipartFileSize, redirectToInsufficientAuthorizationPage, redirectToLoginPage, redirectUnauthorizedRequest, service, sortForPickList, stashFileSizeException
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
REQUIRED_ACTIONS
public static final edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest REQUIRED_ACTIONS
-
BIBO_ABSTRACT
public static final String BIBO_ABSTRACT
URIs of types and predicates in the VIVO ontology that we need for creating resources- See Also:
- Constant Field Values
-
BIBO_ARTICLE
public static final String BIBO_ARTICLE
- See Also:
- Constant Field Values
-
BIBO_BOOK
public static final String BIBO_BOOK
- See Also:
- Constant Field Values
-
BIBO_DOI
public static final String BIBO_DOI
- See Also:
- Constant Field Values
-
BIBO_ISBN10
public static final String BIBO_ISBN10
- See Also:
- Constant Field Values
-
BIBO_ISBN13
public static final String BIBO_ISBN13
- See Also:
- Constant Field Values
-
BIBO_ISSN
public static final String BIBO_ISSN
- See Also:
- Constant Field Values
-
BIBO_ISSUE
public static final String BIBO_ISSUE
- See Also:
- Constant Field Values
-
BIBO_JOURNAL
public static final String BIBO_JOURNAL
- See Also:
- Constant Field Values
-
BIBO_PAGE_COUNT
public static final String BIBO_PAGE_COUNT
- See Also:
- Constant Field Values
-
BIBO_PAGE_END
public static final String BIBO_PAGE_END
- See Also:
- Constant Field Values
-
BIBO_PAGE_START
public static final String BIBO_PAGE_START
- See Also:
- Constant Field Values
-
BIBO_PMID
public static final String BIBO_PMID
- See Also:
- Constant Field Values
-
BIBO_VOLUME
public static final String BIBO_VOLUME
- See Also:
- Constant Field Values
-
FOAF_FIRSTNAME
public static final String FOAF_FIRSTNAME
- See Also:
- Constant Field Values
-
FOAF_LASTNAME
public static final String FOAF_LASTNAME
- See Also:
- Constant Field Values
-
OBO_CONTACT_INFO_FOR
public static final String OBO_CONTACT_INFO_FOR
- See Also:
- Constant Field Values
-
OBO_HAS_CONTACT_INFO
public static final String OBO_HAS_CONTACT_INFO
- See Also:
- Constant Field Values
-
OBO_INHERES_IN
public static final String OBO_INHERES_IN
- See Also:
- Constant Field Values
-
OBO_BEARER_OF
public static final String OBO_BEARER_OF
- See Also:
- Constant Field Values
-
RDFS_LABEL
public static final String RDFS_LABEL
- See Also:
- Constant Field Values
-
VIVO_AUTHORSHIP
public static final String VIVO_AUTHORSHIP
- See Also:
- Constant Field Values
-
VIVO_DATETIME
public static final String VIVO_DATETIME
- See Also:
- Constant Field Values
-
VIVO_DATETIMEPRECISION
public static final String VIVO_DATETIMEPRECISION
- See Also:
- Constant Field Values
-
VIVO_DATETIMEVALUE
public static final String VIVO_DATETIMEVALUE
- See Also:
- Constant Field Values
-
VIVO_EDITORSHIP
public static final String VIVO_EDITORSHIP
- See Also:
- Constant Field Values
-
VIVO_HASPUBLICATIONVENUE
public static final String VIVO_HASPUBLICATIONVENUE
- See Also:
- Constant Field Values
-
VIVO_PMCID
public static final String VIVO_PMCID
- See Also:
- Constant Field Values
-
VIVO_PUBLICATIONVENUEFOR
public static final String VIVO_PUBLICATIONVENUEFOR
- See Also:
- Constant Field Values
-
VIVO_PUBLISHER
public static final String VIVO_PUBLISHER
- See Also:
- Constant Field Values
-
VIVO_PUBLISHER_CLASS
public static final String VIVO_PUBLISHER_CLASS
- See Also:
- Constant Field Values
-
VIVO_PUBLISHER_OF
public static final String VIVO_PUBLISHER_OF
- See Also:
- Constant Field Values
-
VIVO_RANK
public static final String VIVO_RANK
- See Also:
- Constant Field Values
-
VIVO_RELATEDBY
public static final String VIVO_RELATEDBY
- See Also:
- Constant Field Values
-
VIVO_RELATES
public static final String VIVO_RELATES
- See Also:
- Constant Field Values
-
VCARD_FAMILYNAME
public static final String VCARD_FAMILYNAME
- See Also:
- Constant Field Values
-
VCARD_GIVENNAME
public static final String VCARD_GIVENNAME
- See Also:
- Constant Field Values
-
VCARD_HAS_NAME
public static final String VCARD_HAS_NAME
- See Also:
- Constant Field Values
-
VCARD_HAS_URL
public static final String VCARD_HAS_URL
- See Also:
- Constant Field Values
-
VCARD_INDIVIDUAL
public static final String VCARD_INDIVIDUAL
- See Also:
- Constant Field Values
-
VCARD_KIND
public static final String VCARD_KIND
- See Also:
- Constant Field Values
-
VCARD_NAME
public static final String VCARD_NAME
- See Also:
- Constant Field Values
-
VCARD_URL_CLASS
public static final String VCARD_URL_CLASS
- See Also:
- Constant Field Values
-
VCARD_URL_PROPERTY
public static final String VCARD_URL_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
getEnabledProviders
public static Set<String> getEnabledProviders(edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties props)
-
registerProviders
public static void registerProviders(edu.cornell.mannlib.vitro.webapp.config.ConfigurationProperties props)
-
requiredActions
protected edu.cornell.mannlib.vitro.webapp.auth.requestedAction.AuthorizationRequest requiredActions(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq)
Ensure that we can only be called if the user has the correct permissions- Overrides:
requiredActionsin classedu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet- Parameters:
vreq-- Returns:
-
processRequest
protected edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues processRequest(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq)
Main method for the resource claiming (create and link) workflow- Overrides:
processRequestin classedu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet- Parameters:
vreq-- Returns:
-
proposeAuthorToLink
protected void proposeAuthorToLink(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, Citation citation, String profileUri)Method to find an author to propose for linking- Parameters:
vreq-citation-profileUri-
-
getExistingResource
protected org.apache.jena.rdf.model.Model getExistingResource(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, String uri)Find an existing resource in VIVO, and return a Model with the appropriate statements- Parameters:
vreq-uri-- Returns:
-
processRelationships
protected void processRelationships(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Model model, String vivoUri, String userUri, String relationship)Adjust the in-memory model to create the appropriate relationships for the claimed user role (authorship, editorship, etc)- Parameters:
vreq-model-vivoUri-userUri-relationship-
-
removeAuthorship
protected void removeAuthorship(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Model model, String vivoUri, int rank)Removes an existing authorship at a given position, when that position is claimed by the author- Parameters:
model-rank-
-
removeVCard
protected void removeVCard(org.apache.jena.rdf.model.Model model, String vcardUri)Attempt to remove a VCARD from VIVO, ensuring that it is not being used first- Parameters:
model-vcardUri-
-
createVIVOObject
protected String createVIVOObject(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Model model, ResourceModel resourceModel, String typeUri)
Create a new resource in VIVO, based on the values of the intermediate model- Parameters:
vreq-model-resourceModel-- Returns:
-
getPublisherURI
protected String getPublisherURI(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, String publisher)
Get a URI for the publisher object- Parameters:
vreq-publisher-- Returns:
-
getVCardURI
protected String getVCardURI(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, String familyName, String givenName)
Get a URI for a VCARD object- Parameters:
vreq-familyName-givenName-- Returns:
-
addDateToResource
protected boolean addDateToResource(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, org.apache.jena.rdf.model.Resource work, ResourceModel.DateField date)Add a date object to the resource- Parameters:
vreq-work-date-- Returns:
-
findInVIVO
protected String findInVIVO(edu.cornell.mannlib.vitro.webapp.controller.VitroRequest vreq, ExternalIdentifiers ids, String profileUri, Citation citation)
Try to find a resource in VIVO that defines one of the external identifiers- Parameters:
vreq-ids-profileUri-citation-- Returns:
-
isResourceOfType
protected boolean isResourceOfType(org.apache.jena.rdf.model.Resource resource, String typeUri)Check that the resource is declared to be of a particular type- Parameters:
resource-typeUri-- Returns:
-
writeChanges
protected void writeChanges(edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService rdfService, org.apache.jena.rdf.model.Model existingModel, org.apache.jena.rdf.model.Model updatedModel)Determine the difference between the "existing" and "updated" models, and write the changes to VIVO- Parameters:
rdfService-existingModel-updatedModel-
-
-