R - The type of resource instances the diff was generated from.public final class Diff<R extends BaseResource> extends Object
UserResource target = ...
UserResource source = userEndpoint.getUser("someUser");
Diff diff = Diff.generate(source, target);
userEndpoint.update(source.getId(),
diff.getAttributesToUpdate(),
diff.getAttributesToDelete());
You can also create a Diff instance from a SCIM partial resource which
contains PATCH modifications. This can then be applied to a source resource
to produce the target resource. For example:
Diff diff = Diff.fromPartialResource(partialResource); BaseResource targetResource = diff.apply(sourceResource);
| Modifier and Type | Method and Description |
|---|---|
R |
apply(R sourceResource,
ResourceFactory<R> resourceFactory)
Applies the modifications from this
Diff to the specified source
resource, and returns the resulting SCIM resource. |
static <R extends BaseResource> |
fromPartialResource(R partialResource,
boolean includeReadOnlyAttributes)
Generates a diff with modifications that can be applied to the source
resource in order to make it match the target resource.
|
static <R extends BaseResource> |
generate(R source,
R target,
String... attributes)
Generates a diff with modifications that can be applied to the source
resource in order to make it match the target resource.
|
List<String> |
getAttributesToDelete()
Retrieves the list of attributes deleted from the source resource.
|
List<SCIMAttribute> |
getAttributesToUpdate()
Retrieves the list of updated attributes (and their new values) to
update on the source resource.
|
R |
toPartialResource(ResourceFactory<R> resourceFactory,
boolean includeReadOnlyAttributes)
Retrieves the partial resource with the modifications that maybe sent in
a PATCH request.
|
public List<String> getAttributesToDelete()
AttributePath.parse(java.lang.String) method.public List<SCIMAttribute> getAttributesToUpdate()
public R apply(R sourceResource, ResourceFactory<R> resourceFactory)
Diff to the specified source
resource, and returns the resulting SCIM resource.sourceResource - the source resource to which the modifications should
be applied.resourceFactory - The ResourceFactory that should be used to create
the new resource instance.public R toPartialResource(ResourceFactory<R> resourceFactory, boolean includeReadOnlyAttributes) throws InvalidResourceException
resourceFactory - The ResourceFactory that should be used to create
the new resource instance.includeReadOnlyAttributes - whether read-only attributes should be
included in the partial resource. If this
is false, these attributes will be
stripped out.InvalidResourceException - If an error occurs.public static <R extends BaseResource> Diff<R> fromPartialResource(R partialResource, boolean includeReadOnlyAttributes)
R - The type of the source and target resource instances.partialResource - The partial resource containing the PATCH
modifications from which to generate the diff.includeReadOnlyAttributes - whether read-only attributes should be
included in the Diff. If this is
false, these attributes will be
stripped out.public static <R extends BaseResource> Diff<R> generate(R source, R target, String... attributes)
R - The type of the source and target resource instances.source - The source resource for which the set of modifications should
be generated.target - The target resource, which is what the source resource should
look like if the returned modifications are applied.attributes - The set of attributes to be compared in standard
attribute notation (ie. name.givenName). If this is
null or empty, then all attributes will be
compared.Copyright © 2011–2016 UnboundID. All rights reserved.