Interface ItemService

    • Method Detail

      • create

        Item create​(Context context,
                    WorkspaceItem workspaceItem,
                    UUID uuid)
             throws SQLException,
                    AuthorizeException
        Create a new item, with a provided ID. Authorisation is done inside of this method.
        Parameters:
        context - DSpace context object
        workspaceItem - in progress workspace item
        uuid - the pre-determined UUID to assign to the new item
        Returns:
        the newly created item
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • createTemplateItem

        Item createTemplateItem​(Context context,
                                Collection collection)
                         throws SQLException,
                                AuthorizeException
        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.
        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

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

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

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

        Iterator<Item> findAllRegularItems​(Context context)
                                    throws SQLException
        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.
        Parameters:
        context - the DSpace context.
        Returns:
        iterator over all regular items.
        Throws:
        SQLException - if database error.
      • findBySubmitter

        Iterator<Item> findBySubmitter​(Context context,
                                       EPerson eperson)
                                throws SQLException
        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.
        Parameters:
        context - DSpace context object
        eperson - the submitter
        Returns:
        an iterator over the items submitted by eperson
        Throws:
        SQLException - if database error
      • findBySubmitter

        Iterator<Item> findBySubmitter​(Context context,
                                       EPerson eperson,
                                       boolean retrieveAllItems)
                                throws SQLException
        Find all the items by a given submitter. The order is indeterminate. All items are included.
        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

        Iterator<Item> findBySubmitterDateSorted​(Context context,
                                                 EPerson eperson,
                                                 Integer limit)
                                          throws SQLException
        Retrieve the list of items submitted by eperson, ordered by recently submitted, optionally limitable
        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

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

        Iterator<Item> findByCollection​(Context context,
                                        Collection collection,
                                        Integer limit,
                                        Integer offset)
                                 throws SQLException
        Get all the archived items in this collection. The order is indeterminate.
        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

        Iterator<Item> findByCollectionMapping​(Context context,
                                               Collection collection,
                                               Integer limit,
                                               Integer offset)
                                        throws SQLException
        Get all the archived items mapped to this collection (excludes owning collection). The order is indeterminate.
        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

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

        Iterator<Item> findAllByCollection​(Context context,
                                           Collection collection,
                                           Integer limit,
                                           Integer offset)
                                    throws SQLException
        Get all the items (including private and withdrawn) in this collection. The order is indeterminate.
        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

        Iterator<Item> findInArchiveOrWithdrawnDiscoverableModifiedSince​(Context context,
                                                                         Date since)
                                                                  throws SQLException
        Get all Items installed or withdrawn, discoverable, and modified since a Date.
        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

        Iterator<Item> findInArchiveOrWithdrawnNonDiscoverableModifiedSince​(Context context,
                                                                            Date since)
                                                                     throws SQLException
        Get all Items installed or withdrawn, NON-discoverable, and modified since a Date.
        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
      • findAllByCollection

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

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

        List<Community> getCommunities​(Context context,
                                       Item item)
                                throws SQLException
        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.
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        the communities this item is in.
        Throws:
        SQLException - if database error
      • getBundles

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

        Bitstream createSingleBitstream​(Context context,
                                        InputStream is,
                                        Item item,
                                        String name)
                                 throws AuthorizeException,
                                        IOException,
                                        SQLException
        Create a single bitstream in a new bundle. Provided as a convenience method for the most common use.
        Parameters:
        context - DSpace context object
        item - item to create bitstream on
        is - the stream to create the new bitstream from
        name - is the name of the bundle (ORIGINAL, TEXT, THUMBNAIL)
        Returns:
        Bitstream that is created
        Throws:
        AuthorizeException - if authorization error
        IOException - if IO error
        SQLException - if database error
      • getNonInternalBitstreams

        List<Bitstream> getNonInternalBitstreams​(Context context,
                                                 Item item)
                                          throws SQLException
        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.
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        non-internal bitstreams.
        Throws:
        SQLException - if database error
      • removeDSpaceLicense

        void removeDSpaceLicense​(Context context,
                                 Item item)
                          throws SQLException,
                                 AuthorizeException,
                                 IOException
        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

        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
      • withdraw

        void withdraw​(Context context,
                      Item item)
               throws SQLException,
                      AuthorizeException
        Withdraw the item from the archive. It is kept in place, and the content and metadata are not deleted, but it is not publicly accessible.
        Parameters:
        context - DSpace context object
        item - item to withdraw
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • isOwningCollection

        boolean isOwningCollection​(Item item,
                                   Collection collection)
        Return true if this Collection 'owns' this item
        Parameters:
        item - item to check
        collection - Collection
        Returns:
        true if this Collection owns this item
      • replaceAllItemPolicies

        void replaceAllItemPolicies​(Context context,
                                    Item item,
                                    List<ResourcePolicy> newpolicies)
                             throws SQLException,
                                    AuthorizeException
        remove all of the policies for item and replace them with a new list of policies
        Parameters:
        context - DSpace context object
        item - item to replace policies on
        newpolicies - - this will be all of the new policies for the item and its contents
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • replaceAllBitstreamPolicies

        void replaceAllBitstreamPolicies​(Context context,
                                         Item item,
                                         List<ResourcePolicy> newpolicies)
                                  throws SQLException,
                                         AuthorizeException
        remove all of the policies for item's bitstreams and bundles and replace them with a new list of policies
        Parameters:
        context - DSpace context object
        item - item to replace policies on
        newpolicies - - this will be all of the new policies for the bundle and bitstream contents
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • removeGroupPolicies

        void removeGroupPolicies​(Context context,
                                 Item item,
                                 Group group)
                          throws SQLException,
                                 AuthorizeException
        remove all of the policies for item's bitstreams and bundles that belong to a given Group
        Parameters:
        context - DSpace context object
        item - item to remove group policies from
        group - Group referenced by policies that needs to be removed
        Throws:
        SQLException - if database error
        AuthorizeException - if authorization error
      • inheritCollectionDefaultPolicies

        void inheritCollectionDefaultPolicies​(Context context,
                                              Item item,
                                              Collection collection)
                                       throws SQLException,
                                              AuthorizeException
        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.
        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

        void inheritCollectionDefaultPolicies​(Context context,
                                              Item item,
                                              Collection collection,
                                              boolean overrideItemReadPolicies)
                                       throws SQLException,
                                              AuthorizeException
        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).
        Parameters:
        context - DSpace context object
        item - item to reset policies on
        collection - Collection
        overrideItemReadPolicies - 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

        void adjustBundleBitstreamPolicies​(Context context,
                                           Item item,
                                           Collection collection)
                                    throws SQLException,
                                           AuthorizeException
        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
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustBundleBitstreamPolicies

        void adjustBundleBitstreamPolicies​(Context context,
                                           Item item,
                                           Collection collection,
                                           boolean replaceReadRPWithCollectionRP)
                                    throws SQLException,
                                           AuthorizeException
        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
        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

        void adjustBitstreamPolicies​(Context context,
                                     Item item,
                                     Collection collection,
                                     Bitstream bitstream)
                              throws SQLException,
                                     AuthorizeException
        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
        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

        void adjustBitstreamPolicies​(Context context,
                                     Item item,
                                     Collection collection,
                                     Bitstream bitstream,
                                     boolean replaceReadRPWithCollectionRP)
                              throws SQLException,
                                     AuthorizeException
        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
        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

        void adjustItemPolicies​(Context context,
                                Item item,
                                Collection collection)
                         throws SQLException,
                                AuthorizeException
        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
        Parameters:
        context - DSpace context object
        item - Item to adjust policies on
        collection - Collection
        Throws:
        SQLException - If database error
        AuthorizeException - If authorization error
      • adjustItemPolicies

        void adjustItemPolicies​(Context context,
                                Item item,
                                Collection collection,
                                boolean replaceReadRPWithCollectionRP)
                         throws SQLException,
                                AuthorizeException
        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
        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

        boolean hasUploadedFiles​(Item item)
                          throws SQLException
        Check the bundle ORIGINAL to see if there are any uploaded files
        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
      • getCollectionsNotLinked

        List<Collection> getCollectionsNotLinked​(Context context,
                                                 Item item)
                                          throws SQLException
        Get the collections this item is not in.
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        the collections this item is not in, if any.
        Throws:
        SQLException - if database error
      • canEdit

        boolean canEdit​(Context context,
                        Item item)
                 throws SQLException
        return TRUE if context's user can edit item, false otherwise
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        boolean true = current user can edit item
        Throws:
        SQLException - if database error
      • canCreateNewVersion

        boolean canCreateNewVersion​(Context context,
                                    Item item)
                             throws SQLException
        return TRUE if context's user can create new version of the item, false otherwise.
        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
      • findArchivedByMetadataField

        Iterator<Item> findArchivedByMetadataField​(Context context,
                                                   String schema,
                                                   String element,
                                                   String qualifier,
                                                   String value)
                                            throws SQLException,
                                                   AuthorizeException
        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
        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
        AuthorizeException - if authorization error
      • findArchivedByMetadataField

        Iterator<Item> findArchivedByMetadataField​(Context context,
                                                   String metadataField,
                                                   String value)
                                            throws SQLException,
                                                   AuthorizeException
        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
        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

        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
        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
        AuthorizeException - if authorization error
        IOException - if IO error
      • findByAuthorityValue

        Iterator<Item> findByAuthorityValue​(Context context,
                                            String schema,
                                            String element,
                                            String qualifier,
                                            String value)
                                     throws SQLException,
                                            AuthorizeException
        Find all the items in the archive with a given authority key value in the indicated metadata field.
        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
        IOException - if IO error
      • isItemListedForUser

        boolean isItemListedForUser​(Context context,
                                    Item item)
        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.
        Parameters:
        context - DSpace context object
        item - item
        Returns:
        true or false
      • countItems

        int countItems​(Context context,
                       Collection collection)
                throws SQLException
        counts items in the given collection
        Parameters:
        context - DSpace context object
        collection - Collection
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countAllItems

        int countAllItems​(Context context,
                          Collection collection)
                   throws SQLException
        counts all items in the given collection including withdrawn items
        Parameters:
        context - DSpace context object
        collection - Collection
        Returns:
        total items
        Throws:
        SQLException - if database error
      • findByLastModifiedSince

        Iterator<Item> findByLastModifiedSince​(Context context,
                                               Date last)
                                        throws SQLException
        Find all Items modified since a Date.
        Parameters:
        context - DSpace context object
        last - Earliest interesting last-modified date.
        Returns:
        iterator over items
        Throws:
        SQLException - if database error
      • countItems

        int countItems​(Context context,
                       Community community)
                throws SQLException
        counts items in the given community
        Parameters:
        context - DSpace context object
        community - Community
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countAllItems

        int countAllItems​(Context context,
                          Community community)
                   throws SQLException
        counts all items in the given community including withdrawn
        Parameters:
        context - DSpace context object
        community - Community
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countTotal

        int countTotal​(Context context)
                throws SQLException
        counts all items
        Parameters:
        context - DSpace context object
        Returns:
        total items
        Throws:
        SQLException - if database error
      • countNotArchivedItems

        int countNotArchivedItems​(Context context)
                           throws SQLException
        counts all items not in archive
        Parameters:
        context - DSpace context object
        Returns:
        total items NOT in archive
        Throws:
        SQLException - if database error
      • countArchivedItems

        int countArchivedItems​(Context context)
                        throws SQLException
        counts all items in archive
        Parameters:
        context - DSpace context object
        Returns:
        total items in archive
        Throws:
        SQLException - if database error
      • countWithdrawnItems

        int countWithdrawnItems​(Context context)
                         throws SQLException
        counts all withdrawn items
        Parameters:
        context - DSpace context object
        Returns:
        total items withdrawn
        Throws:
        SQLException - if database error
      • isInProgressSubmission

        boolean isInProgressSubmission​(Context context,
                                       Item item)
                                throws SQLException
        Check if the supplied item is an inprogress submission
        Parameters:
        context - DSpace context object
        item - item to check
        Returns:
        true if the item is linked to a workspaceitem or workflowitem
        Throws:
        SQLException - if database error
      • getMetadata

        List<MetadataValue> getMetadata​(Item item,
                                        String schema,
                                        String element,
                                        String qualifier,
                                        String lang,
                                        boolean enableVirtualMetadata)
        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

        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
      • getEntityTypeLabel

        String getEntityTypeLabel​(Item item)
        Retrieve the label of the entity type of the given item.
        Parameters:
        item - the item.
        Returns:
        the label of the entity type, taken from the item metadata, or null if not found.
      • getEntityType

        EntityType getEntityType​(Context context,
                                 Item item)
                          throws SQLException
        Retrieve the entity type of the given item.
        Parameters:
        context - the DSpace context.
        item - the item.
        Returns:
        the entity type of the given item, or null if not found.
        Throws:
        SQLException