Package org.forgerock.openig.ui.record
Class RecordProvider
java.lang.Object
org.forgerock.openig.ui.record.RecordProvider
- All Implemented Interfaces:
CollectionResourceProvider
CREST collection service dedicated to persist JSON objects (other types are not supported: arrays,
primitives, and null).
Usage example:
// Persists { "key" : [ 42 ] } and returns the server-created ID to use for future references
requestHandler.handleCreate(context, newCreateRequest("record", json(object(field("key", array(42))))))
.then((response) -> {
System.out.println("Created resource with ID: " + response.getId());
});
-
Constructor Summary
ConstructorsConstructorDescriptionRecordProvider(RecordService service) Creates a new resource provider delegating to the givenservicefor storage. -
Method Summary
Modifier and TypeMethodDescriptionactionCollection(Context context, ActionRequest request) Performs the providedactionagainst the resource collection.actionInstance(Context context, String resourceId, ActionRequest request) Performs the providedactionagainst a resource within the collection.createInstance(Context context, CreateRequest request) Addsa new resource instance to the collection.deleteInstance(Context context, String resourceId, DeleteRequest request) Removesa resource instance from the collection.patchInstance(Context context, String resourceId, PatchRequest request) Patchesan existing resource within the collection.queryCollection(Context context, QueryRequest request, QueryResourceHandler resourceHandler) Searchesthe collection for all resources which match the query request criteria.readInstance(Context context, String resourceId, ReadRequest request) Readsan existing resource within the collection.updateInstance(Context context, String resourceId, UpdateRequest request) Updatesan existing resource within the collection.
-
Constructor Details
-
RecordProvider
Creates a new resource provider delegating to the givenservicefor storage.- Parameters:
service- storage service
-
-
Method Details
-
actionCollection
public Promise<ActionResponse,ResourceException> actionCollection(Context context, ActionRequest request) Description copied from interface:CollectionResourceProviderPerforms the providedactionagainst the resource collection.- Specified by:
actionCollectionin interfaceCollectionResourceProvider- Parameters:
context- The request server context.request- The action request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
actionInstance
public Promise<ActionResponse,ResourceException> actionInstance(Context context, String resourceId, ActionRequest request) Description copied from interface:CollectionResourceProviderPerforms the providedactionagainst a resource within the collection.- Specified by:
actionInstancein interfaceCollectionResourceProvider- Parameters:
context- The request server context.resourceId- The ID of the targeted resource within the collection.request- The action request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
createInstance
public Promise<ResourceResponse,ResourceException> createInstance(Context context, CreateRequest request) Description copied from interface:CollectionResourceProviderAddsa 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().- Specified by:
createInstancein interfaceCollectionResourceProvider- Parameters:
context- The request server context.request- The create request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
deleteInstance
public Promise<ResourceResponse,ResourceException> deleteInstance(Context context, String resourceId, DeleteRequest request) Description copied from interface:CollectionResourceProviderRemovesa resource instance from the collection.- Specified by:
deleteInstancein interfaceCollectionResourceProvider- Parameters:
context- The request server context.resourceId- The ID of the targeted resource within the collection.request- The delete request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
patchInstance
public Promise<ResourceResponse,ResourceException> patchInstance(Context context, String resourceId, PatchRequest request) Description copied from interface:CollectionResourceProviderPatchesan existing resource within the collection.- Specified by:
patchInstancein interfaceCollectionResourceProvider- Parameters:
context- The request server context.resourceId- The ID of the targeted resource within the collection.request- The patch request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
queryCollection
public Promise<QueryResponse,ResourceException> queryCollection(Context context, QueryRequest request, QueryResourceHandler resourceHandler) Description copied from interface:CollectionResourceProviderSearchesthe 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 aQueryResponseif the query has completed successfully, orResourceExceptionif the query did not complete successfully (even if some matching resources were returned).- Specified by:
queryCollectionin interfaceCollectionResourceProvider- Parameters:
context- The request server context.request- The query request.resourceHandler- The query resource handler to be notified for each matching resource.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
readInstance
public Promise<ResourceResponse,ResourceException> readInstance(Context context, String resourceId, ReadRequest request) Description copied from interface:CollectionResourceProviderReadsan existing resource within the collection.- Specified by:
readInstancein interfaceCollectionResourceProvider- Parameters:
context- The request server context.resourceId- The ID of the targeted resource within the collection.request- The read request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-
updateInstance
public Promise<ResourceResponse,ResourceException> updateInstance(Context context, String resourceId, UpdateRequest request) Description copied from interface:CollectionResourceProviderUpdatesan existing resource within the collection.- Specified by:
updateInstancein interfaceCollectionResourceProvider- Parameters:
context- The request server context.resourceId- The ID of the targeted resource within the collection.request- The update request.- Returns:
- A
Promisecontaining the result of the operation. - See Also:
-