Class ItemServiceImpl

    • Field Detail

      • itemDAO

        @Autowired(required=true)
        protected ItemDAO itemDAO
      • communityService

        @Autowired(required=true)
        protected CommunityService communityService
      • groupService

        @Autowired(required=true)
        protected GroupService groupService
      • authorizeService

        @Autowired(required=true)
        protected AuthorizeService authorizeService
      • bundleService

        @Autowired(required=true)
        protected BundleService bundleService
      • bitstreamService

        @Autowired(required=true)
        protected BitstreamService bitstreamService
      • installItemService

        @Autowired(required=true)
        protected InstallItemService installItemService
      • searchService

        @Autowired(required=true)
        protected SearchService searchService
      • collectionService

        @Autowired(required=true)
        protected CollectionService collectionService
      • identifierService

        @Autowired(required=true)
        protected IdentifierService identifierService
      • doiService

        @Autowired(required=true)
        protected DOIService doiService
      • versioningService

        @Autowired(required=true)
        protected VersioningService versioningService
      • harvestedItemService

        @Autowired(required=true)
        protected HarvestedItemService harvestedItemService
      • configurationService

        @Autowired(required=true)
        protected ConfigurationService configurationService
      • workspaceItemService

        @Autowired(required=true)
        protected WorkspaceItemService workspaceItemService
      • workflowItemService

        @Autowired(required=true)
        protected WorkflowItemService workflowItemService
      • relationshipService

        @Autowired(required=true)
        protected RelationshipService relationshipService
      • subscribeService

        @Autowired(required=true)
        protected SubscribeService subscribeService
    • Constructor Detail

      • ItemServiceImpl

        protected ItemServiceImpl()
    • Method Detail

      • find

        public Item find​(Context context,
                         UUID id)
                  throws SQLException
        Description copied from interface: DSpaceObjectService
        Generic find for when the precise type of an Entity is not known
        Specified by:
        find in interface DSpaceObjectService<Item>
        Parameters:
        context - - the context
        id - - uuid within table of typed dspace objects
        Returns:
        the dspace object found, or null if it does not exist.
        Throws:
        SQLException - only upon failure accessing the database.
      • createTemplateItem

        public Item createTemplateItem​(Context context,
                                       Collection collection)
                                throws SQLException,
                                       AuthorizeException
        Description copied from interface: ItemService
        Create an empty template item for this collection. If one already exists, no action is taken. Caution: Make sure you call update on the collection after doing this, or the item will have been created but the collection record will not refer to it.
        Specified by:
        createTemplateItem in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        Returns:
        empty template item for this collection
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • findAll

        public Iterator<Item> findAll​(Context context)
                               throws SQLException
        Description copied from interface: ItemService
        Get all the items in the archive. Only items with the "in archive" flag set are included. The order of the list is indeterminate.
        Specified by:
        findAll in interface ItemService
        Parameters:
        context - DSpace context object
        Returns:
        an iterator over the items in the archive.
        Throws:
        SQLException - if database error
      • findAll

        public Iterator<Item> findAll​(Context context,
                                      Integer limit,
                                      Integer offset)
                               throws SQLException
        Description copied from interface: ItemService
        Get all the items in the archive. Only items with the "in archive" flag set are included. The order of the list is indeterminate.
        Specified by:
        findAll in interface ItemService
        Parameters:
        context - DSpace context object
        limit - limit
        offset - offset
        Returns:
        an iterator over the items in the archive.
        Throws:
        SQLException - if database error
      • findAllUnfiltered

        public Iterator<Item> findAllUnfiltered​(Context context)
                                         throws SQLException
        Description copied from interface: ItemService
        Get all "final" items in the archive, both archived ("in archive" flag) or withdrawn items are included. The order of the list is indeterminate.
        Specified by:
        findAllUnfiltered in interface ItemService
        Parameters:
        context - DSpace context object
        Returns:
        an iterator over the items in the archive.
        Throws:
        SQLException - if database error
      • findAllRegularItems

        public Iterator<Item> findAllRegularItems​(Context context)
                                           throws SQLException
        Description copied from interface: ItemService
        Find all items that are: - NOT in the workspace - NOT in the workflow - NOT a template item for e.g. a collection This implies that the result also contains older versions of items and withdrawn items.
        Specified by:
        findAllRegularItems in interface ItemService
        Parameters:
        context - the DSpace context.
        Returns:
        iterator over all regular items.
        Throws:
        SQLException - if database error.
      • findBySubmitter

        public Iterator<Item> findBySubmitter​(Context context,
                                              EPerson eperson)
                                       throws SQLException
        Description copied from interface: ItemService
        Find all the items in the archive by a given submitter. The order is indeterminate. Only items with the "in archive" flag set are included.
        Specified by:
        findBySubmitter in interface ItemService
        Parameters:
        context - DSpace context object
        eperson - the submitter
        Returns:
        an iterator over the items submitted by eperson
        Throws:
        SQLException - if database error
      • findBySubmitter

        public Iterator<Item> findBySubmitter​(Context context,
                                              EPerson eperson,
                                              boolean retrieveAllItems)
                                       throws SQLException
        Description copied from interface: ItemService
        Find all the items by a given submitter. The order is indeterminate. All items are included.
        Specified by:
        findBySubmitter in interface ItemService
        Parameters:
        context - DSpace context object
        eperson - the submitter
        retrieveAllItems - flag to determine if all items should be returned or only archived items. If true, all items (regardless of status) are returned. If false, only archived items will be returned.
        Returns:
        an iterator over the items submitted by eperson
        Throws:
        SQLException - if database error
      • findBySubmitterDateSorted

        public Iterator<Item> findBySubmitterDateSorted​(Context context,
                                                        EPerson eperson,
                                                        Integer limit)
                                                 throws SQLException
        Description copied from interface: ItemService
        Retrieve the list of items submitted by eperson, ordered by recently submitted, optionally limitable
        Specified by:
        findBySubmitterDateSorted in interface ItemService
        Parameters:
        context - DSpace context object
        eperson - the submitter
        limit - a positive integer to limit, -1 or null for unlimited
        Returns:
        an iterator over the items submitted by eperson
        Throws:
        SQLException - if database error
      • findByCollection

        public Iterator<Item> findByCollection​(Context context,
                                               Collection collection)
                                        throws SQLException
        Description copied from interface: ItemService
        Get all the archived items in this collection. The order is indeterminate.
        Specified by:
        findByCollection in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • findByCollection

        public Iterator<Item> findByCollection​(Context context,
                                               Collection collection,
                                               Integer limit,
                                               Integer offset)
                                        throws SQLException
        Description copied from interface: ItemService
        Get all the archived items in this collection. The order is indeterminate.
        Specified by:
        findByCollection in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        limit - limited number of items
        offset - offset value
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • findByCollectionMapping

        public Iterator<Item> findByCollectionMapping​(Context context,
                                                      Collection collection,
                                                      Integer limit,
                                                      Integer offset)
                                               throws SQLException
        Description copied from interface: ItemService
        Get all the archived items mapped to this collection (excludes owning collection). The order is indeterminate.
        Specified by:
        findByCollectionMapping in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        limit - limited number of items
        offset - offset value
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • countByCollectionMapping

        public int countByCollectionMapping​(Context context,
                                            Collection collection)
                                     throws SQLException
        Description copied from interface: ItemService
        Count all the archived items mapped to this collection (excludes owning collection). The order is indeterminate.
        Specified by:
        countByCollectionMapping in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • findAllByCollection

        public Iterator<Item> findAllByCollection​(Context context,
                                                  Collection collection)
                                           throws SQLException
        Description copied from interface: ItemService
        Get all the items (including private and withdrawn) in this collection. The order is indeterminate.
        Specified by:
        findAllByCollection in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • findAllByCollection

        public Iterator<Item> findAllByCollection​(Context context,
                                                  Collection collection,
                                                  Integer limit,
                                                  Integer offset)
                                           throws SQLException
        Description copied from interface: ItemService
        Get all the items (including private and withdrawn) in this collection. The order is indeterminate.
        Specified by:
        findAllByCollection in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection (parent)
        limit - limited number of items
        offset - offset value
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • findInArchiveOrWithdrawnDiscoverableModifiedSince

        public Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince​(Context context,
                                                                                Date since)
                                                                         throws SQLException
        Description copied from interface: ItemService
        Get all Items installed or withdrawn, discoverable, and modified since a Date.
        Specified by:
        findInArchiveOrWithdrawnDiscoverableModifiedSince in interface ItemService
        Parameters:
        context - DSpace context object
        since - earliest interesting last-modified date, or null for no date test.
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • findInArchiveOrWithdrawnNonDiscoverableModifiedSince

        public Iterator<Item> findInArchiveOrWithdrawnNonDiscoverableModifiedSince​(Context context,
                                                                                   Date since)
                                                                            throws SQLException
        Description copied from interface: ItemService
        Get all Items installed or withdrawn, NON-discoverable, and modified since a Date.
        Specified by:
        findInArchiveOrWithdrawnNonDiscoverableModifiedSince in interface ItemService
        Parameters:
        context - context
        since - earliest interesting last-modified date, or null for no date test.
        Returns:
        an iterator over the items in the collection.
        Throws:
        SQLException - if database error
      • isIn

        public boolean isIn​(Item item,
                            Collection collection)
                     throws SQLException
        Description copied from interface: ItemService
        See whether this Item is contained by a given Collection.
        Specified by:
        isIn in interface ItemService
        Parameters:
        item - item to check
        collection - Collection (parent
        Returns:
        true if collection contains this Item.
        Throws:
        SQLException - if database error
      • getCommunities

        public List<Community> getCommunities​(Context context,
                                              Item item)
                                       throws SQLException
        Description copied from interface: ItemService
        Get the communities this item is in. Returns an unordered array of the communities that house the collections this item is in, including parent communities of the owning collections.
        Specified by:
        getCommunities in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        the communities this item is in.
        Throws:
        SQLException - if database error
      • getBundles

        public List<Bundle> getBundles​(Item item,
                                       String name)
                                throws SQLException
        Description copied from interface: ItemService
        Get the bundles matching a bundle name (name corresponds roughly to type)
        Specified by:
        getBundles in interface ItemService
        Parameters:
        item - item to check
        name - name of bundle (ORIGINAL/TEXT/THUMBNAIL)
        Returns:
        the bundles in an unordered array
        Throws:
        SQLException - if database error
      • getNonInternalBitstreams

        public List<Bitstream> getNonInternalBitstreams​(Context context,
                                                        Item item)
                                                 throws SQLException
        Description copied from interface: ItemService
        Get all non-internal bitstreams in the item. This is mainly used for auditing for provenance messages and adding format.* DC values. The order is indeterminate.
        Specified by:
        getNonInternalBitstreams in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        non-internal bitstreams.
        Throws:
        SQLException - if database error
      • removeDSpaceLicense

        public void removeDSpaceLicense​(Context context,
                                        Item item)
                                 throws SQLException,
                                        AuthorizeException,
                                        IOException
        Description copied from interface: ItemService
        Remove just the DSpace license from an item This is useful to update the current DSpace license, in case the user must accept the DSpace license again (either the item was rejected, or resumed after saving)

        This method is used by the org.dspace.submit.step.LicenseStep class

        Specified by:
        removeDSpaceLicense in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to remove DSpace license from
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
        IOException - if IO error
      • isOwningCollection

        public boolean isOwningCollection​(Item item,
                                          Collection collection)
        Description copied from interface: ItemService
        Return true if this Collection 'owns' this item
        Specified by:
        isOwningCollection in interface ItemService
        Parameters:
        item - item to check
        collection - Collection
        Returns:
        true if this Collection owns this item
      • inheritCollectionDefaultPolicies

        public void inheritCollectionDefaultPolicies​(Context context,
                                                     Item item,
                                                     Collection collection)
                                              throws SQLException,
                                                     AuthorizeException
        Description copied from interface: ItemService
        Remove all policies on an item and its contents, and replace them with the DEFAULT_ITEM_READ and DEFAULT_BITSTREAM_READ policies belonging to the collection.
        Specified by:
        inheritCollectionDefaultPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to reset policies on
        collection - Collection
        Throws:
        SQLException - if database error if an SQL error or if no default policies found. It's a bit draconian, but default policies must be enforced.
        AuthorizeException - if authorization error
      • inheritCollectionDefaultPolicies

        public void inheritCollectionDefaultPolicies​(Context context,
                                                     Item item,
                                                     Collection collection,
                                                     boolean replaceReadRPWithCollectionRP)
                                              throws SQLException,
                                                     AuthorizeException
        Description copied from interface: ItemService
        Remove all submission and workflow policies on an item and its contents, and add default collection policies which are not yet already in place. If overrideItemReadPolicies is true, then all read policies on the item are replaced (but only if the collection has a default read policy).
        Specified by:
        inheritCollectionDefaultPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to reset policies on
        collection - Collection
        replaceReadRPWithCollectionRP - if true, all read policies on the item are replaced (but only if the collection has a default read policy)
        Throws:
        SQLException - if database error if an SQL error or if no default policies found. It's a bit draconian, but default policies must be enforced.
        AuthorizeException - if authorization error
      • adjustBundleBitstreamPolicies

        public void adjustBundleBitstreamPolicies​(Context context,
                                                  Item item,
                                                  Collection collection)
                                           throws SQLException,
                                                  AuthorizeException
        Description copied from interface: ItemService
        Adjust the Bundle and Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bundle/bitstream only if no explicit custom policies were already applied to the bundle/bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property
        Specified by:
        adjustBundleBitstreamPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustBundleBitstreamPolicies

        public void adjustBundleBitstreamPolicies​(Context context,
                                                  Item item,
                                                  Collection collection,
                                                  boolean replaceReadRPWithCollectionRP)
                                           throws SQLException,
                                                  AuthorizeException
        Description copied from interface: ItemService
        Adjust the Bundle and Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bundle/bitstream only if no explicit custom policies were already applied to the bundle/bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property
        Specified by:
        adjustBundleBitstreamPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        replaceReadRPWithCollectionRP - if true, all read policies on the item are replaced (but only if the collection has a default read policy)
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustBitstreamPolicies

        public void adjustBitstreamPolicies​(Context context,
                                            Item item,
                                            Collection collection,
                                            Bitstream bitstream)
                                     throws SQLException,
                                            AuthorizeException
        Description copied from interface: ItemService
        Adjust the Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bitstream only if no explicit custom policies were already applied to the bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property
        Specified by:
        adjustBitstreamPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        bitstream - Bitstream to adjust policies on
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustBitstreamPolicies

        public void adjustBitstreamPolicies​(Context context,
                                            Item item,
                                            Collection collection,
                                            Bitstream bitstream,
                                            boolean replaceReadRPWithCollectionRP)
                                     throws SQLException,
                                            AuthorizeException
        Description copied from interface: ItemService
        Adjust the Bitstream policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the policies defined at the item and collection level are copied and inherited as appropriate. Custom selected Item policies are copied to the bitstream only if no explicit custom policies were already applied to the bitstream. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property
        Specified by:
        adjustBitstreamPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        bitstream - Bitstream to adjust policies on
        replaceReadRPWithCollectionRP - If true, all read policies on the bitstream are replaced (but only if the collection has a default read policy)
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustItemPolicies

        public void adjustItemPolicies​(Context context,
                                       Item item,
                                       Collection collection)
                                throws SQLException,
                                       AuthorizeException
        Description copied from interface: ItemService
        Adjust the Item's policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the default policies defined at the collection level are inherited as appropriate. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property
        Specified by:
        adjustItemPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustItemPolicies

        public void adjustItemPolicies​(Context context,
                                       Item item,
                                       Collection collection,
                                       boolean replaceReadRPWithCollectionRP)
                                throws SQLException,
                                       AuthorizeException
        Description copied from interface: ItemService
        Adjust the Item's policies to reflect what have been defined during the submission/workflow. The temporary SUBMISSION and WORKFLOW policies are removed and the default policies defined at the collection level are inherited as appropriate. Collection's policies are inherited if there are no other policies defined or if the append mode is defined by the configuration via the core.authorization.installitem.inheritance-read.append-mode property
        Specified by:
        adjustItemPolicies in interface ItemService
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        replaceReadRPWithCollectionRP - If true, all read policies on the item are replaced (but only if the collection has a default read policy)
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • hasUploadedFiles

        public boolean hasUploadedFiles​(Item item)
                                 throws SQLException
        Description copied from interface: ItemService
        Check the bundle ORIGINAL to see if there are any uploaded files
        Specified by:
        hasUploadedFiles in interface ItemService
        Parameters:
        item - item to check
        Returns:
        true if there is a bundle named ORIGINAL with one or more bitstreams inside
        Throws:
        SQLException - if database error
      • canEdit

        public boolean canEdit​(Context context,
                               Item item)
                        throws SQLException
        Description copied from interface: ItemService
        return TRUE if context's user can edit item, false otherwise
        Specified by:
        canEdit in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        boolean true = current user can edit item
        Throws:
        SQLException - if database error
      • isInProgressSubmission

        public boolean isInProgressSubmission​(Context context,
                                              Item item)
                                       throws SQLException
        Check if the item is an inprogress submission
        Specified by:
        isInProgressSubmission in interface ItemService
        Parameters:
        context - The relevant DSpace Context.
        item - item to check
        Returns:
        true if the item is an inprogress submission, i.e. a WorkspaceItem or WorkflowItem
        Throws:
        SQLException - An exception that provides information on a database access error or other errors.
      • addDefaultPoliciesNotInPlace

        protected void addDefaultPoliciesNotInPlace​(Context context,
                                                    DSpaceObject dso,
                                                    List<ResourcePolicy> defaultCollectionPolicies)
                                             throws SQLException,
                                                    AuthorizeException
        Add the default policies, which have not been already added to the given DSpace object
        Parameters:
        context - The relevant DSpace Context.
        dso - The DSpace Object to add policies to
        defaultCollectionPolicies - list of policies
        Throws:
        SQLException - An exception that provides information on a database access error or other errors.
        AuthorizeException - Exception indicating the current user of the context does not have permission to perform a particular action.
      • findArchivedByMetadataField

        public Iterator<Item> findArchivedByMetadataField​(Context context,
                                                          String schema,
                                                          String element,
                                                          String qualifier,
                                                          String value)
                                                   throws SQLException,
                                                          AuthorizeException
        Returns an iterator of Items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANY
        Specified by:
        findArchivedByMetadataField in interface ItemService
        Parameters:
        context - DSpace context object
        schema - metadata field schema
        element - metadata field element
        qualifier - metadata field qualifier
        value - field value or Item.ANY to match any value
        Returns:
        an iterator over the items matching that authority value
        Throws:
        SQLException - if database error An exception that provides information on a database access error or other errors.
        AuthorizeException - if authorization error Exception indicating the current user of the context does not have permission to perform a particular action.
      • findArchivedByMetadataField

        public Iterator<Item> findArchivedByMetadataField​(Context context,
                                                          String metadataField,
                                                          String value)
                                                   throws SQLException,
                                                          AuthorizeException
        Description copied from interface: ItemService
        Returns an iterator of in archive items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANY
        Specified by:
        findArchivedByMetadataField in interface ItemService
        Parameters:
        context - DSpace context object
        metadataField - metadata
        value - field value or Item.ANY to match any value
        Returns:
        an iterator over the items matching that authority value
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • findByMetadataField

        public Iterator<Item> findByMetadataField​(Context context,
                                                  String schema,
                                                  String element,
                                                  String qualifier,
                                                  String value)
                                           throws SQLException,
                                                  AuthorizeException,
                                                  IOException
        Returns an iterator of Items possessing the passed metadata field, or only those matching the passed value, if value is not Item.ANY
        Specified by:
        findByMetadataField in interface ItemService
        Parameters:
        context - DSpace context object
        schema - metadata field schema
        element - metadata field element
        qualifier - metadata field qualifier
        value - field value or Item.ANY to match any value
        Returns:
        an iterator over the items matching that authority value
        Throws:
        SQLException - if database error An exception that provides information on a database access error or other errors.
        AuthorizeException - if authorization error Exception indicating the current user of the context does not have permission to perform a particular action.
        IOException - if IO error A general class of exceptions produced by failed or interrupted I/O operations.
      • getAdminObject

        public DSpaceObject getAdminObject​(Context context,
                                           Item item,
                                           int action)
                                    throws SQLException
        Description copied from interface: DSpaceObjectService
        Return the dspace object where an ADMIN action right is sufficient to grant the initial authorize check.

        Default behaviour is ADMIN right on the object grant right on all other action on the object itself. Subclass should override this method as needed.

        Specified by:
        getAdminObject in interface DSpaceObjectService<Item>
        Overrides:
        getAdminObject in class DSpaceObjectServiceImpl<Item>
        Parameters:
        context - DSpace context
        item - DSpaceObject
        action - ID of action being attempted, from org.dspace.core.Constants. The ADMIN action is not a valid parameter for this method, an IllegalArgumentException should be thrown
        Returns:
        the dspace object, if any, where an ADMIN action is sufficient to grant the original action
        Throws:
        SQLException - if database error
      • getParentObject

        public DSpaceObject getParentObject​(Context context,
                                            Item item)
                                     throws SQLException
        Description copied from interface: DSpaceObjectService
        Return the dspace object that "own" the current object in the hierarchy. Note that this method has a meaning slightly different from the getAdminObject because it is independent of the action but it is in a way related to it. It defines the "first" dspace object OTHER then the current one, where allowed ADMIN actions imply allowed ADMIN actions on the object self.
        Specified by:
        getParentObject in interface DSpaceObjectService<Item>
        Overrides:
        getParentObject in class DSpaceObjectServiceImpl<Item>
        Parameters:
        context - DSpace context
        item - DSpaceObject
        Returns:
        the dspace object that "own" the current object in the hierarchy
        Throws:
        SQLException - if database error
      • findByAuthorityValue

        public Iterator<Item> findByAuthorityValue​(Context context,
                                                   String schema,
                                                   String element,
                                                   String qualifier,
                                                   String value)
                                            throws SQLException,
                                                   AuthorizeException
        Description copied from interface: ItemService
        Find all the items in the archive with a given authority key value in the indicated metadata field.
        Specified by:
        findByAuthorityValue in interface ItemService
        Parameters:
        context - DSpace context object
        schema - metadata field schema
        element - metadata field element
        qualifier - metadata field qualifier
        value - the value of authority key to look for
        Returns:
        an iterator over the items matching that authority value
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • isItemListedForUser

        public boolean isItemListedForUser​(Context context,
                                           Item item)
        Description copied from interface: ItemService
        Service method for knowing if this Item should be visible in the item list. Items only show up in the "item list" if the user has READ permission and if the Item isn't flagged as unlisted.
        Specified by:
        isItemListedForUser in interface ItemService
        Parameters:
        context - DSpace context object
        item - item
        Returns:
        true or false
      • countItems

        public int countItems​(Context context,
                              Collection collection)
                       throws SQLException
        Description copied from interface: ItemService
        counts items in the given collection
        Specified by:
        countItems in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countAllItems

        public int countAllItems​(Context context,
                                 Collection collection)
                          throws SQLException
        Description copied from interface: ItemService
        counts all items in the given collection including withdrawn items
        Specified by:
        countAllItems in interface ItemService
        Parameters:
        context - DSpace context object
        collection - Collection
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countItems

        public int countItems​(Context context,
                              Community community)
                       throws SQLException
        Description copied from interface: ItemService
        counts items in the given community
        Specified by:
        countItems in interface ItemService
        Parameters:
        context - DSpace context object
        community - Community
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countAllItems

        public int countAllItems​(Context context,
                                 Community community)
                          throws SQLException
        Description copied from interface: ItemService
        counts all items in the given community including withdrawn
        Specified by:
        countAllItems in interface ItemService
        Parameters:
        context - DSpace context object
        community - Community
        Returns:
        total items
        Throws:
        SQLException - if database error
      • canCreateNewVersion

        public boolean canCreateNewVersion​(Context context,
                                           Item item)
                                    throws SQLException
        Description copied from interface: ItemService
        return TRUE if context's user can create new version of the item, false otherwise.
        Specified by:
        canCreateNewVersion in interface ItemService
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        boolean true = current user can create new version of the item
        Throws:
        SQLException - if database error
      • getMetadata

        public List<MetadataValue> getMetadata​(Item item,
                                               String schema,
                                               String element,
                                               String qualifier,
                                               String lang)
        This method will return a list of MetadataValue objects that contains all the regular metadata of the item passed along in the parameters as well as all the virtual metadata which will be generated and processed together with the VirtualMetadataPopulator by processing the item's relationships
        Specified by:
        getMetadata in interface DSpaceObjectService<Item>
        Overrides:
        getMetadata in class DSpaceObjectServiceImpl<Item>
        Parameters:
        item - the Item to be processed
        schema - the schema for the metadata field. Must match the name of an existing metadata schema.
        element - the element name. DSpaceObject.ANY matches any element. null doesn't really make sense as all metadata must have an element.
        qualifier - the qualifier. null means unqualified, and DSpaceObject.ANY means any qualifier (including unqualified.)
        lang - the ISO639 language code, optionally followed by an underscore and the ISO3166 country code. null means only values with no language are returned, and DSpaceObject.ANY means values with any country code or no country code are returned.
        Returns:
      • getMetadata

        public List<MetadataValue> getMetadata​(Item item,
                                               String schema,
                                               String element,
                                               String qualifier,
                                               String lang,
                                               boolean enableVirtualMetadata)
        Description copied from interface: ItemService
        Get metadata for the DSpace Object in a chosen schema. See MetadataSchema for more information about schemas. Passing in a null value for qualifier or lang only matches metadata fields where that qualifier or languages is actually null. Passing in DSpaceObject.ANY retrieves all metadata fields with any value for the qualifier or language, including null

        Examples:

        Return values of the unqualified "title" field, in any language. Qualified title fields (e.g. "title.uniform") are NOT returned:

        dspaceobject.getMetadataByMetadataString("dc", "title", null, DSpaceObject.ANY );

        Return all US English values of the "title" element, with any qualifier (including unqualified):

        dspaceobject.getMetadataByMetadataString("dc, "title", DSpaceObject.ANY, "en_US" );

        The ordering of values of a particular element/qualifier/language combination is significant. When retrieving with wildcards, values of a particular element/qualifier/language combinations will be adjacent, but the overall ordering of the combinations is indeterminate. If enableVirtualMetadata is set to false, the virtual metadata will not be included

        Specified by:
        getMetadata in interface ItemService
        Parameters:
        item - Item
        schema - the schema for the metadata field. Must match the name of an existing metadata schema.
        element - the element name. DSpaceObject.ANY matches any element. null doesn't really make sense as all metadata must have an element.
        qualifier - the qualifier. null means unqualified, and DSpaceObject.ANY means any qualifier (including unqualified.)
        lang - the ISO639 language code, optionally followed by an underscore and the ISO3166 country code. null means only values with no language are returned, and DSpaceObject.ANY means values with any country code or no country code are returned.
        enableVirtualMetadata - Enables virtual metadata calculation and inclusion from the relationships.
        Returns:
        metadata fields that match the parameters
      • moveSingleMetadataValue

        protected void moveSingleMetadataValue​(Context context,
                                               Item dso,
                                               int place,
                                               MetadataValue rr)
        Supports moving metadata by adding the metadata value or updating the place of the relationship
        Overrides:
        moveSingleMetadataValue in class DSpaceObjectServiceImpl<Item>
        Parameters:
        context - current DSpace session.
        dso - unused.
        place - ordinal position of the value in the list of that field's values.
        rr - the value to be placed.
      • addMetadata

        public MetadataValue addMetadata​(Context context,
                                         Item dso,
                                         String schema,
                                         String element,
                                         String qualifier,
                                         String lang,
                                         String value,
                                         String authority,
                                         int confidence,
                                         int place)
                                  throws SQLException
        Description copied from interface: DSpaceObjectService
        Add a single metadata value at the given place position.
        Specified by:
        addMetadata in interface DSpaceObjectService<Item>
        Overrides:
        addMetadata in class DSpaceObjectServiceImpl<Item>
        Parameters:
        context - DSpace context
        dso - DSpaceObject
        schema - the schema for the metadata field. Must match the name of an existing metadata schema.
        element - the metadata element name
        qualifier - the metadata qualifier, or null for unqualified
        lang - the ISO639 language code, optionally followed by an underscore and the ISO3166 country code. null means the value has no language (for example, a date).
        value - the value to add.
        authority - the external authority key for this value (or null)
        confidence - the authority confidence (default 0)
        place - the metadata position
        Returns:
        the MetadataValue added ot the object
        Throws:
        SQLException - if database error
      • getEntityTypeLabel

        public String getEntityTypeLabel​(Item item)
        Description copied from interface: ItemService
        Retrieve the label of the entity type of the given item.
        Specified by:
        getEntityTypeLabel in interface ItemService
        Parameters:
        item - the item.
        Returns:
        the label of the entity type, taken from the item metadata, or null if not found.