Interface CommunityService

    • Method Detail

      • create

        Community create​(Community parent,
                         Context context,
                         String handle,
                         UUID uuid)
                  throws SQLException,
                         AuthorizeException
        Create a new top-level community, with a new ID.
        Parameters:
        parent - parent community
        context - DSpace context object
        handle - the pre-determined Handle to assign to the new community
        uuid - the pre-determined uuid to assign to the new community
        Returns:
        the newly created community
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • findAll

        List<Community> findAll​(Context context)
                         throws SQLException
        Get a list of all communities in the system. These are alphabetically sorted by community name.
        Parameters:
        context - DSpace context object
        Returns:
        the communities in the system
        Throws:
        SQLException - if database error
      • findAll

        List<Community> findAll​(Context context,
                                Integer limit,
                                Integer offset)
                         throws SQLException
        Get all communities in the system. Adds support for limit and offset.
        Parameters:
        context - context
        limit - limit
        offset - offset
        Returns:
        list of communities
        Throws:
        SQLException - if database error
      • findAllTop

        List<Community> findAllTop​(Context context)
                            throws SQLException
        Get a list of all top-level communities in the system. These are alphabetically sorted by community name. A top-level community is one without a parent community.
        Parameters:
        context - DSpace context object
        Returns:
        the top-level communities in the system
        Throws:
        SQLException - if database error
      • setLogo

        Bitstream setLogo​(Context context,
                          Community community,
                          InputStream is)
                   throws AuthorizeException,
                          IOException,
                          SQLException
        Give the community a logo. Passing in null removes any existing logo. You will need to set the format of the new logo bitstream before it will work, for example to "JPEG". Note that update will need to be called for the change to take effect. Setting a logo and not calling update later may result in a previous logo lying around as an "orphaned" bitstream.
        Parameters:
        context - context
        community - community
        is - the stream to use as the new logo
        Returns:
        the new logo bitstream, or null if there is no logo (null was passed in)
        Throws:
        IOException - if IO error
        SQLException - if database error
        AuthorizeException - if authorization error
      • createAdministrators

        Group createAdministrators​(Context context,
                                   Community community)
                            throws SQLException,
                                   AuthorizeException
        Create a default administrators group if one does not already exist. Returns either the newly created group or the previously existing one. Note that other groups may also be administrators.
        Parameters:
        context - context
        community - community
        Returns:
        the default group of editors associated with this community
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • removeAdministrators

        void removeAdministrators​(Context context,
                                  Community community)
                           throws SQLException,
                                  AuthorizeException
        Remove the administrators group, if no group has already been created then return without error. This will merely dereference the current administrators group from the community so that it may be deleted without violating database constraints.
        Parameters:
        context - context
        community - community
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • getAllParents

        List<Community> getAllParents​(Context context,
                                      Community community)
                               throws SQLException
        Return an array of parent communities of this community, in ascending order. If community is top-level, return an empty array.
        Parameters:
        context - context
        community - community
        Returns:
        an array of parent communities, empty if top-level
        Throws:
        SQLException - if database error
      • getAllParents

        List<Community> getAllParents​(Context context,
                                      Collection collection)
                               throws SQLException
        Return an array of parent communities of this collection.
        Parameters:
        context - The relevant DSpace Context.
        collection - collection to check
        Returns:
        an array of parent communities
        Throws:
        SQLException - if database error
      • getAllCollections

        List<Collection> getAllCollections​(Context context,
                                           Community community)
                                    throws SQLException
        Return an array of collections of this community and its subcommunities
        Parameters:
        context - context
        community - community
        Returns:
        an array of collections
        Throws:
        SQLException - if database error
      • createSubcommunity

        Community createSubcommunity​(Context context,
                                     Community parentCommunity,
                                     String handle,
                                     UUID uuid)
                              throws SQLException,
                                     AuthorizeException
        Create a new sub-community within this community.
        Parameters:
        context - context
        handle - the pre-determined Handle to assign to the new community
        parentCommunity - parent community
        uuid - the pre-determined UUID to assign to the new community
        Returns:
        the new community
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • addSubcommunity

        void addSubcommunity​(Context context,
                             Community parentCommunity,
                             Community childCommunity)
                      throws SQLException,
                             AuthorizeException
        Add an existing community as a subcommunity to the community
        Parameters:
        context - context
        parentCommunity - parent community to add our subcommunity to
        childCommunity - subcommunity to add
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • removeSubcommunity

        void removeSubcommunity​(Context context,
                                Community parentCommunity,
                                Community childCommunity)
                         throws SQLException,
                                AuthorizeException,
                                IOException
        Remove a subcommunity. If it only belongs to one parent community, then it is permanently deleted. If it has more than one parent community, it is simply unmapped from the current community.
        Parameters:
        context - context
        childCommunity - subcommunity to remove
        parentCommunity - parent community
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
        IOException - if IO error
      • canEditBoolean

        boolean canEditBoolean​(Context context,
                               Community community)
                        throws SQLException
        return TRUE if context's user can edit community, false otherwise
        Parameters:
        context - context
        community - community
        Returns:
        boolean true = current user can edit community
        Throws:
        SQLException - if database error
      • countArchivedItems

        int countArchivedItems​(Community community)
                        throws ItemCountException
        Returns total community archived items
        Parameters:
        community - Community
        Returns:
        total community archived items
        Throws:
        ItemCountException