Class ParentChildRestfulService
- java.lang.Object
-
- com.activeviam.risk.ref.whatif.rest.services.impl.ParentChildRestfulService
-
public class ParentChildRestfulService extends Object
The ParentChildRestfulService is the restful layer on top ofParentChildService
. It provides several Restful APIs that are meant to handle HTTP calls and adapt them for calls onto theParentChildService
. This service also catches exceptions (such asParentChildWhatIfException
) and generates an HTTP response back indicating an exception was thrown.- Author:
- ActiveViam
-
-
Constructor Summary
Constructors Constructor Description ParentChildRestfulService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
createBranch(String branch, String asOfDate, 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.javax.ws.rs.core.Response
parentChildNodes(String branch, 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.void
setParentChildService(ParentChildService parentChildService)
javax.ws.rs.core.Response
updateParentChildFromTree(String branch, String asOfDate, String definition, String data)
This method provides a way to update a current branch with tree changes.
-
-
-
Field Detail
-
LOGGER
protected static Logger LOGGER
-
-
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 ofParentChildService.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 ofParentChildService.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 ofParentChildNode
.- 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 ofParentChildService.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 ofParentChildNode
.- Returns:
- Javax response with either a failure message for internal failure or the tree data.
-
setParentChildService
public void setParentChildService(ParentChildService parentChildService)
-
-