Package org.forgerock.json.resource
Class Requests
- java.lang.Object
-
- org.forgerock.json.resource.Requests
-
public final class Requests extends Object
A utility class containing various factory methods for creating and manipulating requests.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ActionRequestcopyOfActionRequest(ActionRequest request)Returns a copy of the provided action request.static RequestcopyOfApiRequest(Request request)Returns a copy of the provided api request.static CreateRequestcopyOfCreateRequest(CreateRequest request)Returns a copy of the provided create request.static DeleteRequestcopyOfDeleteRequest(DeleteRequest request)Returns a copy of the provided delete request.static PatchRequestcopyOfPatchRequest(PatchRequest request)Returns a copy of the provided patch request.static QueryRequestcopyOfQueryRequest(QueryRequest request)Returns a copy of the provided query request.static ReadRequestcopyOfReadRequest(ReadRequest request)Returns a copy of the provided read request.static UpdateRequestcopyOfUpdateRequest(UpdateRequest request)Returns a copy of the provided update request.static ActionRequestnewActionRequest(String resourcePath, String actionId)Returns a new action request with the provided resource path and action ID.static ActionRequestnewActionRequest(String resourceContainer, String resourceId, String actionId)Returns a new action request with the provided resource container path, resource ID, and action ID.static ActionRequestnewActionRequest(ResourcePath resourcePath, String actionId)Returns a new action request with the provided resource path and action ID.static ActionRequestnewActionRequest(ResourcePath resourceContainer, String resourceId, String actionId)Returns a new action request with the provided resource container path, resource ID, and action ID.static RequestnewApiRequest(ResourcePath path)Returns a new API request with the provided path.static CreateRequestnewCreateRequest(String resourceContainer, String newResourceId, JsonValue content)Returns a new create request with the provided resource path, new resource ID, and JSON content.static CreateRequestnewCreateRequest(String resourceContainer, JsonValue content)Returns a new create request with the provided resource path, and JSON content.static CreateRequestnewCreateRequest(ResourcePath resourceContainer, String newResourceId, JsonValue content)Returns a new create request with the provided resource path, new resource ID, and JSON content.static CreateRequestnewCreateRequest(ResourcePath resourceContainer, JsonValue content)Returns a new create request with the provided resource path, and JSON content.static DeleteRequestnewDeleteRequest(String resourcePath)Returns a new delete request with the provided resource path.static DeleteRequestnewDeleteRequest(String resourceContainer, String resourceId)Returns a new delete request with the provided resource container path, and resource ID.static DeleteRequestnewDeleteRequest(ResourcePath resourcePath)Returns a new delete request with the provided resource path.static DeleteRequestnewDeleteRequest(ResourcePath resourceContainer, String resourceId)Returns a new delete request with the provided resource container path, and resource ID.static PatchRequestnewPatchRequest(String resourceContainer, String resourceId, PatchOperation... operations)Returns a new patch request with the provided resource container path, resource ID, and JSON patch operations.static PatchRequestnewPatchRequest(String resourcePath, PatchOperation... operations)Returns a new patch request with the provided resource path and JSON patch operations.static PatchRequestnewPatchRequest(ResourcePath resourceContainer, String resourceId, PatchOperation... operations)Returns a new patch request with the provided resource container path, resource ID, and JSON patch operations.static PatchRequestnewPatchRequest(ResourcePath resourcePath, PatchOperation... operations)Returns a new patch request with the provided resource path and JSON patch operations.static QueryRequestnewQueryRequest(String resourceContainer)Returns a new query request with the provided resource container path.static QueryRequestnewQueryRequest(ResourcePath resourceContainer)Returns a new query request with the provided resource container path.static ReadRequestnewReadRequest(String resourcePath)Returns a new read request with the provided resource path.static ReadRequestnewReadRequest(String resourceContainer, String resourceId)Returns a new read request with the provided resource container path, and resource ID.static ReadRequestnewReadRequest(ResourcePath resourcePath)Returns a new read request with the provided resource path.static ReadRequestnewReadRequest(ResourcePath resourceContainer, String resourceId)Returns a new read request with the provided resource container path, and resource ID.static UpdateRequestnewUpdateRequest(String resourceContainer, String resourceId, JsonValue newContent)Returns a new update request with the provided resource container path, resource ID, and new JSON content.static UpdateRequestnewUpdateRequest(String resourcePath, JsonValue newContent)Returns a new update request with the provided resource path and new JSON content.static UpdateRequestnewUpdateRequest(CreateRequest createRequest)Returns a new update request built based on the provided create request.static UpdateRequestnewUpdateRequest(ResourcePath resourceContainer, String resourceId, JsonValue newContent)Returns a new update request with the provided resource container path, resource ID, and new JSON content.static UpdateRequestnewUpdateRequest(ResourcePath resourcePath, JsonValue newContent)Returns a new update request with the provided resource path and new JSON content.
-
-
-
Method Detail
-
copyOfActionRequest
public static ActionRequest copyOfActionRequest(ActionRequest request)
Returns a copy of the provided action request.- Parameters:
request- The action request to be copied.- Returns:
- The action request copy.
-
copyOfCreateRequest
public static CreateRequest copyOfCreateRequest(CreateRequest request)
Returns a copy of the provided create request.- Parameters:
request- The create request to be copied.- Returns:
- The create request copy.
-
copyOfDeleteRequest
public static DeleteRequest copyOfDeleteRequest(DeleteRequest request)
Returns a copy of the provided delete request.- Parameters:
request- The delete request to be copied.- Returns:
- The delete request copy.
-
copyOfPatchRequest
public static PatchRequest copyOfPatchRequest(PatchRequest request)
Returns a copy of the provided patch request.- Parameters:
request- The patch request to be copied.- Returns:
- The patch request copy.
-
copyOfQueryRequest
public static QueryRequest copyOfQueryRequest(QueryRequest request)
Returns a copy of the provided query request.- Parameters:
request- The query request to be copied.- Returns:
- The query request copy.
-
copyOfReadRequest
public static ReadRequest copyOfReadRequest(ReadRequest request)
Returns a copy of the provided read request.- Parameters:
request- The read request to be copied.- Returns:
- The read request copy.
-
copyOfUpdateRequest
public static UpdateRequest copyOfUpdateRequest(UpdateRequest request)
Returns a copy of the provided update request.- Parameters:
request- The update request to be copied.- Returns:
- The update request copy.
-
copyOfApiRequest
public static Request copyOfApiRequest(Request request)
Returns a copy of the provided api request.- Parameters:
request- The api request to be copied.- Returns:
- The api request copy.
-
newActionRequest
public static ActionRequest newActionRequest(String resourcePath, String actionId)
Returns a new action request with the provided resource path and action ID. Invoking this method as follows:newActionRequest("users/1", actionId);Is equivalent to:newActionRequest("users", "1", actionId);Except that the resource ID is already URL encoded in the first form.- Parameters:
resourcePath- The URL-encoded resource path.actionId- The action ID.- Returns:
- The new action request.
-
newActionRequest
public static ActionRequest newActionRequest(ResourcePath resourcePath, String actionId)
Returns a new action request with the provided resource path and action ID.- Parameters:
resourcePath- The parsed resource path.actionId- The action ID.- Returns:
- The new action request.
-
newActionRequest
public static ActionRequest newActionRequest(String resourceContainer, String resourceId, String actionId)
Returns a new action request with the provided resource container path, resource ID, and action ID. Invoking this method as follows:newActionRequest("users", "1", "someAction");Is equivalent to:newActionRequest("users/1", "someAction");Except that the resource ID is already URL encoded in the second form.- Parameters:
resourceContainer- The URL-encoded path of the resource container.resourceId- The URL decoded ID of the resource.actionId- The action ID.- Returns:
- The new action request.
-
newActionRequest
public static ActionRequest newActionRequest(ResourcePath resourceContainer, String resourceId, String actionId)
Returns a new action request with the provided resource container path, resource ID, and action ID.- Parameters:
resourceContainer- The parsed path of the resource container.resourceId- The URL decoded ID of the resource.actionId- The action ID.- Returns:
- The new action request.
-
newCreateRequest
public static CreateRequest newCreateRequest(String resourceContainer, JsonValue content)
Returns a new create request with the provided resource path, and JSON content. The create request will have anullnew resource ID, indicating that the server will be responsible for generating the ID of the new resource. Invoking this method as follows:newCreateRequest("users/1", content);Is equivalent to:newCreateRequest("users", "1", content);Except that the resource ID is already URL encoded in the first form.- Parameters:
resourceContainer- The URL-encoded path of the resource container beneath which the new resource should be created.content- The JSON content.- Returns:
- The new create request.
-
newCreateRequest
public static CreateRequest newCreateRequest(ResourcePath resourceContainer, JsonValue content)
Returns a new create request with the provided resource path, and JSON content. The create request will have anullnew resource ID, indicating that the server will be responsible for generating the ID of the new resource.- Parameters:
resourceContainer- The parsed path of the resource container beneath which the new resource should be created.content- The JSON content.- Returns:
- The new create request.
-
newCreateRequest
public static CreateRequest newCreateRequest(String resourceContainer, String newResourceId, JsonValue content)
Returns a new create request with the provided resource path, new resource ID, and JSON content. Invoking this method as follows:newCreateRequest("users", "1", content);Is equivalent to:newCreateRequest("users", content).setNewResourceId("1");Except that the resource ID is already URL encoded in the second form.- Parameters:
resourceContainer- The URL-encoded path of the resource container beneath which the new resource should be created.newResourceId- The URL decoded client provided ID of the resource to be created, ornullif the server should be responsible for generating the resource ID.content- The JSON content.- Returns:
- The new create request.
-
newCreateRequest
public static CreateRequest newCreateRequest(ResourcePath resourceContainer, String newResourceId, JsonValue content)
Returns a new create request with the provided resource path, new resource ID, and JSON content.- Parameters:
resourceContainer- The parsed path of the resource container beneath which the new resource should be created.newResourceId- The URL decoded client provided ID of the resource to be created, ornullif the server should be responsible for generating the resource ID.content- The JSON content.- Returns:
- The new create request.
-
newDeleteRequest
public static DeleteRequest newDeleteRequest(String resourcePath)
Returns a new delete request with the provided resource path. Invoking this method as follows:newDeleteRequest("users/1");Is equivalent to:newDeleteRequest("users", "1");Except that the resource ID is already URL encoded in the first form.- Parameters:
resourcePath- The URL-encoded resource path.- Returns:
- The new delete request.
-
newDeleteRequest
public static DeleteRequest newDeleteRequest(ResourcePath resourcePath)
Returns a new delete request with the provided resource path.- Parameters:
resourcePath- The parsed resource path.- Returns:
- The new delete request.
-
newDeleteRequest
public static DeleteRequest newDeleteRequest(String resourceContainer, String resourceId)
Returns a new delete request with the provided resource container path, and resource ID. Invoking this method as follows:newDeleteRequest("users", "1");Is equivalent to:newDeleteRequest("users/1");Except that the resource ID is already URL encoded in the second form.- Parameters:
resourceContainer- The URL-encoded path of the resource container.resourceId- The URL decoded ID of the resource.- Returns:
- The new delete request.
-
newDeleteRequest
public static DeleteRequest newDeleteRequest(ResourcePath resourceContainer, String resourceId)
Returns a new delete request with the provided resource container path, and resource ID.- Parameters:
resourceContainer- The parsed path of the resource container.resourceId- The URL decoded ID of the resource.- Returns:
- The new delete request.
-
newPatchRequest
public static PatchRequest newPatchRequest(String resourcePath, PatchOperation... operations)
Returns a new patch request with the provided resource path and JSON patch operations. Invoking this method as follows:newPatchRequest("users/1", operations);Is equivalent to:newPatchRequest("users", "1", operations);Except that the resource ID is already URL encoded in the first form.- Parameters:
resourcePath- The URL-encoded resource path.operations- The JSON patch operations.- Returns:
- The new patch request.
-
newPatchRequest
public static PatchRequest newPatchRequest(ResourcePath resourcePath, PatchOperation... operations)
Returns a new patch request with the provided resource path and JSON patch operations.- Parameters:
resourcePath- The parsed resource path.operations- The JSON patch operations.- Returns:
- The new patch request.
-
newPatchRequest
public static PatchRequest newPatchRequest(String resourceContainer, String resourceId, PatchOperation... operations)
Returns a new patch request with the provided resource container path, resource ID, and JSON patch operations. Invoking this method as follows:newPatchRequest("users", "1", operations);Is equivalent to:newPatchRequest("users/1", operations);Except that the resource ID is already URL encoded in the second form.- Parameters:
resourceContainer- The URL-encoded path of the resource container.resourceId- The URL decoded ID of the resource.operations- The JSON patch operations.- Returns:
- The new patch request.
-
newPatchRequest
public static PatchRequest newPatchRequest(ResourcePath resourceContainer, String resourceId, PatchOperation... operations)
Returns a new patch request with the provided resource container path, resource ID, and JSON patch operations.- Parameters:
resourceContainer- The parsed path of the resource container.resourceId- The URL decoded ID of the resource.operations- The JSON patch operations.- Returns:
- The new patch request.
-
newQueryRequest
public static QueryRequest newQueryRequest(String resourceContainer)
Returns a new query request with the provided resource container path. Example:newQueryRequest("users");- Parameters:
resourceContainer- The URL-encoded path of the resource container.- Returns:
- The new query request.
-
newQueryRequest
public static QueryRequest newQueryRequest(ResourcePath resourceContainer)
Returns a new query request with the provided resource container path. Example:newQueryRequest(ResourcePath.valueOf("users"));- Parameters:
resourceContainer- The parsed path of the resource container.- Returns:
- The new query request.
-
newReadRequest
public static ReadRequest newReadRequest(String resourcePath)
Returns a new read request with the provided resource path. Invoking this method as follows:newReadRequest("users/1");Is equivalent to:newReadRequest("users", "1");Except that the resource ID is already URL encoded in the first form.- Parameters:
resourcePath- The URL-encoded resource path.- Returns:
- The new read request.
-
newReadRequest
public static ReadRequest newReadRequest(ResourcePath resourcePath)
Returns a new read request with the provided resource path.- Parameters:
resourcePath- The parsed resource path.- Returns:
- The new read request.
-
newReadRequest
public static ReadRequest newReadRequest(String resourceContainer, String resourceId)
Returns a new read request with the provided resource container path, and resource ID. Invoking this method as follows:newReadRequest("users", "1");Is equivalent to:newReadRequest("users/1");Except that the resource ID is already URL encoded in the second form.- Parameters:
resourceContainer- The URL-encoded path of the resource container.resourceId- The URL decoded ID of the resource.- Returns:
- The new read request.
-
newReadRequest
public static ReadRequest newReadRequest(ResourcePath resourceContainer, String resourceId)
Returns a new read request with the provided resource container path, and resource ID.- Parameters:
resourceContainer- The parsed path of the resource container.resourceId- The URL decoded ID of the resource.- Returns:
- The new read request.
-
newUpdateRequest
public static UpdateRequest newUpdateRequest(String resourcePath, JsonValue newContent)
Returns a new update request with the provided resource path and new JSON content. Invoking this method as follows:newUpdateRequest("users/1", newContent);Is equivalent to:newUpdateRequest("users", "1", newContent);Except that the resource ID is already URL encoded in the first form.- Parameters:
resourcePath- The URL-encoded resource path.newContent- The new JSON content.- Returns:
- The new update request.
-
newUpdateRequest
public static UpdateRequest newUpdateRequest(ResourcePath resourcePath, JsonValue newContent)
Returns a new update request with the provided resource path and new JSON content.- Parameters:
resourcePath- The parsed resource path.newContent- The new JSON content.- Returns:
- The new update request.
-
newUpdateRequest
public static UpdateRequest newUpdateRequest(CreateRequest createRequest)
Returns a new update request built based on the provided create request.- Parameters:
createRequest- The create request.- Returns:
- The new update request.
-
newUpdateRequest
public static UpdateRequest newUpdateRequest(String resourceContainer, String resourceId, JsonValue newContent)
Returns a new update request with the provided resource container path, resource ID, and new JSON content. Invoking this method as follows:newUpdateRequest("users", "1", newContent);Is equivalent to:newUpdateRequest("users/1", newContent);Except that the resource ID is already URL encoded in the second form.- Parameters:
resourceContainer- The URL-encoded path of the resource container.resourceId- The URL decoded ID of the resource.newContent- The new JSON content.- Returns:
- The new update request.
-
newUpdateRequest
public static UpdateRequest newUpdateRequest(ResourcePath resourceContainer, String resourceId, JsonValue newContent)
Returns a new update request with the provided resource container path, resource ID, and new JSON content.- Parameters:
resourceContainer- The parsed path of the resource container.resourceId- The URL decoded ID of the resource.newContent- The new JSON content.- Returns:
- The new update request.
-
newApiRequest
public static Request newApiRequest(ResourcePath path)
Returns a new API request with the provided path.- Parameters:
path- The path.- Returns:
- The request.
-
-