Class AccessConditionResourcePolicyUtils
- java.lang.Object
-
- org.dspace.app.rest.submit.factory.impl.AccessConditionResourcePolicyUtils
-
public class AccessConditionResourcePolicyUtils extends Object
Utility class to reuse methods related to item resource-policies These methods are applicable in the submission when adding new AccessCondition.- Author:
- Mykhaylo Boychuk (mykhaylo.boychuk@4science.com)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcanApplyResourcePolicy(Context context, List<AccessConditionOption> accessConditionOptions, String name, Date startDate, Date endDate)Check if the given name, startDate and endDate match any access condition options configured, otherwise it throws UnprocessableEntity exception.static voidfindApplyResourcePolicy(Context context, List<AccessConditionOption> accessConditionOptions, DSpaceObject obj, String name, String description, Date startDate, Date endDate)Based on the given name, startDate and endDate check if it match any access condition option, then apply the the resource policy on the given DSpace object, otherwise it throws UnprocessableEntity exception.static voidfindApplyResourcePolicy(Context context, List<AccessConditionOption> accessConditionOptions, DSpaceObject obj, List<AccessConditionDTO> newAccessConditions)Based on the given access conditions, find the resource policy to apply on the given DSpace object This function applies the resource policies.
-
-
-
Method Detail
-
findApplyResourcePolicy
public static void findApplyResourcePolicy(Context context, List<AccessConditionOption> accessConditionOptions, DSpaceObject obj, List<AccessConditionDTO> newAccessConditions) throws SQLException, AuthorizeException, ParseException
Based on the given access conditions, find the resource policy to apply on the given DSpace object This function applies the resource policies.- Parameters:
context- DSpace context objectaccessConditionOptions- The configured AccessCondition optionsobj- The applicable DSpace object whose policies should be determinednewAccessConditions- The access condition containing the details for the desired policies- Throws:
SQLException- If a database error occursAuthorizeException- If the user is not authorizedParseException- if parser error
-
findApplyResourcePolicy
public static void findApplyResourcePolicy(Context context, List<AccessConditionOption> accessConditionOptions, DSpaceObject obj, String name, String description, Date startDate, Date endDate) throws SQLException, AuthorizeException, ParseException
Based on the given name, startDate and endDate check if it match any access condition option, then apply the the resource policy on the given DSpace object, otherwise it throws UnprocessableEntity exception.- Parameters:
context- DSpace context objectaccessConditionOptions- The configured AccessCondition optionsobj- The applicable DSpace object whose policies should be determinedname- The name of the access condition matching the desired policiesdescription- An optional description for the policiesstartDate- An optional start date for the policiesendDate- An optional end date for the policies- Throws:
SQLException- If a database error occursAuthorizeException- If the user is not authorizedParseException- if parser error
-
canApplyResourcePolicy
public static void canApplyResourcePolicy(Context context, List<AccessConditionOption> accessConditionOptions, String name, Date startDate, Date endDate) throws SQLException, AuthorizeException, ParseException
Check if the given name, startDate and endDate match any access condition options configured, otherwise it throws UnprocessableEntity exception.- Parameters:
context- DSpace context objectaccessConditionOptions- The configured AccessCondition optionsname- The name of the access condition matching the desired policiesstartDate- An optional start date for the policiesendDate- An optional end date for the policies- Throws:
SQLException- If a database error occursAuthorizeException- If the user is not authorizedParseException- if parser error
-
-