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<Item>
org.dspace.app.rest.submit.factory.impl.ItemMetadataValueAddPatchOperation
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected ItemServiceprotected voidreplaceValue(Context context, Item source, String target, List<MetadataValueRest> list) Methods inherited from class org.dspace.app.rest.submit.factory.impl.MetadataValueAddPatchOperation
addValue, getArrayClassForEvaluation, getClassForEvaluationMethods inherited from class org.dspace.app.rest.submit.factory.impl.AddPatchOperation
performMethods inherited from class org.dspace.app.rest.submit.factory.impl.PatchOperation
evaluateArrayObject, evaluateSingleObject, getAbsolutePath, getStepId
-
Constructor Details
-
ItemMetadataValueAddPatchOperation
public ItemMetadataValueAddPatchOperation()
-
-
Method Details
-
replaceValue
protected void replaceValue(Context context, Item source, String target, List<MetadataValueRest> list) throws SQLException - Overrides:
replaceValuein classMetadataValueAddPatchOperation<Item>- Throws:
SQLException
-
getDSpaceObjectService
- Specified by:
getDSpaceObjectServicein classMetadataValueAddPatchOperation<Item>
-