Interface PatchRequest

  • All Superinterfaces:
    Request

    public interface PatchRequest
    extends Request
    A request to update a JSON resource by applying a set of changes to its existing content. See the documentation for PatchOperation for more details regarding the various types of patch operation, and their semantics.
    • Field Detail

      • FIELD_PATCH

        static final String FIELD_PATCH
        The name of the field which contains the patch content in the JSON representation.
        See Also:
        Constant Field Values
      • FIELD_PATCH_OPERATIONS

        static final String FIELD_PATCH_OPERATIONS
        The name of the field which contains the patch operations in the JSON representation.
        See Also:
        Constant Field Values
      • FIELD_REVISION

        static final String FIELD_REVISION
        The name of the field which contains the resource version in the JSON representation.
        See Also:
        Constant Field Values
    • Method Detail

      • accept

        <R,​P> R accept​(RequestVisitor<R,​P> v,
                             P p)
        Description copied from interface: Request
        Applies a RequestVisitor to this Request.
        Specified by:
        accept in interface Request
        Type Parameters:
        R - The return type of the visitor's methods.
        P - The type of the additional parameters to the visitor's methods.
        Parameters:
        v - The request visitor.
        p - Optional additional visitor parameter.
        Returns:
        A result as specified by the visitor.
      • addField

        PatchRequest addField​(JsonPointer... fields)
        Description copied from interface: Request
        Adds one or more fields which should be included with each JSON resource returned by this request.
        Specified by:
        addField in interface Request
        Parameters:
        fields - The fields which should be included with each JSON resource returned by this request.
        Returns:
        This request.
      • addField

        PatchRequest addField​(String... fields)
        Description copied from interface: Request
        Adds one or more fields which should be included with each JSON resource returned by this request.
        Specified by:
        addField in interface Request
        Parameters:
        fields - The fields which should be included with each JSON resource returned by this request.
        Returns:
        This request.
      • addPatchOperation

        PatchRequest addPatchOperation​(PatchOperation... operations)
        Adds one or more patch operations which should be performed against the targeted resource.
        Parameters:
        operations - One or more patch operations which should be performed against the targeted resource.
        Returns:
        This patch request.
        Throws:
        UnsupportedOperationException - If this patch request does not permit changes to the patch operations.
      • addPatchOperation

        PatchRequest addPatchOperation​(String operation,
                                       String field,
                                       JsonValue value)
        Adds a single patch operation which should be performed against the targeted resource.
        Parameters:
        operation - The type of patch operation to be performed.
        field - The field targeted by the patch operation.
        value - The possibly null value for the patch operation.
        Returns:
        This patch request.
        Throws:
        UnsupportedOperationException - If this patch request does not permit changes to the patch operations.
      • getAdditionalParameter

        String getAdditionalParameter​(String name)
        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 interface Request
        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

        Map<String,​String> 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 interface Request
        Returns:
        The additional parameters which should be used to control the behavior of this action request (never null).
      • 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.

        Specified by:
        getFields in interface Request
        Returns:
        The list of fields which should be included with each JSON resource returned by this request (never null).
      • getPatchOperations

        List<PatchOperation> getPatchOperations()
        Returns the list of patch operations which should be performed against the targeted resource.
        Returns:
        The list of patch operations which should be performed against the targeted resource (never null).
      • getPreferredLocales

        PreferredLocales getPreferredLocales()
        Description copied from interface: Request
        Get the locale preference for the request.
        Specified by:
        getPreferredLocales in interface Request
        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 interface Request
        Returns:
        The type of this request.
      • getResourcePath

        String getResourcePath()
        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:
        getResourcePath in interface Request
        Returns:
        The non-null path of the JSON resource to which this request should be targeted, which may be the empty string.
      • 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 interface Request
        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 interface Request
        Returns:
        The requested API version of the resource.
      • getRevision

        String getRevision()
        Returns the expected version information associated with the JSON resource to be patched. Version information can be used in order to implement multi-version concurrency control (MVCC).

        The returned version information may be null indicating that the client does not care if the resource has been modified concurrently. If the version information is non-null, and it does not match the current version of the targeted JSON resource, then the patch request will be rejected by the provider.

        Returns:
        The expected version information associated with the JSON resource to be patched.
      • setAdditionalParameter

        PatchRequest setAdditionalParameter​(String name,
                                            String value)
                                     throws BadRequestException
        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 interface Request
        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.
      • setPreferredLocales

        PatchRequest setPreferredLocales​(PreferredLocales preferredLocales)
        Description copied from interface: Request
        Set the locale preference for the request.
        Specified by:
        setPreferredLocales in interface Request
        Parameters:
        preferredLocales - The PreferredLocales instance for the request.
        Returns:
        This request.
      • setResourcePath

        PatchRequest setResourcePath​(ResourcePath path)
        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 interface Request
        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.
      • setResourcePath

        PatchRequest setResourcePath​(String path)
        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 interface Request
        Parameters:
        path - The non-null path of the JSON resource to which this request should be targeted, which may be the empty string. The path should be URL-encoded.
        Returns:
        This request.
      • setResourceVersion

        PatchRequest setResourceVersion​(org.forgerock.http.routing.Version resourceVersion)
        Description copied from interface: Request
        Sets the requested API version of the resource.
        Specified by:
        setResourceVersion in interface Request
        Parameters:
        resourceVersion - The requested API version of the resource.
        Returns:
        This request.
      • setRevision

        PatchRequest setRevision​(String version)
        Sets the expected version information associated with the JSON resource to be patched. Version information can be used in order to implement multi-version concurrency control (MVCC).

        The provided version information may be null indicating that the client does not care if the resource has been modified concurrently. If the version information is non-null, and it does not match the current version of the targeted JSON resource, then the patch request will be rejected by the provider.

        Parameters:
        version - The expected version information associated with the JSON resource to be patched.
        Returns:
        This patch request.
        Throws:
        UnsupportedOperationException - If this patch request does not permit changes to the version information.
      • toJsonValue

        JsonValue toJsonValue()
        Description copied from interface: Request
        Return a JsonValue representation of this request.
        Specified by:
        toJsonValue in interface Request
        Returns:
        this request as a JsonValue