Package org.dspace.access.status
Class DefaultAccessStatusHelper
- java.lang.Object
-
- org.dspace.access.status.DefaultAccessStatusHelper
-
- All Implemented Interfaces:
AccessStatusHelper
public class DefaultAccessStatusHelper extends Object implements AccessStatusHelper
Default plugin implementation of the access status helper. The getAccessStatusFromItem method provides a simple logic to calculate the access status of an item based on the policies of the primary or the first bitstream in the original bundle. Users can override this method for enhanced functionality. The getEmbargoInformationFromItem method provides a simple logic to * retrieve embargo information of bitstreams from an item based on the policies of * the primary or the first bitstream in the original bundle. * Users can override this method for enhanced functionality.
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeServicestatic StringEMBARGOprotected ItemServiceitemServicestatic StringMETADATA_ONLYstatic StringOPEN_ACCESSprotected ResourcePolicyServiceresourcePolicyServicestatic StringRESTRICTEDstatic StringUNKNOWN
-
Constructor Summary
Constructors Constructor Description DefaultAccessStatusHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessStatusFromItem(Context context, Item item, Date threshold)Look at the item's policies to determine an access status value.StringgetEmbargoFromItem(Context context, Item item, Date threshold)Look at the policies of the primary (or first) bitstream of the item to retrieve its embargo.
-
-
-
Field Detail
-
EMBARGO
public static final String EMBARGO
- See Also:
- Constant Field Values
-
METADATA_ONLY
public static final String METADATA_ONLY
- See Also:
- Constant Field Values
-
OPEN_ACCESS
public static final String OPEN_ACCESS
- See Also:
- Constant Field Values
-
RESTRICTED
public static final String RESTRICTED
- See Also:
- Constant Field Values
-
UNKNOWN
public static final String UNKNOWN
- See Also:
- Constant Field Values
-
itemService
protected ItemService itemService
-
resourcePolicyService
protected ResourcePolicyService resourcePolicyService
-
authorizeService
protected AuthorizeService authorizeService
-
-
Method Detail
-
getAccessStatusFromItem
public String getAccessStatusFromItem(Context context, Item item, Date threshold) throws SQLException
Look at the item's policies to determine an access status value. It is also considering a date threshold for embargoes and restrictions. If the item is null, simply returns the "unknown" value.- Specified by:
getAccessStatusFromItemin interfaceAccessStatusHelper- Parameters:
context- the DSpace contextitem- the item to check for embargoesthreshold- the embargo threshold date- Returns:
- an access status value
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getEmbargoFromItem
public String getEmbargoFromItem(Context context, Item item, Date threshold) throws SQLException
Look at the policies of the primary (or first) bitstream of the item to retrieve its embargo. If the item is null, simply returns an empty map with no embargo information.- Specified by:
getEmbargoFromItemin interfaceAccessStatusHelper- Parameters:
context- the DSpace contextitem- the item to embargothreshold- the embargo threshold date- Returns:
- an access status value
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
-