Class ResourcePolicyUtils
- java.lang.Object
-
- org.dspace.app.rest.repository.patch.operation.resourcePolicy.ResourcePolicyUtils
-
@Component public class ResourcePolicyUtils extends Object
Util class for shared methods between the ResourcePolicy patches.- Author:
- Maria Verdonck (Atmire) on 14/02/2020, Andrea Bollini (andrea.bollini at 4science.it)
-
-
Field Summary
Fields Modifier and Type Field Description static StringOPERATION_PATH_DESCRIPTIONstatic StringOPERATION_PATH_ENDDATEstatic StringOPERATION_PATH_NAMEstatic StringOPERATION_PATH_STARTDATEPaths in json body of patched that use these resourcePolicy operationsstatic SimpleDateFormatsimpleDateFormat
-
Constructor Summary
Constructors Constructor Description ResourcePolicyUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckResourcePolicyForConsistentEndDateValue(ResourcePolicy resource, Operation operation)Throws PatchBadRequestException if the value for endDate is not consistent with the startDate value, if present (smaller than).voidcheckResourcePolicyForConsistentStartDateValue(ResourcePolicy resource, Operation operation)Throws PatchBadRequestException if the value for startDate is not consistent with the endDate value, if present (greater than).voidcheckResourcePolicyForExistingDescriptionValue(ResourcePolicy resource, Operation operation)Throws PatchBadRequestException for missing value in the /description path.voidcheckResourcePolicyForExistingEndDateValue(ResourcePolicy resource, Operation operation)Throws PatchBadRequestException for missing value in the /endDate path.voidcheckResourcePolicyForExistingNameValue(ResourcePolicy resource, Operation operation)Throws PatchBadRequestException for missing value in the /startDate path.voidcheckResourcePolicyForExistingStartDateValue(ResourcePolicy resource, Operation operation)Throws PatchBadRequestException for missing value in the /startDate path.
-
-
-
Field Detail
-
simpleDateFormat
public static final SimpleDateFormat simpleDateFormat
-
OPERATION_PATH_STARTDATE
public static final String OPERATION_PATH_STARTDATE
Paths in json body of patched that use these resourcePolicy operations- See Also:
- Constant Field Values
-
OPERATION_PATH_ENDDATE
public static final String OPERATION_PATH_ENDDATE
- See Also:
- Constant Field Values
-
OPERATION_PATH_DESCRIPTION
public static final String OPERATION_PATH_DESCRIPTION
- See Also:
- Constant Field Values
-
OPERATION_PATH_NAME
public static final String OPERATION_PATH_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
checkResourcePolicyForExistingStartDateValue
public void checkResourcePolicyForExistingStartDateValue(ResourcePolicy resource, Operation operation)
Throws PatchBadRequestException for missing value in the /startDate path.- Parameters:
resource- the resource to updateoperation- the operation to apply
-
checkResourcePolicyForExistingEndDateValue
public void checkResourcePolicyForExistingEndDateValue(ResourcePolicy resource, Operation operation)
Throws PatchBadRequestException for missing value in the /endDate path.- Parameters:
resource- the resource to updateoperation- the operation to apply
-
checkResourcePolicyForExistingNameValue
public void checkResourcePolicyForExistingNameValue(ResourcePolicy resource, Operation operation)
Throws PatchBadRequestException for missing value in the /startDate path.- Parameters:
resource- the resource to updateoperation- the operation to apply
-
checkResourcePolicyForExistingDescriptionValue
public void checkResourcePolicyForExistingDescriptionValue(ResourcePolicy resource, Operation operation)
Throws PatchBadRequestException for missing value in the /description path.- Parameters:
resource- the resource to updateoperation- the operation to apply
-
checkResourcePolicyForConsistentStartDateValue
public void checkResourcePolicyForConsistentStartDateValue(ResourcePolicy resource, Operation operation)
Throws PatchBadRequestException if the value for startDate is not consistent with the endDate value, if present (greater than).- Parameters:
resource- the resource to updateoperation- the operation to apply
-
checkResourcePolicyForConsistentEndDateValue
public void checkResourcePolicyForConsistentEndDateValue(ResourcePolicy resource, Operation operation)
Throws PatchBadRequestException if the value for endDate is not consistent with the startDate value, if present (smaller than).- Parameters:
resource- the resource to updateoperation- the operation to apply
-
-