Class 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      de.otto.edison.hal.HalRepresentation getEntityJson​(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 the StateRepository with the specified repositoryName.
      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 not excluded from the state-repository UI.
      de.otto.edison.hal.HalRepresentation getStateRepository​(java.lang.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 Detail

      • 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 Detail

      • 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 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
                                                                       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 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
                                                                  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 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