Class ParentChildRestfulService


  • public class ParentChildRestfulService
    extends Object
    The ParentChildRestfulService is the restful layer on top of ParentChildService. It provides several Restful APIs that are meant to handle HTTP calls and adapt them for calls onto the ParentChildService. This service also catches exceptions (such as ParentChildWhatIfException) and generates an HTTP response back indicating an exception was thrown.
    Author:
    ActiveViam
    • Field Detail

      • LOGGER

        protected static Logger LOGGER
    • Constructor Detail

      • ParentChildRestfulService

        public ParentChildRestfulService()
    • Method Detail

      • parentChildNodes

        @GET
        @Path("/tree/from/{branch}/at/{asOfDate}")
        @Produces("application/json")
        @Consumes("application/json")
        public javax.ws.rs.core.Response parentChildNodes​(@PathParam("branch")
                                                          String branch,
                                                          @PathParam("asOfDate")
                                                          String asOfDate)
        This method provides a way to retrieve the book parent child nodes of a particular branch and asofDate from the book parent child datastore. This method works on top of ParentChildService.getParentChildNodes(String, String, LocalDate) } Nodes retrieved from the datastore are embedded in the javax response body in a JSON format and a hierarchy. Because authorization uses spring security the user name and authentication will be used from the spring SecurityContextHolder.
        Parameters:
        branch - The branch we are getting the tree from. If null we default to the master branch. Maps to PathParam of URI.
        asOfDate - The asOfDate we are getting the tree from. Maps to PathParam of URI.
        Returns:
        Javax response with either a failure message for internal failure or the tree data.
      • createBranch

        @PUT
        @Path("/branch/{branch}/at/{asOfDate}")
        @Produces("text/plain")
        @Consumes("application/json")
        public javax.ws.rs.core.Response createBranch​(@PathParam("branch")
                                                      String branch,
                                                      @PathParam("asOfDate")
                                                      String asOfDate,
                                                      @QueryParam("definition")
                                                      String definition,
                                                      String data)
        This method provides a way to create a new branch off of master and asofDate from the book parent child datastore and provided changes to that new branch. This method works on top of ParentChildService.createBranchFromMaster(String, String, String, LocalDate, ParentChildNode) Nodes retrieved from the datastore are embedded in the javax response body in a JSON format and a hierarchy. Because authorization uses spring security the user name and authentication will be used from the spring SecurityContextHolder.
        Parameters:
        branch - The branch we are getting the tree from. If null we default to the master branch. Maps to PathParam of URI.
        asOfDate - The asOfDate we are getting the tree from. Maps to PathParam of URI.
        definition - The definition name use in the WhatIf submission. Maps to a QueryParam of the URI.
        data - The JSON body from the HTTP call. Will be converted to a tree hierarchy of ParentChildNode.
        Returns:
        Javax response with either a failure message for internal failure or the tree data.
      • updateParentChildFromTree

        @PUT
        @Path("/tree/into/{branch}/at/{asOfDate}")
        @Produces("text/plain")
        @Consumes("application/json")
        public javax.ws.rs.core.Response updateParentChildFromTree​(@PathParam("branch")
                                                                   String branch,
                                                                   @PathParam("asOfDate")
                                                                   String asOfDate,
                                                                   @QueryParam("definition")
                                                                   String definition,
                                                                   String data)
        This method provides a way to update a current branch with tree changes. This method works on top of ParentChildService.updateParentChildFromTree(String, String, String, LocalDate, ParentChildNode) Nodes retrieved from the datastore are embedded in the javax response body in a JSON format and a hierarchy. Because authorization uses spring security the user name and authentication will be used from the spring SecurityContextHolder.
        Parameters:
        branch - The branch we are getting the tree from. If null we default to the master branch. Maps to PathParam of URI.
        asOfDate - The asOfDate we are getting the tree from. Maps to PathParam of URI.
        definition - The definition name use in the WhatIf submission. Maps to a QueryParam of the URI.
        data - The JSON body from the HTTP call. Will be converted to a tree hierarchy of ParentChildNode.
        Returns:
        Javax response with either a failure message for internal failure or the tree data.
      • setParentChildService

        public void setParentChildService​(ParentChildService parentChildService)