Package com.unboundid.scim2.server.utils
Class ResourcePreparer<T extends com.unboundid.scim2.common.ScimResource>
- java.lang.Object
-
- com.unboundid.scim2.server.utils.ResourcePreparer<T>
-
public class ResourcePreparer<T extends com.unboundid.scim2.common.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, javax.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 void
setResourceTypeAndLocation(T returnedResource)
Sets the meta.resourceType and meta.location metadata attribute values.com.unboundid.scim2.common.GenericScimResource
trimCreatedResource(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.com.unboundid.scim2.common.GenericScimResource
trimModifiedResource(T returnedResource, Iterable<com.unboundid.scim2.common.messages.PatchOperation> patchOperations)
Trim attributes of the resources returned from a modify operation based on schema as well as the patch request and request parameters.com.unboundid.scim2.common.GenericScimResource
trimReplacedResource(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.com.unboundid.scim2.common.GenericScimResource
trimRetrievedResource(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(ResourceTypeDefinition resourceType, javax.ws.rs.core.UriInfo requestUriInfo) throws com.unboundid.scim2.common.exceptions.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:
com.unboundid.scim2.common.exceptions.BadRequestException
- If an attribute path specified by attributes and excludedAttributes is invalid.
-
-
Method Detail
-
trimRetrievedResource
public com.unboundid.scim2.common.GenericScimResource trimRetrievedResource(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
public com.unboundid.scim2.common.GenericScimResource trimCreatedResource(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.- Parameters:
returnedResource
- The resource to return.requestResource
- The resource in the create request ornull
if not available.- Returns:
- The trimmed resource ready to return to the client.
-
trimReplacedResource
public com.unboundid.scim2.common.GenericScimResource trimReplacedResource(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.- Parameters:
returnedResource
- The resource to return.requestResource
- The resource in the replace request ornull
if not available.- Returns:
- The trimmed resource ready to return to the client.
-
trimModifiedResource
public com.unboundid.scim2.common.GenericScimResource trimModifiedResource(T returnedResource, Iterable<com.unboundid.scim2.common.messages.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 ornull
if not available.- Returns:
- The trimmed resource ready to return to the client.
-
setResourceTypeAndLocation
public void setResourceTypeAndLocation(T returnedResource)
Sets the meta.resourceType and meta.location metadata attribute values.- Parameters:
returnedResource
- The resource to set the attributes.
-
-