Class ItemMetadataValueAddPatchOperation
- java.lang.Object
-
- org.dspace.app.rest.submit.factory.impl.PatchOperation<T>
-
- org.dspace.app.rest.submit.factory.impl.AddPatchOperation<MetadataValueRest>
-
- org.dspace.app.rest.submit.factory.impl.MetadataValueAddPatchOperation<org.dspace.content.Item>
-
- org.dspace.app.rest.submit.factory.impl.ItemMetadataValueAddPatchOperation
-
public class ItemMetadataValueAddPatchOperation extends MetadataValueAddPatchOperation<org.dspace.content.Item>
Submission "add" PATCH operation. Path used to add a new value to an existent metadata: "/sections/<:name-of-the-form>/<:metadata>/-" Example:curl -X PATCH http://${dspace.server.url}/api/submission/workspaceitems/<:id-workspaceitem> -H " Content-Type: application/json" -d '[{ "op": "add", "path": " /sections/traditionalpageone/dc.title/-", "value": {"value": "Add new title"}}]'Path used to insert the new metadata value in a specific position: "/sections/<:name-of-the-form>/<:metadata>/<:idx-zero-based>" Example:curl -X PATCH http://${dspace.server.url}/api/submission/workspaceitems/<:id-workspaceitem> -H " Content-Type: application/json" -d '[{ "op": "add", "path": " /sections/traditionalpageone/dc.title/1", "value": {"value": "Add new title"}}]'Path used to initialize or replace the whole metadata values: "/sections/<:name-of-the-form>/<:metadata>" Example:curl -X PATCH http://${dspace.server.url}/api/submission/workspaceitems/<:id-workspaceitem> -H " Content-Type: application/json" -d '[{ "op": "add", "path": " /sections/traditionalpageone/dc.title", "value": [{"value": "Add new first title"}, {"value": "Add new second title"}]}]'Please note that according to the JSON Patch specification RFC6902 to initialize a new metadata in the section the add operation must receive an array of values and it is not possible to add a single value to the not yet initialized "/sections/<:name-of-the-form>/<:metadata>/-" path. NOTE: If the target location specifies an object member that does exist, that member's value is replaced.- Author:
- Luigi Andrea Pascarelli (luigiandrea.pascarelli at 4science.it)
-
-
Constructor Summary
Constructors Constructor Description ItemMetadataValueAddPatchOperation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.dspace.content.service.ItemServicegetDSpaceObjectService()protected voidreplaceValue(org.dspace.core.Context context, org.dspace.content.Item source, String target, List<MetadataValueRest> list)-
Methods inherited from class org.dspace.app.rest.submit.factory.impl.MetadataValueAddPatchOperation
addValue, getArrayClassForEvaluation, getClassForEvaluation
-
Methods inherited from class org.dspace.app.rest.submit.factory.impl.AddPatchOperation
perform
-
Methods inherited from class org.dspace.app.rest.submit.factory.impl.PatchOperation
evaluateArrayObject, evaluateSingleObject, getAbsolutePath
-
-
-
-
Method Detail
-
replaceValue
protected void replaceValue(org.dspace.core.Context context, org.dspace.content.Item source, String target, List<MetadataValueRest> list) throws SQLException- Overrides:
replaceValuein classMetadataValueAddPatchOperation<org.dspace.content.Item>- Throws:
SQLException
-
getDSpaceObjectService
protected org.dspace.content.service.ItemService getDSpaceObjectService()
- Specified by:
getDSpaceObjectServicein classMetadataValueAddPatchOperation<org.dspace.content.Item>
-
-