Package de.otto.synapse.edison.state
Class StateRepositoryRestController
java.lang.Object
de.otto.synapse.edison.state.StateRepositoryRestController
@Controller
@ConditionalOnBean(de.otto.synapse.state.StateRepository.class)
@ConditionalOnProperty(prefix="synapse.edison.state.ui",
name="enabled",
havingValue="true",
matchIfMissing=true)
public class StateRepositoryRestController
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description StateRepositoryRestController(java.util.List<de.otto.synapse.state.StateRepository<?>> stateRepositories, de.otto.synapse.journal.JournalRegistry journals, EdisonStateRepositoryUiProperties properties, java.lang.String managementBasePath) -
Method Summary
Modifier and Type Method Description de.otto.edison.hal.HalRepresentationgetEntityJson(java.lang.String repositoryName, java.lang.String entityId, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)Returns an application/hal+json representation of a single event-sourced entity stored in theStateRepositorywith the specifiedrepositoryName.de.otto.edison.hal.HalRepresentationgetStateRepositories(javax.servlet.http.HttpServletRequest request)Returns an application/hal+json representation of the container-resource containing all staterepositories that are notexcludedfrom the state-repository UI.de.otto.edison.hal.HalRepresentationgetStateRepository(java.lang.String repositoryName, int page, int pageSize, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)Returns an application/hal+json representation of aStateRepository, containing a pageable collection resource with links to the event-sourced entities stored in the repository.
-
Constructor Details
-
StateRepositoryRestController
public StateRepositoryRestController(java.util.List<de.otto.synapse.state.StateRepository<?>> stateRepositories, de.otto.synapse.journal.JournalRegistry journals, EdisonStateRepositoryUiProperties properties, @Value("${edison.application.management.base-path:internal}") java.lang.String managementBasePath)
-
-
Method Details
-
getStateRepositories
@GetMapping(path="${edison.application.management.base-path:internal}/staterepositories", produces={"application/hal+json","application/json"}) @ResponseBody public de.otto.edison.hal.HalRepresentation getStateRepositories(javax.servlet.http.HttpServletRequest request)Returns an application/hal+json representation of the container-resource containing all staterepositories that are notexcludedfrom the state-repository UI.- Parameters:
request- current HttpServletRequest- Returns:
- HalRepresentation of the collection of state repositories
-
getStateRepository
@GetMapping(path="${edison.application.management.base-path:internal}/staterepositories/{repositoryName}", produces={"application/hal+json","application/json"}) @ResponseBody public de.otto.edison.hal.HalRepresentation getStateRepository(@PathVariable java.lang.String repositoryName, @RequestParam(defaultValue="0") int page, @RequestParam(defaultValue="100") int pageSize, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)Returns an application/hal+json representation of aStateRepository, containing a pageable collection resource with links to the event-sourced entities stored in the repository.- Parameters:
repositoryName- the name of the StateRepositorypage- the zero-based page numberpageSize- the number of entities to returnuriComponentsBuilder- builder used to create hrefs- Returns:
- HalRepresentation of the paged collection resource
-
getEntityJson
@GetMapping(path="${edison.application.management.base-path:internal}/staterepositories/{repositoryName}/{entityId}", produces={"application/hal+json","application/json"}) @ResponseBody public de.otto.edison.hal.HalRepresentation getEntityJson(@PathVariable java.lang.String repositoryName, @PathVariable java.lang.String entityId, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)Returns an application/hal+json representation of a single event-sourced entity stored in theStateRepositorywith the specifiedrepositoryName.If the state repository has a
Journal, the returned entity representation will contain a link to the messages that where leading to the current state of the entity.- Parameters:
repositoryName- the name of theStateRepositoryentityId- the id of the requested entityuriComponentsBuilder- builder used to create hrefs- Returns:
- HalRepresentation the representation of the entity
-