Package org.dspace.embargo
Class EmbargoServiceImpl
- java.lang.Object
-
- org.dspace.embargo.EmbargoServiceImpl
-
- All Implemented Interfaces:
EmbargoService
public class EmbargoServiceImpl extends Object implements EmbargoService
Public interface to the embargo subsystem.Configuration properties: (with examples)
# DC metadata field to hold the user-supplied embargo terms embargo.field.terms = dc.embargo.terms # DC metadata field to hold computed "lift date" of embargo embargo.field.lift = dc.date.available # String to indicate indefinite (forever) embargo in terms embargo.terms.open = Indefinite # implementation of embargo setter plugin plugin.single.org.dspace.embargo.EmbargoSetter = edu.my.Setter # implementation of embargo lifter plugin plugin.single.org.dspace.embargo.EmbargoLifter = edu.my.Lifter- Author:
- Larry Stone, Richard Rodgers
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationServiceconfigurationServiceprotected ItemServiceitemServiceprotected Stringlift_elementprotected Stringlift_qualifierprotected Stringlift_schemaprotected EmbargoLifterlifterprotected PluginServicepluginServiceprotected EmbargoSettersetterprotected Stringterms_elementprotected Stringterms_qualifierprotected Stringterms_schema-
Fields inherited from interface org.dspace.embargo.service.EmbargoService
FOREVER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEmbargoServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckEmbargo(Context context, Item item)Iterator<Item>findItemsByLiftMetadata(Context context)protected StringgetElementOf(String field)DCDategetEmbargoTermsAsDate(Context context, Item item)Get the embargo lift date for an Item, if any.List<MetadataValue>getLiftMetadata(Context context, Item item)protected StringgetQualifierOf(String field)protected StringgetSchemaOf(String field)voidinit()Initialize the bean (after dependency injection has already taken place).voidliftEmbargo(Context context, Item item)Lift the embargo on an item which is assumed to be under embargo.protected DCDaterecoverEmbargoDate(Item item)voidsetEmbargo(Context context, Item item)Put an Item under embargo until the specified lift date.
-
-
-
Field Detail
-
terms_schema
protected String terms_schema
-
terms_element
protected String terms_element
-
terms_qualifier
protected String terms_qualifier
-
lift_schema
protected String lift_schema
-
lift_element
protected String lift_element
-
lift_qualifier
protected String lift_qualifier
-
setter
protected EmbargoSetter setter
-
lifter
protected EmbargoLifter lifter
-
itemService
@Autowired(required=true) protected ItemService itemService
-
configurationService
@Autowired(required=true) protected ConfigurationService configurationService
-
pluginService
@Autowired(required=true) protected PluginService pluginService
-
-
Method Detail
-
setEmbargo
public void setEmbargo(Context context, Item item) throws SQLException, AuthorizeException
Description copied from interface:EmbargoServicePut an Item under embargo until the specified lift date. Calls EmbargoSetter plugin to adjust Item access control policies.- Specified by:
setEmbargoin interfaceEmbargoService- 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.
-
getEmbargoTermsAsDate
public DCDate getEmbargoTermsAsDate(Context context, Item item) throws SQLException, AuthorizeException
Description copied from interface:EmbargoServiceGet the embargo lift date for an Item, if any. This looks for the metadata field configured to hold embargo terms, and gives it to the EmbargoSetter plugin's method to interpret it into an absolute timestamp. This is intended to be called at the time the Item is installed into the archive.Note that the plugin is *always* called, in case it gets its cue for the embargo date from sources other than, or in addition to, the specified field.
- Specified by:
getEmbargoTermsAsDatein interfaceEmbargoService- Parameters:
context- the DSpace contextitem- the item to embargo- Returns:
- lift date on which the embargo is to be lifted, or null if none
- 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.
-
liftEmbargo
public void liftEmbargo(Context context, Item item) throws SQLException, AuthorizeException, IOException
Description copied from interface:EmbargoServiceLift the embargo on an item which is assumed to be under embargo. Call the plugin to manage permissions in its own way, then delete the administrative metadata fields that dictated embargo date.- Specified by:
liftEmbargoin interfaceEmbargoService- Parameters:
context- the DSpace contextitem- the item on which to lift the 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.
-
init
public void init() throws ExceptionInitialize the bean (after dependency injection has already taken place). Ensures the configurationService is injected, so that we can get plugins and MD field settings from config. Called by "init-method" in Spring config.- Throws:
Exception- on generic exception
-
checkEmbargo
public void checkEmbargo(Context context, Item item) throws SQLException, IOException, AuthorizeException
- Specified by:
checkEmbargoin interfaceEmbargoService- Throws:
SQLExceptionIOExceptionAuthorizeException
-
getLiftMetadata
public List<MetadataValue> getLiftMetadata(Context context, Item item)
- Specified by:
getLiftMetadatain interfaceEmbargoService
-
findItemsByLiftMetadata
public Iterator<Item> findItemsByLiftMetadata(Context context) throws SQLException, IOException, AuthorizeException
- Specified by:
findItemsByLiftMetadatain interfaceEmbargoService- Throws:
SQLExceptionIOExceptionAuthorizeException
-
-