Class DefaultEmbargoSetter

  • All Implemented Interfaces:
    EmbargoSetter
    Direct Known Subclasses:
    DayTableEmbargoSetter

    public class DefaultEmbargoSetter
    extends Object
    implements EmbargoSetter
    Default plugin implementation of the embargo setting function. The parseTerms() provides only very rudimentary terms logic - entry of a configurable string (in terms field) for 'unlimited' embargo, otherwise a standard ISO 8601 (yyyy-mm-dd) date is assumed. Users are encouraged to override this method for enhanced functionality.
    Author:
    Larry Stone, Richard Rodgers
    • Constructor Detail

      • DefaultEmbargoSetter

        public DefaultEmbargoSetter()
    • Method Detail

      • parseTerms

        public DCDate parseTerms​(Context context,
                                 Item item,
                                 String terms)
                          throws SQLException,
                                 AuthorizeException
        Parse the terms into a definite date. Terms are expected to consist of either: a token (value configured in 'embargo.terms.open' property) to indicate indefinite embargo, or a literal lift date formatted in ISO 8601 format (yyyy-mm-dd)
        Specified by:
        parseTerms in interface EmbargoSetter
        Parameters:
        context - the DSpace context
        item - the item to embargo
        terms - the embargo terms
        Returns:
        parsed date in DCDate format
        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.
      • setEmbargo

        public void setEmbargo​(Context context,
                               Item item)
                        throws SQLException,
                               AuthorizeException
        Enforce embargo by turning off all read access to bitstreams in this Item.
        Specified by:
        setEmbargo in interface EmbargoSetter
        Parameters:
        context - the DSpace context
        item - the item to embargo
        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.
      • checkEmbargo

        public void checkEmbargo​(Context context,
                                 Item item)
                          throws SQLException,
                                 AuthorizeException,
                                 IOException
        Check that embargo is properly set on Item: no read access to bitstreams.
        Specified by:
        checkEmbargo in interface EmbargoSetter
        Parameters:
        context - the DSpace context
        item - the item to embargo
        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.
        IOException - A general class of exceptions produced by failed or interrupted I/O operations.