Class PatchTargetHandler

java.lang.Object
de.captaingoldfish.scim.sdk.server.patch.AbstractPatch
de.captaingoldfish.scim.sdk.server.patch.PatchTargetHandler

public class PatchTargetHandler extends AbstractPatch
author Pascal Knueppel
created at: 30.10.2019 - 09:07

this class will handle the patch-add operation if a target is specified
    The result of the add operation depends upon what the target location
    indicated by "path" references:

    o  If the target location does not exist, the attribute and value are
       added.

    o  If the target location specifies a complex attribute, a set of
       sub-attributes SHALL be specified in the "value" parameter.

    o  If the target location specifies a multi-valued attribute, a new
       value is added to the attribute.

    o  If the target location specifies a single-valued attribute, the
       existing value is replaced.

    o  If the target location specifies an attribute that does not exist
       (has no value), the attribute is added with the new value.

    o  If the target location exists, the value is replaced.

    o  If the target location already contains the value specified, no
       changes SHOULD be made to the resource, and a success response
       SHOULD be returned.  Unless other operations change the resource,
       this operation SHALL NOT change the modify timestamp of the
       resource.
 
  • Constructor Details

  • Method Details

    • handleOperationValues

      public boolean handleOperationValues(ResourceNode resource, List<String> values)
      will add, replace or remove the specified values based on the given path-attribute
      Parameters:
      resource - the resource to which the values should be added
      values - the values that should be added into the resource
      Returns:
      true if an effective change was made, false else
    • handleSimpleNode

      protected boolean handleSimpleNode(SchemaAttribute schemaAttribute, com.fasterxml.jackson.databind.node.ObjectNode objectNode, List<String> values)
      adds or replaces a simple node in the given object node
      Parameters:
      schemaAttribute - the attribute schema definition
      objectNode - the object node into which the new node should be added or replaced
      values - the values that should be added to the node. This list must not contain more than a single entry
      Returns:
      true if an effective change was made, false else
    • validateRequest

      protected void validateRequest(List<String> values)
      will check that the expressions are correctly written for the defined patch operation
      Parameters:
      values - the values of the request
    • getPath

      protected AttributePathRoot getPath()
      the specified path where the value should be added