Class CommunityRestRepository

    • Constructor Detail

      • CommunityRestRepository

        public CommunityRestRepository​(org.dspace.content.service.CommunityService dsoService)
    • Method Detail

      • createAndReturn

        @PreAuthorize("hasAuthority(\'ADMIN\')")
        protected CommunityRest 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<CommunityRest,​UUID>
        Parameters:
        context - the dspace context
        Returns:
        the created REST object
        Throws:
        org.dspace.authorize.AuthorizeException
      • createAndReturn

        @PreAuthorize("hasPermission(#id, \'COMMUNITY\', \'ADD\')")
        protected CommunityRest 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<CommunityRest,​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
      • findOne

        @PreAuthorize("hasPermission(#id, \'COMMUNITY\', \'READ\')")
        public CommunityRest 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<CommunityRest,​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<CommunityRest> 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<CommunityRest,​UUID>
        Parameters:
        context - the dspace context
        pageable - object embedding the requested pagination info
        Returns:
      • findAllTop

        public org.springframework.data.domain.Page<CommunityRest> findAllTop​(org.springframework.data.domain.Pageable pageable)
      • findAdminAuthorized

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

        @PreAuthorize("hasPermission(#id, \'COMMUNITY\', \'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<CommunityRest,​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
      • put

        @PreAuthorize("hasPermission(#id, \'COMMUNITY\', \'WRITE\')")
        protected CommunityRest 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<CommunityRest,​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, \'COMMUNITY\', \'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<CommunityRest,​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.Community community,
                                     org.springframework.web.multipart.MultipartFile uploadfile)
                              throws IOException,
                                     org.dspace.authorize.AuthorizeException,
                                     SQLException
        Method to install a logo on a Community which doesn't have a logo Called by request mappings in CommunityLogoController
        Parameters:
        context -
        community - The community 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
      • createAdminGroup

        public GroupRest createAdminGroup​(org.dspace.core.Context context,
                                          javax.servlet.http.HttpServletRequest request,
                                          org.dspace.content.Community community)
                                   throws SQLException,
                                          org.dspace.authorize.AuthorizeException
        This method will create an AdminGroup for the given Community with the given Information through JSON
        Parameters:
        context - The current context
        request - The current request
        community - The community 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.Community community)
                              throws SQLException,
                                     org.dspace.authorize.AuthorizeException,
                                     IOException
        This method will delete the AdminGroup for the given Community
        Parameters:
        context - The current context
        community - 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