Class WorkspaceItemRestRepository

    • Constructor Detail

      • WorkspaceItemRestRepository

        public WorkspaceItemRestRepository()
                                    throws org.dspace.app.util.SubmissionConfigReaderException
        Throws:
        org.dspace.app.util.SubmissionConfigReaderException
    • Method Detail

      • findOne

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

        @PreAuthorize("hasAuthority(\'ADMIN\')")
        public org.springframework.data.domain.Page<WorkspaceItemRest> 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<WorkspaceItemRest,​Integer>
        Parameters:
        context - the dspace context
        pageable - object embedding the requested pagination info
        Returns:
      • findBySubmitter

        @PreAuthorize("hasPermission(#submitterID, \'EPERSON\', \'READ\')")
        public org.springframework.data.domain.Page<WorkspaceItemRest> findBySubmitter​(UUID submitterID,
                                                                                       org.springframework.data.domain.Pageable pageable)
      • upload

        @PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'WRITE\')")
        public WorkspaceItemRest upload​(javax.servlet.http.HttpServletRequest request,
                                        String apiCategory,
                                        String model,
                                        Integer id,
                                        org.springframework.web.multipart.MultipartFile file)
                                 throws SQLException
        Description copied from class: DSpaceRestRepository
        Method to implement to attach/upload a file to a specific REST object
        Overrides:
        upload in class DSpaceRestRepository<WorkspaceItemRest,​Integer>
        Parameters:
        request - the http request
        id - the ID of the target REST object
        file - the uploaded file
        Returns:
        the new state of the REST object
        Throws:
        SQLException
      • patch

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

        @PreAuthorize("hasPermission(#id, \'WORKSPACEITEM\', \'DELETE\')")
        protected void delete​(org.dspace.core.Context context,
                              Integer 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<WorkspaceItemRest,​Integer>
        Parameters:
        context - the dspace context
        id - the id of the rest object to delete
        Throws:
        org.dspace.authorize.AuthorizeException
      • findByItemUuid

        public WorkspaceItemRest findByItemUuid​(UUID itemUuid,
                                                org.springframework.data.domain.Pageable pageable)
        This is a search method that will return the WorkspaceItemRest object found through the UUID of an item. It'll find the Item through the given UUID and try to resolve the WorkspaceItem relevant for that item and return it. It'll return a 401/403 if the current user isn't allowed to view the WorkspaceItem. It'll return a 204 if nothing was found
        Parameters:
        itemUuid - The UUID for the Item to be used
        pageable - The pageable if present
        Returns:
        The resulting WorkspaceItem object
      • findDomainObjectByPk

        public org.dspace.content.WorkspaceItem findDomainObjectByPk​(org.dspace.core.Context context,
                                                                     Integer id)
                                                              throws SQLException
        Specified by:
        findDomainObjectByPk in interface ReloadableEntityObjectRepository<org.dspace.content.WorkspaceItem,​Integer>
        Parameters:
        context - the DSpace context
        id - the primary key shared between the rest and dspace api object
        Returns:
        the dspace api model object related to the specified id
        Throws:
        SQLException - if a database error occurs