Represents a request to update a specific entry in a Store Adapter.
The UnboundID SCIM 2 SDK can be used to parse a SCIM patch request:
final ObjectReader reader =
JsonUtils.getObjectReader().forType(PatchRequest.class);
final PatchRequest patch =
reader.readValue(request.getPatchRequest());
The easiest way to process the update request is to retrieve the entry and
apply the patch in memory using the PatchOperation.apply method using the
SCIM 2 SDK:
// Retrieve the current entry from the store
final GenericScimResource resourceToUpdate = read(...);
// Apply the patch request in memory
patchOp.apply(resourceToUpdate);
// Replace the entire entry in the store
replace(resourceToUpdate);
Alternatively, if the underlying store does not support replacing the entire
entry or to avoid the initial retrieval required to apply the patch in
memory, the individual patch operations may be mapped to update requests
supported by the underlying store. SCIM 2 (RFC 7644) patch operations are
quite complicated in that an operation's path and value may take many forms
but accomplish the same result. To make implementation easier, the patch
operations in this request have been normalized so that there is only one
form to accomplish a particular result. The operations in this request will
have one of the following forms depending on the operation type, whether the
attribute type is complex, and whether it is multi-valued:
Add Operation
"op" field
|
"path" field
|
"value" field
|
Description
|
add |
attributeName |
valueNode or objectNode |
-
If the attribute does not exist, the attribute and value are added
to the resource.
-
If the attribute exists in the resource, the existing value is
replaced. If the existing value and the "value" parameter are
objects containing sub-attributes, those that did not previously
exist are added or their value replaced if they already exist.
Sub-attributes that are not specified in the "value" parameter are
left unchanged.
|
add |
attributeName |
[valueNodes] or [objectNodes] |
-
If the attribute does not exist, the attribute and values are added
to the resource.
-
If the attribute exists in the resource, the new values are added
to the existing values.
|
Remove Operation
"op" field
|
"path" field
|
"value" field
|
Description
|
remove |
attributeName |
|
-
Remove the attribute and its associated value(s) from the resource.
|
remove |
attributeName.subAttributeName |
|
-
Remove the sub-attribute from the attribute's associated value(s).
If no other sub-attributes remain after removal of the
targeted sub-attribute, the attribute should be removed from the
resource.
|
remove |
attributeName[valueFilter] |
|
-
Remove only the value(s) of the multi-valued attribute that matches
the value filter. For simple multi-valued attributes, the value
filter will be on an implicit "value" sub-attribute
(ie. value eq 100). If no other values remain after removal of the
selected values, the attribute should be removed from the resource.
|
remove |
attributeName[valueFilter].subAttributeName |
|
-
Remove the sub-attribute from any values of the multi-valued complex
attribute that matches the value filter. If no other values remain
after removal of the selected values, the attribute should be
removed from the resource.
|
Replace Operation
"op" field
|
"path" field
|
"value" field
|
Description
|
replace |
attributeName |
valueNode or objectNode |
-
If the attribute does not exist, the attribute and value are added
to the resource. (Same as add operation)
-
If the attribute exists in the resource, the existing value is
replaced. If the existing value and the "value" parameter are
objects containing sub-attributes, those that did not previously
exist are added or their value replaced if they already exist.
Sub-attributes that are not specified in the "value" parameter are
left unchanged. (Same as add operation)
|
replace |
attributeName |
[valueNodes] or [objectNodes] |
-
If the attribute does not exist, the attribute and values are added
to the resource.
-
If the attribute exists in the resource, existing values are
replaced by new values.
|
replace |
attributeName[comparisonFilter] |
valueNode or objectNode |
-
Replace only the value(s) of the multi-valued attribute that matches
the value filter. For simple multi-valued attributes, the value
filter will be on an implicit "value" sub-attribute
(ie. value eq 100). If no other values remain after removal of the
selected values, the attribute should be removed from the resource.
If the matched value and the "value" parameter are
objects containing sub-attributes, those that did not previously
exist are added or their value replaced if they already exists.
Sub-attributes that are not specified in the "value" parameter are
left unchanged.
|