Package org.dspace.embargo
Class DefaultEmbargoSetter
- java.lang.Object
-
- org.dspace.embargo.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
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServiceprotected ResourcePolicyServiceresourcePolicyService
-
Constructor Summary
Constructors Constructor Description DefaultEmbargoSetter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckEmbargo(Context context, Item item)Check that embargo is properly set on Item: no read access to bitstreams.protected voidgeneratePolicies(Context context, Date embargoDate, String reason, DSpaceObject dso, Collection owningCollection)DCDateparseTerms(Context context, Item item, String terms)Parse the terms into a definite date.voidsetEmbargo(Context context, Item item)Enforce embargo by turning off all read access to bitstreams in this Item.
-
-
-
Field Detail
-
authorizeService
protected AuthorizeService authorizeService
-
resourcePolicyService
protected ResourcePolicyService resourcePolicyService
-
-
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:
parseTermsin interfaceEmbargoSetter- Parameters:
context- the DSpace contextitem- the item to embargoterms- 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:
setEmbargoin interfaceEmbargoSetter- Parameters:
context- the DSpace contextitem- 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.
-
generatePolicies
protected void generatePolicies(Context context, Date embargoDate, String reason, DSpaceObject dso, Collection owningCollection) throws SQLException, AuthorizeException
- Throws:
SQLExceptionAuthorizeException
-
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:
checkEmbargoin interfaceEmbargoSetter- Parameters:
context- the DSpace contextitem- 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.
-
-