Package org.dspace.access.status
Class DefaultAccessStatusHelper
java.lang.Object
org.dspace.access.status.DefaultAccessStatusHelper
- All Implemented Interfaces:
AccessStatusHelper
Default plugin implementation of the access status helper.
The methods 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 those methods for
enhanced functionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorizeServicestatic final Stringprotected GroupServiceprotected ItemServicestatic final Stringstatic final Stringprotected ResourcePolicyServicestatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAccessStatusFromBitstream(Context context, Bitstream bitstream, LocalDate threshold, String type) Look at the bitstream policies to determine an access status value.getAccessStatusFromItem(Context context, Item item, LocalDate threshold, String type) Look at the item's primary or first bitstream policies to determine an access status value.getAnonymousAccessStatusFromItem(Context context, Item item, LocalDate threshold) Look at the anonymous policies of the primary (or first) bitstream of the item to retrieve its embargo.
-
Field Details
-
STATUS_FOR_CURRENT_USER
- See Also:
-
STATUS_FOR_ANONYMOUS
- See Also:
-
EMBARGO
- See Also:
-
METADATA_ONLY
- See Also:
-
OPEN_ACCESS
- See Also:
-
RESTRICTED
- See Also:
-
UNKNOWN
- See Also:
-
itemService
-
resourcePolicyService
-
authorizeService
-
groupService
-
-
Constructor Details
-
DefaultAccessStatusHelper
public DefaultAccessStatusHelper()
-
-
Method Details
-
getAccessStatusFromItem
public AccessStatus getAccessStatusFromItem(Context context, Item item, LocalDate threshold, String type) throws SQLException Look at the item's primary or first bitstream 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 datetype- the type of calculation- Returns:
- the access status
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getAccessStatusFromBitstream
public AccessStatus getAccessStatusFromBitstream(Context context, Bitstream bitstream, LocalDate threshold, String type) throws SQLException Look at the bitstream policies to determine an access status value. It is also considering a date threshold for embargoes and restrictions. If the bitstream is null, simply returns the "unknown" value.- Specified by:
getAccessStatusFromBitstreamin interfaceAccessStatusHelper- Parameters:
context- the DSpace contextbitstream- the bitstream to check for embargoesthreshold- the embargo threshold datetype- the type of calculation- Returns:
- the access status
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-
getAnonymousAccessStatusFromItem
public AccessStatus getAnonymousAccessStatusFromItem(Context context, Item item, LocalDate threshold) throws SQLException Look at the anonymous policies of the primary (or first) bitstream of the item to retrieve its embargo.- Specified by:
getAnonymousAccessStatusFromItemin interfaceAccessStatusHelper- Parameters:
context- the DSpace contextitem- the itemthreshold- the embargo threshold date- Returns:
- the access status
- Throws:
SQLException- An exception that provides information on a database access error or other errors.
-