Package com.unboundid.scim2.server.utils
Class ResourcePreparer<T extends ScimResource>
- java.lang.Object
-
- com.unboundid.scim2.server.utils.ResourcePreparer<T>
-
public class ResourcePreparer<T extends ScimResource> extends Object
Utility to prepare a resource to return to the client. This includes:- Returning the attributes based on the returned constraint of the attribute definition in the schema.
- Returning the attributes requested by the client using the request resource as well as the attributes or excludedAttributes query parameter.
- Setting the meta.resourceType and meta.location attributes if not already set.
-
-
Constructor Summary
Constructors Constructor Description ResourcePreparer(ResourceTypeDefinition resourceType, jakarta.ws.rs.core.UriInfo requestUriInfo)Create a new ResourcePreparer for preparing returned resources for a SCIM operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetResourceTypeAndLocation(T returnedResource)Sets the meta.resourceType and meta.location metadata attribute values.GenericScimResourcetrimCreatedResource(T returnedResource, T requestResource)Trim attributes of the resources returned from a create operation based on schema as well as the request resource and request parameters.GenericScimResourcetrimModifiedResource(T returnedResource, Iterable<PatchOperation> patchOperations)Trim attributes of the resources returned from a modify operation based on schema as well as the patch request and request parameters.GenericScimResourcetrimReplacedResource(T returnedResource, T requestResource)Trim attributes of the resources returned from a replace operation based on schema as well as the request resource and request parameters.GenericScimResourcetrimRetrievedResource(T returnedResource)Trim attributes of the resources returned from a search or retrieve operation based on schema and the request parameters.
-
-
-
Constructor Detail
-
ResourcePreparer
public ResourcePreparer(@NotNull ResourceTypeDefinition resourceType, @NotNull jakarta.ws.rs.core.UriInfo requestUriInfo) throws BadRequestException
Create a new ResourcePreparer for preparing returned resources for a SCIM operation.- Parameters:
resourceType- The resource type definition for resources to prepare.requestUriInfo- The UriInfo for the request.- Throws:
BadRequestException- If an attribute path specified by attributes and excludedAttributes is invalid.
-
-
Method Detail
-
trimRetrievedResource
@NotNull public GenericScimResource trimRetrievedResource(@NotNull T returnedResource)
Trim attributes of the resources returned from a search or retrieve operation based on schema and the request parameters.- Parameters:
returnedResource- The resource to return.- Returns:
- The trimmed resource ready to return to the client.
-
trimCreatedResource
@NotNull public GenericScimResource trimCreatedResource(@NotNull T returnedResource, @Nullable T requestResource)
Trim attributes of the resources returned from a create operation based on schema as well as the request resource and request parameters.- Parameters:
returnedResource- The resource to return.requestResource- The resource in the create request ornullif not available.- Returns:
- The trimmed resource ready to return to the client.
-
trimReplacedResource
@NotNull public GenericScimResource trimReplacedResource(@NotNull T returnedResource, @Nullable T requestResource)
Trim attributes of the resources returned from a replace operation based on schema as well as the request resource and request parameters.- Parameters:
returnedResource- The resource to return.requestResource- The resource in the replace request ornullif not available.- Returns:
- The trimmed resource ready to return to the client.
-
trimModifiedResource
@NotNull public GenericScimResource trimModifiedResource(@NotNull T returnedResource, @Nullable Iterable<PatchOperation> patchOperations)
Trim attributes of the resources returned from a modify operation based on schema as well as the patch request and request parameters.- Parameters:
returnedResource- The resource to return.patchOperations- The operations in the patch request ornullif not available.- Returns:
- The trimmed resource ready to return to the client.
-
setResourceTypeAndLocation
public void setResourceTypeAndLocation(@NotNull T returnedResource)
Sets the meta.resourceType and meta.location metadata attribute values.- Parameters:
returnedResource- The resource to set the attributes.
-
-