Interface CreateRequest
- All Superinterfaces:
Request
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name of the action which is reserved for performing "create" operations.static final String
The name of the field which contains the resource content in the JSON representation.static final String
The name of the field which contains the new resource ID in the JSON representation.Fields inherited from interface org.forgerock.json.resource.Request
FIELD_ADDITIONAL_PARAMETERS, FIELD_FIELDS, FIELD_RESOURCE_PATH, FIELD_VALUE_ALL
-
Method Summary
Modifier and TypeMethodDescription<R,
P> R accept
(RequestVisitor<R, P> v, P p) Applies aRequestVisitor
to thisRequest
.Adds one or more fields which should be included with each JSON resource returned by this request.addField
(JsonPointer... fields) Adds one or more fields which should be included with each JSON resource returned by this request.getAdditionalParameter
(String name) Returns the additional parameter which should be used to control the behavior of this action request.Returns the additional parameters which should be used to control the behavior of this action request.Returns the content of the JSON resource to be created.Returns the list of fields which should be included with each JSON resource returned by this request.Returns the client provided ID of the resource to be created.Get the locale preference for the request.Returns the type of this request.Returns the path of the JSON resource container beneath which the new resource should be created.Returns the non-null
path of the JSON resource to which this request should be targeted.org.forgerock.http.routing.Version
Gets the requested API version of the resource.setAdditionalParameter
(String name, String value) Sets an additional parameter which should be used to control the behavior of this action request.setContent
(JsonValue content) Sets the content of the JSON resource to be created.Sets the client provided ID of the resource to be created.setPreferredLocales
(PreferredLocales preferredLocales) Set the locale preference for the request.setResourcePath
(String path) Sets the path of the JSON resource container beneath which the new resource should be created.setResourcePath
(ResourcePath path) Sets the non-null
path of the JSON resource to which this request should be targeted.setResourceVersion
(org.forgerock.http.routing.Version resourceVersion) Sets the requested API version of the resource.Return a JsonValue representation of this request.
-
Field Details
-
ACTION_ID_CREATE
The name of the action which is reserved for performing "create" operations. -
FIELD_CONTENT
The name of the field which contains the resource content in the JSON representation.- See Also:
-
FIELD_NEW_RESOURCE_ID
The name of the field which contains the new resource ID in the JSON representation.- See Also:
-
-
Method Details
-
accept
Description copied from interface:Request
Applies aRequestVisitor
to thisRequest
. -
addField
Description copied from interface:Request
Adds one or more fields which should be included with each JSON resource returned by this request. -
addField
Description copied from interface:Request
Adds one or more fields which should be included with each JSON resource returned by this request. -
getAdditionalParameter
Description copied from interface:Request
Returns the additional parameter which should be used to control the behavior of this action request.- Specified by:
getAdditionalParameter
in interfaceRequest
- Parameters:
name
- The name of the additional parameter.- Returns:
- The additional parameter which should be used to control the behavior of this action request
-
getAdditionalParameters
Description copied from interface:Request
Returns the additional parameters which should be used to control the behavior of this action request. The returned map may be modified if permitted by this action request.- Specified by:
getAdditionalParameters
in interfaceRequest
- Returns:
- The additional parameters which should be used to control the behavior of this action request (never
null
).
-
getContent
JsonValue getContent()Returns the content of the JSON resource to be created.- Returns:
- The content of the JSON resource to be created.
-
getFields
List<JsonPointer> getFields()Description copied from interface:Request
Returns the list of fields which should be included with each JSON resource returned by this request. The returned list may be modified if permitted by this query request. An empty list indicates that all fields should be included.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.
-
getNewResourceId
String getNewResourceId()Returns the client provided ID of the resource to be created. The new resource ID will be appended to the resource path in order to obtain the full path of the new resource.The new resource ID is optional and should be used in cases where the client wishes to determine the path of the resource to be created. If the new resource ID is not provided then the server will be responsible for generating the ID of the new resource.
- Returns:
- The client provided ID of the resource to be created, or
null
if the server should be responsible for generating the resource ID. - See Also:
-
getPreferredLocales
PreferredLocales getPreferredLocales()Description copied from interface:Request
Get the locale preference for the request.- Specified by:
getPreferredLocales
in interfaceRequest
- Returns:
- The
PreferredLocales
instance for the request.
-
getRequestType
RequestType getRequestType()Description copied from interface:Request
Returns the type of this request.- Specified by:
getRequestType
in interfaceRequest
- Returns:
- The type of this request.
-
getResourcePath
String getResourcePath()Returns the path of the JSON resource container beneath which the new resource should be created.The path of the newly created resource will be the concatenation of the resource path and either the client provided resource ID, if provided, or a server generated resource ID.
- Specified by:
getResourcePath
in interfaceRequest
- Returns:
- The path of the JSON resource container beneath which the new resource should be created.
- See Also:
-
getResourcePathObject
ResourcePath getResourcePathObject()Description copied from interface:Request
Returns the non-null
path of the JSON resource to which this request should be targeted. The resource path is relative and never begins or ends with a forward slash, but may be empty.NOTE: for resource provider implementations the resource path is relative to the current resource being accessed. See the description of
UriRouterContext
for more information.- Specified by:
getResourcePathObject
in interfaceRequest
- Returns:
- The non-
null
path of the JSON resource to which this request should be targeted, which may be the empty string.
-
getResourceVersion
org.forgerock.http.routing.Version getResourceVersion()Description copied from interface:Request
Gets the requested API version of the resource.- Specified by:
getResourceVersion
in interfaceRequest
- Returns:
- The requested API version of the resource.
-
setAdditionalParameter
Description copied from interface:Request
Sets an additional parameter which should be used to control the behavior of this action request.- Specified by:
setAdditionalParameter
in interfaceRequest
- Parameters:
name
- The name of the additional parameter.value
- The additional parameter's value.- Returns:
- This request.
- Throws:
BadRequestException
- If this request does not permit the additional parameter to be set.
-
setContent
Sets the content of the JSON resource to be created.- Parameters:
content
- The content of the JSON resource to be created.- Returns:
- This create request.
- Throws:
UnsupportedOperationException
- If this create request does not permit changes to the content.
-
setNewResourceId
Sets the client provided ID of the resource to be created. The new resource ID will be appended to the resource path in order to obtain the full path of the new resource.The new resource ID is optional and should be used in cases where the client wishes to determine the path of the resource to be created. If the new resource ID is not provided then the server will be responsible for generating the ID of the new resource.
- Parameters:
id
- The client provided ID of the resource to be created, ornull
if the server should be responsible for generating the resource ID.- Returns:
- This create request.
- Throws:
UnsupportedOperationException
- If this create request does not permit changes to the new resource ID.- See Also:
-
setPreferredLocales
Description copied from interface:Request
Set the locale preference for the request.- Specified by:
setPreferredLocales
in interfaceRequest
- Parameters:
preferredLocales
- ThePreferredLocales
instance for the request.- Returns:
- This request.
-
setResourcePath
Sets the path of the JSON resource container beneath which the new resource should be created.The path of the newly created resource will be the concatenation of the resource path and either the client provided resource ID, if provided, or a server generated resource ID.
- Specified by:
setResourcePath
in interfaceRequest
- Parameters:
path
- The path of the JSON resource container beneath which the new resource should be created.- Returns:
- This create request.
- Throws:
UnsupportedOperationException
- If this create request does not permit changes to the resource path.- See Also:
-
setResourcePath
Description copied from interface:Request
Sets the non-null
path of the JSON resource to which this request should be targeted. The resource path is relative and never begins or ends with a forward slash, but may be empty.NOTE: for resource provider implementations the resource path is relative to the current resource being accessed. See the description of
UriRouterContext
for more information.- Specified by:
setResourcePath
in interfaceRequest
- Parameters:
path
- The non-null
path of the JSON resource to which this request should be targeted, which may be the empty string.- Returns:
- This request.
-
setResourceVersion
Description copied from interface:Request
Sets the requested API version of the resource.- Specified by:
setResourceVersion
in interfaceRequest
- Parameters:
resourceVersion
- The requested API version of the resource.- Returns:
- This request.
-
toJsonValue
JsonValue toJsonValue()Description copied from interface:Request
Return a JsonValue representation of this request.- Specified by:
toJsonValue
in interfaceRequest
- Returns:
- this request as a JsonValue
-