Package org.dspace.submit.model
Class AccessConditionOption
java.lang.Object
org.dspace.submit.model.AccessConditionOption
This class represents an option available in the submission upload section to
set permission on a file. An option is defined by a name such as "open
access", "embargo", "restricted access", etc. and some optional attributes to
better clarify the constraints and input available to the user. For instance
an embargo option could allow to set a start date not longer than 3 years.
- Author:
- Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateResourcePolicy(Context context, DSpaceObject obj, String name, String description, LocalDate startDate, LocalDate endDate) Create a new resource policy for a DSpaceObjectExplanation see:endDateLimitgetName()Explanation see:startDateLimitvoidsetEndDateLimit(String endDateLimit) voidsetGroupName(String groupName) voidsetHasEndDate(Boolean hasEndDate) voidsetHasStartDate(Boolean hasStartDate) voidvoidsetStartDateLimit(String startDateLimit) voidupdateResourcePolicy(Context context, ResourcePolicy resourcePolicy) Validate ResourcePolicy and after update itvoidvalidateResourcePolicy(Context context, String name, LocalDate startDate, LocalDate endDate) Validate the policy properties, throws exceptions if any is not valid.
-
Constructor Details
-
AccessConditionOption
public AccessConditionOption()
-
-
Method Details
-
getName
-
setName
-
getGroupName
-
setGroupName
-
getHasStartDate
-
setHasStartDate
-
getHasEndDate
-
setHasEndDate
-
getStartDateLimit
Explanation see:startDateLimit- Returns:
- startDateLimit
-
setStartDateLimit
-
getEndDateLimit
Explanation see:endDateLimit- Returns:
- endDateLimit
-
setEndDateLimit
-
createResourcePolicy
public void createResourcePolicy(Context context, DSpaceObject obj, String name, String description, LocalDate startDate, LocalDate endDate) throws SQLException, AuthorizeException, ParseException Create a new resource policy for a DSpaceObject- Parameters:
context- DSpace contextobj- DSpaceObject for which resource policy is createdname- name of the resource policydescription- description of the resource policystartDate- start date of the resource policy. IfgetHasStartDate()returns false, startDate should be null. Otherwise startDate may not be null.endDate- end date of the resource policy. IfgetHasEndDate()returns false, endDate should be null. Otherwise endDate may not be null.- Throws:
SQLException- passed through.AuthorizeException- passed through.ParseException- passed through (indicates problem with a date).
-
updateResourcePolicy
public void updateResourcePolicy(Context context, ResourcePolicy resourcePolicy) throws SQLException, AuthorizeException, ParseException Validate ResourcePolicy and after update it- Parameters:
context- DSpace contextresourcePolicy- ResourcePolicy to update- Throws:
SQLException- If database errorAuthorizeException- If authorize errorParseException- If parser error
-
validateResourcePolicy
public void validateResourcePolicy(Context context, String name, LocalDate startDate, LocalDate endDate) throws IllegalStateException, ParseException Validate the policy properties, throws exceptions if any is not valid.- Parameters:
context- DSpace context.name- Name of the resource policy.startDate- Start date of the resource policy. IfgetHasStartDate()returns false, startDate should be null. Otherwise startDate may not be null.endDate- End date of the resource policy. IfgetHasEndDate()returns false, endDate should be null. Otherwise endDate may not be null.- Throws:
IllegalStateException- if a date is required and absent, a date is not required and present, or a date exceeds its configured maximum.ParseException- passed through.
-