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 Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    StateRepositoryRestController(List<de.otto.synapse.state.StateRepository<?>> stateRepositories, de.otto.synapse.journal.JournalRegistry journals, EdisonStateRepositoryUiProperties properties, String managementBasePath)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    de.otto.edison.hal.HalRepresentation
    getEntityJson(String repositoryName, String entityId, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)
    Returns an application/hal+json representation of a single event-sourced entity stored in the StateRepository with the specified repositoryName.
    de.otto.edison.hal.HalRepresentation
    getStateRepositories(jakarta.servlet.http.HttpServletRequest request)
    Returns an application/hal+json representation of the container-resource containing all staterepositories that are not excluded from the state-repository UI.
    de.otto.edison.hal.HalRepresentation
    getStateRepository(String repositoryName, int page, int pageSize, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)
    Returns an application/hal+json representation of a StateRepository, containing a pageable collection resource with links to the event-sourced entities stored in the repository.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StateRepositoryRestController

      public StateRepositoryRestController(List<de.otto.synapse.state.StateRepository<?>> stateRepositories, de.otto.synapse.journal.JournalRegistry journals, EdisonStateRepositoryUiProperties properties, @Value("${edison.application.management.base-path:internal}") 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(jakarta.servlet.http.HttpServletRequest request)
      Returns an application/hal+json representation of the container-resource containing all staterepositories that are not excluded from 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 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 a StateRepository, containing a pageable collection resource with links to the event-sourced entities stored in the repository.
      Parameters:
      repositoryName - the name of the StateRepository
      page - the zero-based page number
      pageSize - the number of entities to return
      uriComponentsBuilder - 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 String repositoryName, @PathVariable String entityId, org.springframework.web.util.UriComponentsBuilder uriComponentsBuilder)
      Returns an application/hal+json representation of a single event-sourced entity stored in the StateRepository with the specified repositoryName.

      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 the StateRepository
      entityId - the id of the requested entity
      uriComponentsBuilder - builder used to create hrefs
      Returns:
      HalRepresentation the representation of the entity