Interface CollectionResourceProvider
- All Known Implementing Classes:
MemoryBackend
,RecordProvider
- action
- create - with an optional client provided resource ID as part of the request itself
- query
- action
- delete
- patch
- read
- update
NOTE: field filtering alters the structure of a JSON resource and MUST only be performed once while processing a request. It is therefore the responsibility of front-end implementations (e.g. HTTP listeners, Servlets, etc) to perform field filtering. Request handler and resource provider implementations SHOULD NOT filter fields, but MAY choose to optimise their processing in order to return a resource containing only the fields targeted by the field filters.
-
Method Summary
Modifier and TypeMethodDescriptiondefault Promise<ActionResponse,
ResourceException> actionCollection
(Context context, ActionRequest request) Performs the providedaction
against the resource collection.default Promise<ActionResponse,
ResourceException> actionInstance
(Context context, String resourceId, ActionRequest request) Performs the providedaction
against a resource within the collection.default Promise<ResourceResponse,
ResourceException> createInstance
(Context context, CreateRequest request) Adds
a new resource instance to the collection.default Promise<ResourceResponse,
ResourceException> deleteInstance
(Context context, String resourceId, DeleteRequest request) Removes
a resource instance from the collection.default Promise<ResourceResponse,
ResourceException> patchInstance
(Context context, String resourceId, PatchRequest request) Patches
an existing resource within the collection.default Promise<QueryResponse,
ResourceException> queryCollection
(Context context, QueryRequest request, QueryResourceHandler handler) Searches
the collection for all resources which match the query request criteria.default Promise<ResourceResponse,
ResourceException> readInstance
(Context context, String resourceId, ReadRequest request) Reads
an existing resource within the collection.default Promise<ResourceResponse,
ResourceException> updateInstance
(Context context, String resourceId, UpdateRequest request) Updates
an existing resource within the collection.
-
Method Details
-
actionCollection
default Promise<ActionResponse,ResourceException> actionCollection(Context context, ActionRequest request) Performs the providedaction
against the resource collection.- Parameters:
context
- The request server context.request
- The action request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
actionInstance
default Promise<ActionResponse,ResourceException> actionInstance(Context context, String resourceId, ActionRequest request) Performs the providedaction
against a resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The action request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
createInstance
default Promise<ResourceResponse,ResourceException> createInstance(Context context, CreateRequest request) Adds
a new resource instance to the collection.Create requests are targeted at the collection itself and may include a user-provided resource ID for the new resource as part of the request itself. The user-provider resource ID may be accessed using the method
CreateRequest.getNewResourceId()
.- Parameters:
context
- The request server context.request
- The create request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
deleteInstance
default Promise<ResourceResponse,ResourceException> deleteInstance(Context context, String resourceId, DeleteRequest request) Removes
a resource instance from the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The delete request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
patchInstance
default Promise<ResourceResponse,ResourceException> patchInstance(Context context, String resourceId, PatchRequest request) Patches
an existing resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The patch request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
queryCollection
default Promise<QueryResponse,ResourceException> queryCollection(Context context, QueryRequest request, QueryResourceHandler handler) Searches
the collection for all resources which match the query request criteria.Implementations must invoke
QueryResourceHandler.handleResource(ResourceResponse)
for each resource which matches the query criteria. Once all matching resources have been returned implementations are required to return either aQueryResponse
if the query has completed successfully, orResourceException
if the query did not complete successfully (even if some matching resources were returned).- Parameters:
context
- The request server context.request
- The query request.handler
- The query resource handler to be notified for each matching resource.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
readInstance
default Promise<ResourceResponse,ResourceException> readInstance(Context context, String resourceId, ReadRequest request) Reads
an existing resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The read request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-
updateInstance
default Promise<ResourceResponse,ResourceException> updateInstance(Context context, String resourceId, UpdateRequest request) Updates
an existing resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The update request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
-