Class Bitstream

    • Method Detail

      • getSequenceID

        public int getSequenceID()
        Get the sequence ID of this bitstream. The sequence ID is a unique (within an Item) integer that references this bitstream. It acts as a "persistent" identifier within the Item for this Bitstream (as Bitstream names are not persistent). Because it is unique within an Item, sequence IDs are assigned by the ItemService.update() method.
        Returns:
        the sequence ID
        See Also:
        ItemServiceImpl.update(Context, Item)
      • setSequenceID

        public void setSequenceID​(int sid)
        Set the sequence ID of this bitstream. The sequence ID is a unique (within an Item) integer that references this bitstream. While this method is public, it should only be used by ItemService.update() or other methods which validate the uniqueness of the ID within the associated Item. This method itself does not validate uniqueness of the ID, nor does the underlying database table.
        Parameters:
        sid - the ID
        See Also:
        ItemServiceImpl.update(Context, Item)
      • getName

        public String getName()
        Get the name of this bitstream - typically the filename, without any path information
        Specified by:
        getName in class DSpaceObject
        Returns:
        the name of the bitstream
      • setName

        public void setName​(Context context,
                            String n)
                     throws SQLException
        Set the name of the bitstream
        Parameters:
        context - context
        n - the new name of the bitstream
        Throws:
        SQLException - if database error
      • getSource

        public String getSource()
        Get the source of this bitstream - typically the filename with path information (if originally provided) or the name of the tool that generated this bitstream
        Returns:
        the source of the bitstream
      • setSource

        public void setSource​(Context context,
                              String n)
                       throws SQLException
        Set the source of the bitstream
        Parameters:
        context - context
        n - the new source of the bitstream
        Throws:
        SQLException - if database error
      • getDescription

        public String getDescription()
        Get the description of this bitstream - optional free text, typically provided by a user at submission time
        Returns:
        the description of the bitstream
      • setDescription

        public void setDescription​(Context context,
                                   String n)
                            throws SQLException
        Set the description of the bitstream
        Parameters:
        context - context
        n - the new description of the bitstream
        Throws:
        SQLException - if database error
      • getChecksum

        public String getChecksum()
        Get the checksum of the content of the bitstream, for integrity checking
        Returns:
        the checksum
      • setChecksum

        public void setChecksum​(String checksum)
      • getChecksumAlgorithm

        public String getChecksumAlgorithm()
        Get the algorithm used to calculate the checksum
        Returns:
        the algorithm, e.g. "MD5"
      • setChecksumAlgorithm

        public void setChecksumAlgorithm​(String checksumAlgorithm)
      • getSizeBytes

        public long getSizeBytes()
        Get the size of the bitstream
        Returns:
        the size in bytes
      • setSizeBytes

        public void setSizeBytes​(long sizeBytes)
      • getUserFormatDescription

        public String getUserFormatDescription()
        Get the user's format description. Returns null if the format is known by the system.
        Returns:
        the user's format description.
      • isDeleted

        public boolean isDeleted()
                          throws SQLException
        Bitstreams are only logically deleted (via a flag in the database). This method allows us to verify is the bitstream is still valid
        Returns:
        true if the bitstream has been deleted
        Throws:
        SQLException - if database error
      • setDeleted

        public void setDeleted​(boolean deleted)
      • getBundles

        public List<Bundle> getBundles()
                                throws SQLException
        Get the bundles this bitstream appears in
        Returns:
        array of Bundle s this bitstream appears in
        Throws:
        SQLException - if database error
      • getType

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

        public Collection getCollection()
      • getCommunity

        public Community getCommunity()
      • getStoreNumber

        public int getStoreNumber()
        Get the asset store number where this bitstream is stored
        Returns:
        the asset store number of the bitstream
      • setStoreNumber

        public void setStoreNumber​(int storeNumber)
        Set the asset store number where this bitstream is stored
        Parameters:
        storeNumber - asset store number of the bitstream
      • getInternalId

        public String getInternalId()
      • setInternalId

        public void setInternalId​(String internalId)
      • setUserFormatDescription

        public void setUserFormatDescription​(Context context,
                                             String desc)
                                      throws SQLException
        Set the user's format description. This implies that the format of the bitstream is uncertain, and the format is set to "unknown."
        Parameters:
        context - The relevant DSpace Context.
        desc - the user's description of the format
        Throws:
        SQLException - if database error
      • getFormatDescription

        public String getFormatDescription​(Context context)
                                    throws SQLException
        Get the description of the format - either the user's or the description of the format defined by the system.
        Parameters:
        context - context
        Returns:
        a description of the format.
        Throws:
        SQLException - if database error
      • setFormat

        public void setFormat​(Context context,
                              BitstreamFormat f)
                       throws SQLException
        Set the format of the bitstream. If the user has supplied a type description, it is cleared. Passing in null sets the type of this bitstream to "unknown".
        Parameters:
        context - context
        f - the format of this bitstream, or null for unknown
        Throws:
        SQLException - if database error
      • equals

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

        public int hashCode()
        Overrides:
        hashCode in class Object