Class CollectionRestRepository

    • Field Detail

      • log

        public static org.apache.logging.log4j.Logger log
    • Constructor Detail

      • CollectionRestRepository

        public CollectionRestRepository​(org.dspace.content.service.CollectionService dsoService)
    • Method Detail

      • findOne

        @PreAuthorize("hasPermission(#id, \'COLLECTION\', \'READ\')")
        public CollectionRest findOne​(org.dspace.core.Context context,
                                      UUID id)
        Description copied from class: DSpaceRestRepository
        Method to implement to support retrieval of a specific REST object instance
        Specified by:
        findOne in class DSpaceRestRepository<CollectionRest,​UUID>
        Parameters:
        context - the dspace context
        id - the rest object id
        Returns:
        the REST object identified by its ID
      • findAll

        public org.springframework.data.domain.Page<CollectionRest> findAll​(org.dspace.core.Context context,
                                                                            org.springframework.data.domain.Pageable pageable)
        Description copied from class: DSpaceRestRepository
        Method to implement to support scroll of entity instances from the collection resource endpoint
        Specified by:
        findAll in class DSpaceRestRepository<CollectionRest,​UUID>
        Parameters:
        context - the dspace context
        pageable - object embedding the requested pagination info
        Returns:
      • findSubmitAuthorizedByCommunity

        public org.springframework.data.domain.Page<CollectionRest> findSubmitAuthorizedByCommunity​(UUID communityUuid,
                                                                                                    org.springframework.data.domain.Pageable pageable,
                                                                                                    String q)
      • findSubmitAuthorized

        public org.springframework.data.domain.Page<CollectionRest> findSubmitAuthorized​(String q,
                                                                                         org.springframework.data.domain.Pageable pageable)
                                                                                  throws org.dspace.discovery.SearchServiceException
        Throws:
        org.dspace.discovery.SearchServiceException
      • findAdminAuthorized

        @PreAuthorize("hasAuthority(\'AUTHENTICATED\')")
        public org.springframework.data.domain.Page<CollectionRest> findAdminAuthorized​(org.springframework.data.domain.Pageable pageable,
                                                                                        String query)
      • patch

        @PreAuthorize("hasPermission(#id, \'COLLECTION\', \'WRITE\')")
        protected void patch​(org.dspace.core.Context context,
                             javax.servlet.http.HttpServletRequest request,
                             String apiCategory,
                             String model,
                             UUID id,
                             Patch patch)
                      throws org.dspace.authorize.AuthorizeException,
                             SQLException
        Description copied from class: DSpaceRestRepository
        Method to implement to allow partial update of the REST object via JSON Patch
        Overrides:
        patch in class DSpaceRestRepository<CollectionRest,​UUID>
        request - the http request
        id - the ID of the target REST object
        patch - the JSON Patch (https://tools.ietf.org/html/rfc6902) operation
        Throws:
        org.dspace.authorize.AuthorizeException
        SQLException
      • createAndReturn

        protected CollectionRest createAndReturn​(org.dspace.core.Context context)
                                          throws org.dspace.authorize.AuthorizeException
        Description copied from class: DSpaceRestRepository
        Method to implement to support the creation of a new instance. Usually require to retrieve the http request from the thread bound attribute
        Overrides:
        createAndReturn in class DSpaceRestRepository<CollectionRest,​UUID>
        Parameters:
        context - the dspace context
        Returns:
        the created REST object
        Throws:
        org.dspace.authorize.AuthorizeException
      • createAndReturn

        @PreAuthorize("hasPermission(#id, \'COMMUNITY\', \'ADD\')")
        protected CollectionRest createAndReturn​(org.dspace.core.Context context,
                                                 UUID id)
                                          throws org.dspace.authorize.AuthorizeException
        Description copied from class: DSpaceRestRepository
        Method to implement to support the creation of a new instance. Usually require to retrieve the http request from the thread bound attribute
        Overrides:
        createAndReturn in class DSpaceRestRepository<CollectionRest,​UUID>
        Parameters:
        context - the dspace context
        id - The uuid of the parent object retrieved from the query param.
        Returns:
        the created REST object
        Throws:
        org.dspace.authorize.AuthorizeException
      • put

        @PreAuthorize("hasPermission(#id, \'COLLECTION\', \'WRITE\')")
        protected CollectionRest put​(org.dspace.core.Context context,
                                     javax.servlet.http.HttpServletRequest request,
                                     String apiCategory,
                                     String model,
                                     UUID id,
                                     com.fasterxml.jackson.databind.JsonNode jsonNode)
                              throws RepositoryMethodNotImplementedException,
                                     SQLException,
                                     org.dspace.authorize.AuthorizeException
        Description copied from class: DSpaceRestRepository
        Implement this method in the subclass to support updating a REST object.
        Overrides:
        put in class DSpaceRestRepository<CollectionRest,​UUID>
        Parameters:
        context - the dspace context
        apiCategory - the API category e.g. "api"
        model - the DSpace model e.g. "metadatafield"
        id - the ID of the target REST object
        jsonNode - the part of the request body representing the updated rest object
        Returns:
        the updated REST object
        Throws:
        RepositoryMethodNotImplementedException - returned by the default implementation when the operation is not supported for the entity
        SQLException - when the database returns an error
        org.dspace.authorize.AuthorizeException - if the context user is not authorized to perform this operation
      • delete

        @PreAuthorize("hasPermission(#id, \'COLLECTION\', \'DELETE\')")
        protected void delete​(org.dspace.core.Context context,
                              UUID id)
                       throws org.dspace.authorize.AuthorizeException
        Description copied from class: DSpaceRestRepository
        Method to implement to support delete of a single object instance
        Overrides:
        delete in class DSpaceRestRepository<CollectionRest,​UUID>
        Parameters:
        context - the dspace context
        id - the id of the rest object to delete
        Throws:
        org.dspace.authorize.AuthorizeException
      • setLogo

        public BitstreamRest setLogo​(org.dspace.core.Context context,
                                     org.dspace.content.Collection collection,
                                     org.springframework.web.multipart.MultipartFile uploadfile)
                              throws IOException,
                                     org.dspace.authorize.AuthorizeException,
                                     SQLException
        Method to install a logo on a Collection which doesn't have a logo Called by request mappings in CollectionLogoController
        Parameters:
        context -
        collection - The collection on which to install the logo
        uploadfile - The new logo
        Returns:
        The created bitstream containing the new logo
        Throws:
        IOException
        org.dspace.authorize.AuthorizeException
        SQLException
      • createTemplateItem

        public TemplateItemRest createTemplateItem​(org.dspace.core.Context context,
                                                   org.dspace.content.Collection collection,
                                                   TemplateItemRest inputItemRest)
                                            throws SQLException,
                                                   org.dspace.authorize.AuthorizeException
        This method creates a new Item to be used as a template in a Collection
        Parameters:
        context -
        collection - The collection for which to make the item
        inputItemRest - The new item
        Returns:
        The created TemplateItem
        Throws:
        SQLException
        org.dspace.authorize.AuthorizeException
      • getTemplateItem

        public TemplateItemRest getTemplateItem​(org.dspace.content.Collection collection)
                                         throws SQLException
        This method looks up the template Item associated with a Collection
        Parameters:
        collection - The Collection for which to find the template
        Returns:
        The template Item from the Collection
        Throws:
        SQLException
      • createAdminGroup

        public GroupRest createAdminGroup​(org.dspace.core.Context context,
                                          javax.servlet.http.HttpServletRequest request,
                                          org.dspace.content.Collection collection)
                                   throws SQLException,
                                          org.dspace.authorize.AuthorizeException
        This method will create an AdminGroup for the given Collection with the given Information through JSON
        Parameters:
        context - The current context
        request - The current request
        collection - The collection for which we'll create an admingroup
        Returns:
        The created AdminGroup's REST object
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
      • deleteAdminGroup

        public void deleteAdminGroup​(org.dspace.core.Context context,
                                     org.dspace.content.Collection collection)
                              throws SQLException,
                                     org.dspace.authorize.AuthorizeException,
                                     IOException
        This method will delete the AdminGroup for the given Collection
        Parameters:
        context - The current context
        collection - The community for which we'll delete the admingroup
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        IOException - If something goes wrong
      • createSubmitterGroup

        public GroupRest createSubmitterGroup​(org.dspace.core.Context context,
                                              javax.servlet.http.HttpServletRequest request,
                                              org.dspace.content.Collection collection)
                                       throws SQLException,
                                              org.dspace.authorize.AuthorizeException
        This method will create a SubmitterGroup for the given Collection with the given Information through JSON
        Parameters:
        context - The current context
        request - The current request
        collection - The collection for which we'll create a submittergroup
        Returns:
        The created SubmitterGroup's REST object
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
      • deleteSubmitterGroup

        public void deleteSubmitterGroup​(org.dspace.core.Context context,
                                         org.dspace.content.Collection collection)
                                  throws SQLException,
                                         org.dspace.authorize.AuthorizeException,
                                         IOException
        This method will delete the SubmitterGroup for the given Collection
        Parameters:
        context - The current context
        collection - The community for which we'll delete the submittergroup
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        IOException - If something goes wrong
      • createItemReadGroup

        public GroupRest createItemReadGroup​(org.dspace.core.Context context,
                                             javax.servlet.http.HttpServletRequest request,
                                             org.dspace.content.Collection collection)
                                      throws SQLException,
                                             org.dspace.authorize.AuthorizeException
        This method will create an ItemReadGroup for the given Collection with the given Information through JSON
        Parameters:
        context - The current context
        request - The current request
        collection - The collection for which we'll create an ItemReadGroup
        Returns:
        The created ItemReadGroup's REST object
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
      • deleteItemReadGroup

        public void deleteItemReadGroup​(org.dspace.core.Context context,
                                        org.dspace.content.Collection collection)
                                 throws SQLException,
                                        org.dspace.authorize.AuthorizeException,
                                        IOException
        This method will delete the ItemReadGroup for the given Collection
        Parameters:
        context - The current context
        collection - The community for which we'll delete the ItemReadGroup
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        IOException - If something goes wrong
      • createBitstreamReadGroup

        public GroupRest createBitstreamReadGroup​(org.dspace.core.Context context,
                                                  javax.servlet.http.HttpServletRequest request,
                                                  org.dspace.content.Collection collection)
                                           throws SQLException,
                                                  org.dspace.authorize.AuthorizeException
        This method will create an BitstreamReadGroup for the given Collection with the given Information through JSON
        Parameters:
        context - The current context
        request - The current request
        collection - The collection for which we'll create an BitstreamReadGroup
        Returns:
        The created BitstreamReadGroup's REST object
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
      • deleteBitstreamReadGroup

        public void deleteBitstreamReadGroup​(org.dspace.core.Context context,
                                             org.dspace.content.Collection collection)
                                      throws SQLException,
                                             org.dspace.authorize.AuthorizeException,
                                             IOException
        This method will delete the BitstreamReadGroup for the given Collection
        Parameters:
        context - The current context
        collection - The community for which we'll delete the BitstreamReadGroup
        Throws:
        SQLException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        IOException - If something goes wrong
      • getWorkflowGroupForRole

        public GroupRest getWorkflowGroupForRole​(org.dspace.core.Context context,
                                                 org.dspace.content.Collection collection,
                                                 String workflowRole)
                                          throws SQLException,
                                                 IOException,
                                                 org.dspace.xmlworkflow.WorkflowConfigurationException,
                                                 org.dspace.authorize.AuthorizeException,
                                                 org.dspace.workflow.WorkflowException
        This method will retrieve the GroupRest object for the workflowGroup for the given Collection and workflowRole
        Parameters:
        context - The relevant DSpace context
        collection - The given collection
        workflowRole - The given workflowRole
        Returns:
        The GroupRest for the WorkflowGroup for the given Collection and workflowRole
        Throws:
        SQLException - If something goes wrong
        IOException - If something goes wrong
        org.dspace.xmlworkflow.WorkflowConfigurationException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        org.dspace.workflow.WorkflowException - If something goes wrong
      • createWorkflowGroupForRole

        public GroupRest createWorkflowGroupForRole​(org.dspace.core.Context context,
                                                    javax.servlet.http.HttpServletRequest request,
                                                    org.dspace.content.Collection collection,
                                                    String workflowRole)
                                             throws SQLException,
                                                    org.dspace.xmlworkflow.WorkflowConfigurationException,
                                                    org.dspace.authorize.AuthorizeException,
                                                    org.dspace.workflow.WorkflowException,
                                                    IOException
        This method will create the WorkflowGroup for the given Collection and workflowRole
        Parameters:
        context - The relevant DSpace context
        request - The current request
        collection - The given collection
        workflowRole - The given workflowRole
        Returns:
        The created WorkflowGroup for the given Collection and workflowRole
        Throws:
        SQLException - If something goes wrong
        org.dspace.xmlworkflow.WorkflowConfigurationException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        org.dspace.workflow.WorkflowException - If something goes wrong
        IOException - If something goes wrong
      • deleteWorkflowGroupForRole

        public void deleteWorkflowGroupForRole​(org.dspace.core.Context context,
                                               javax.servlet.http.HttpServletRequest request,
                                               org.dspace.content.Collection collection,
                                               String workflowRole)
                                        throws SQLException,
                                               org.dspace.xmlworkflow.WorkflowConfigurationException,
                                               org.dspace.authorize.AuthorizeException,
                                               org.dspace.workflow.WorkflowException,
                                               IOException
        This method will delete the WorkflowGroup for a given Collection and workflowRole
        Parameters:
        context - The relevant DSpace context
        request - The current DSpace request
        collection - The given Collection
        workflowRole - The given WorkflowRole
        Throws:
        SQLException - If something goes wrong
        org.dspace.xmlworkflow.WorkflowConfigurationException - If something goes wrong
        org.dspace.authorize.AuthorizeException - If something goes wrong
        org.dspace.workflow.WorkflowException - If something goes wrong
        IOException - If something goes wrong