Class DSpaceObjectMetadataPatchUtils
java.lang.Object
org.dspace.app.rest.repository.patch.operation.DSpaceObjectMetadataPatchUtils
Util class for shared methods between the Metadata Operations
- Author:
- Maria Verdonck (Atmire) on 18/11/2019
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPath in json body of patch that uses these metadata operations -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckMetadataFieldNotNull(MetadataField metadataField) protected MetadataValueRestConverts a metadataValue (database entity) to a REST equivalent of itprotected StringextractMdFieldStringFromOperation(Operation operation) Extracts the mdField String (schema.element.qualifier) from the operation and returns itprotected MetadataValueRestextractMetadataValueFromOperation(Operation operation) Extract metadataValue from Operation by parsing the json and mapping it to a MetadataValueRestprotected StringextractNewValueOfMd(Operation operation) Extracts the new value of the metadata from the operation for the replace patch operationprotected StringextractPropertyOfMdFromPath(String[] partsOfPath) Extracts which property of the metadata is being changed in the replace patch operationprotected StringgetIndexFromPath(String path) Retrieved the index from the path of the patch operation, if one can be foundprotected MetadataFieldgetMetadataField(Context context, Operation operation) Retrieves metadataField based on the metadata element found in the operation
-
Field Details
-
OPERATION_METADATA_PATH
Path in json body of patch that uses these metadata operations- See Also:
-
-
Method Details
-
extractMetadataValueFromOperation
Extract metadataValue from Operation by parsing the json and mapping it to a MetadataValueRest- Parameters:
operation- Operation whose value is begin parsed- Returns:
- MetadataValueRest extracted from json in operation value
-
extractMdFieldStringFromOperation
Extracts the mdField String (schema.element.qualifier) from the operation and returns it- Parameters:
operation- The patch operation- Returns:
- The mdField (schema.element.qualifier) patch is being performed on
-
convertMdValueToRest
Converts a metadataValue (database entity) to a REST equivalent of it- Parameters:
md- Original metadataValue- Returns:
- The REST equivalent
-
extractPropertyOfMdFromPath
Extracts which property of the metadata is being changed in the replace patch operation- Parameters:
partsOfPath- Parts of the path of the operation, separated with /- Returns:
- The property that is begin replaced of the metadata
-
extractNewValueOfMd
Extracts the new value of the metadata from the operation for the replace patch operation- Parameters:
operation- The patch operation- Returns:
- The new value of the metadata being replaced in the patch operation
-
getMetadataField
Retrieves metadataField based on the metadata element found in the operation- Parameters:
context- Context the retrieve metadataField from service with stringoperation- Operation of the patch- Returns:
- The metadataField corresponding to the md element string of the operation
- Throws:
SQLException
-
getIndexFromPath
Retrieved the index from the path of the patch operation, if one can be found- Parameters:
path- The string from the operation- Returns:
- The index in the path if there is one (path ex: /metadata/dc.title/1 (1 being the index))
-
checkMetadataFieldNotNull
-