Class Item

All Implemented Interfaces:
Serializable, DSpaceObjectLegacySupport, ReloadableEntity<UUID>

@Entity public class Item extends DSpaceObject implements DSpaceObjectLegacySupport
Class representing an item in DSpace.

This class holds in memory the item Dublin Core metadata, the bundles in the item, and the bitstreams in those bundles. When modifying the item, if you modify the Dublin Core or the "in archive" flag, you must call update for the changes to be written to the database. Creating, adding or removing bundles or bitstreams has immediate effect in the database.

Author:
Robert Tansley, Martin Hald
See Also:
  • Field Details

  • Constructor Details

    • Item

      protected Item()
      Protected constructor, create object using: ItemService.create(Context, WorkspaceItem)
    • Item

      protected Item(UUID uuid)
      Takes a pre-determined UUID to be passed to the object to allow for the restoration of previously defined UUID's.
      Parameters:
      uuid - Takes a uuid to be passed to the Pre-Defined UUID Generator
  • Method Details

    • isArchived

      public boolean isArchived()
      Find out if the item is part of the main archive
      Returns:
      true if the item is in the main archive
    • isWithdrawn

      public boolean isWithdrawn()
      Find out if the item has been withdrawn
      Returns:
      true if the item has been withdrawn
    • isDiscoverable

      public boolean isDiscoverable()
      Find out if the item is discoverable
      Returns:
      true if the item is discoverable
    • getLastModified

      public Instant getLastModified()
      Get the date the item was last modified, or the current date if last_modified is null
      Returns:
      the date the item was last modified, or the current date if the column is null.
    • setLastModified

      public void setLastModified(Instant lastModified)
    • setArchived

      public void setArchived(boolean isArchived)
      Set the "is_archived" flag. This is public and only WorkflowItem.archive() should set this.
      Parameters:
      isArchived - new value for the flag
    • setDiscoverable

      public void setDiscoverable(boolean discoverable)
      Set the "discoverable" flag. This is public and only
      Parameters:
      discoverable - new value for the flag
    • setOwningCollection

      public void setOwningCollection(Collection c)
      Set the owning Collection for the item
      Parameters:
      c - Collection
    • getOwningCollection

      public Collection getOwningCollection()
      Get the owning Collection for the item
      Returns:
      Collection that is the owner of the item
    • getSubmitter

      public EPerson getSubmitter()
      Get the e-person that originally submitted this item
      Returns:
      the submitter
    • setSubmitter

      public void setSubmitter(EPerson sub)
      Set the e-person that originally submitted this item. This is a public method since it is handled by the WorkspaceItem class in the ingest package. update must be called to write the change to the database.
      Parameters:
      sub - the submitter
    • getCollections

      public List<Collection> getCollections()
      Get the collections this item is in. The order is sorted ascending by collection name.
      Returns:
      the collections this item is in, if any.
    • clearCollections

      public void clearCollections()
    • getTemplateItemOf

      public Collection getTemplateItemOf()
    • getBundles

      public List<Bundle> getBundles()
      Get the bundles in this item.
      Returns:
      the bundles in an unordered array
    • getBundles

      public List<Bundle> getBundles(String name)
      Get the bundles matching a bundle name (name corresponds roughly to type)
      Parameters:
      name - name of bundle (ORIGINAL/TEXT/THUMBNAIL)
      Returns:
      the bundles in an unordered array
    • equals

      public boolean equals(Object obj)
      Return true if other is the same Item as this object, false otherwise.
      Overrides:
      equals in class Object
      Parameters:
      obj - object to compare to
      Returns:
      true if object passed in represents the same item as this object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getType

      public int getType()
      return type found in Constants
      Specified by:
      getType in class DSpaceObject
      Returns:
      int Constants.ITEM
    • getName

      public String getName()
      Specified by:
      getName in class DSpaceObject
    • getLegacyId

      public Integer getLegacyId()
      Specified by:
      getLegacyId in interface DSpaceObjectLegacySupport
      Returns:
      the old integer based legacy identifier
    • getItemService

      public ItemService getItemService()
    • setMetadataModified

      protected void setMetadataModified()
      Overrides:
      setMetadataModified in class DSpaceObject
    • isModifiedMetadataCache

      public boolean isModifiedMetadataCache()
    • getCachedMetadata

      protected List<MetadataValue> getCachedMetadata()
    • setCachedMetadata

      protected void setCachedMetadata(List<MetadataValue> cachedMetadata)