Class AbstractPostResponseWrapper

  • All Implemented Interfaces:
    PostResponse

    public abstract class AbstractPostResponseWrapper
    extends Object
    implements PostResponse
    Provides a simple implementation of PostResponse that can be subclassed by developers wishing to provide specialized behavior to an existing PostResponse instance. The default implementation of all methods is to call through to the wrapped PostResponse instance.
    • Constructor Detail

      • AbstractPostResponseWrapper

        public AbstractPostResponseWrapper()
    • Method Detail

      • getWrapped

        public abstract PostResponse getWrapped()
        Use this method to return an instance of the class being wrapped.
        Returns:
        the wrapped PostResponse instance
      • setPath

        public void setPath​(String path)
        Description copied from interface: PostResponse
        Sets the absolute path of the item upon which the request operated.
        Specified by:
        setPath in interface PostResponse
      • setCreateRequest

        public void setCreateRequest​(boolean isCreateRequest)
        Description copied from interface: PostResponse
        Sets whether the request was a create request or not.
        Specified by:
        setCreateRequest in interface PostResponse
      • setParentLocation

        public void setParentLocation​(String parentLocation)
        Description copied from interface: PostResponse
        Sets the parent location of the modification. This is the externalized form of the parent node of the current path.
        Specified by:
        setParentLocation in interface PostResponse
      • setTitle

        public void setTitle​(String title)
        Description copied from interface: PostResponse
        Sets the title of the response message
        Specified by:
        setTitle in interface PostResponse
        Parameters:
        title - the title
      • setStatus

        public void setStatus​(int code,
                              String message)
        Description copied from interface: PostResponse
        Sets the response status code properties
        Specified by:
        setStatus in interface PostResponse
        Parameters:
        code - the code
        message - the message
      • getStatusCode

        public int getStatusCode()
        Description copied from interface: PostResponse
        Returns the status code of this instance. If the status code has never been set by calling the PostResponse.setStatus(int, String) method, the status code is determined by checking if there was an error. If there was an error, the response is assumed to be unsuccessful and 500 is returned. If there is no error, the response is assumed to be successful and 200 is returned.
        Specified by:
        getStatusCode in interface PostResponse
      • setError

        public void setError​(Throwable error)
        Description copied from interface: PostResponse
        Sets the recorded error causing the operation to fail.
        Specified by:
        setError in interface PostResponse
      • onCreated

        public void onCreated​(String path)
        Description copied from interface: PostResponse
        Records a 'created' change
        Specified by:
        onCreated in interface PostResponse
        Parameters:
        path - path of the item that was created
      • onModified

        public void onModified​(String path)
        Description copied from interface: PostResponse
        Records a 'modified' change
        Specified by:
        onModified in interface PostResponse
        Parameters:
        path - path of the item that was modified
      • onDeleted

        public void onDeleted​(String path)
        Description copied from interface: PostResponse
        Records a 'deleted' change
        Specified by:
        onDeleted in interface PostResponse
        Parameters:
        path - path of the item that was deleted
      • onMoved

        public void onMoved​(String srcPath,
                            String dstPath)
        Description copied from interface: PostResponse
        Records a 'moved' change.

        Note: the moved change only records the basic move command. the implied changes on the moved properties and sub nodes are not recorded.

        Specified by:
        onMoved in interface PostResponse
        Parameters:
        srcPath - source path of the node that was moved
        dstPath - destination path of the node that was moved.
      • onCopied

        public void onCopied​(String srcPath,
                             String dstPath)
        Description copied from interface: PostResponse
        Records a 'copied' change.

        Note: the copy change only records the basic copy command. the implied changes on the copied properties and sub nodes are not recorded.

        Specified by:
        onCopied in interface PostResponse
        Parameters:
        srcPath - source path of the node that was copied
        dstPath - destination path of the node that was copied.
      • onChange

        public void onChange​(String type,
                             String... arguments)
        Description copied from interface: PostResponse
        Records a generic change of the given type with arguments.
        Specified by:
        onChange in interface PostResponse
        Parameters:
        type - The type of the modification
        arguments - The arguments to the modifications
      • send

        public void send​(HttpServletResponse response,
                         boolean setStatus)
                  throws IOException
        Description copied from interface: PostResponse
        Writes the response back over the provided HTTP channel. The actual format of the response is implementation dependent.
        Specified by:
        send in interface PostResponse
        Parameters:
        response - to send to
        setStatus - whether to set the status code on the response
        Throws:
        IOException - if an i/o exception occurs