Class ConfigurationAdapterBase<DAO,DTO extends de.otto.edison.hal.HalRepresentation>

java.lang.Object
sonia.scm.api.v2.resources.ConfigurationAdapterBase<DAO,DTO>
Type Parameters:
DAO - The class of the data access object used to persist the configuration.
DTO - The class of the data transfer objects used in the rest api.
All Implemented Interfaces:
HalEnricher

@Beta public abstract class ConfigurationAdapterBase<DAO,DTO extends de.otto.edison.hal.HalRepresentation> extends Object implements HalEnricher
This can be used as a base class for configuration resources.
Since:
2.41.0
  • Field Details

    • configurationStoreFactory

      protected final ConfigurationStoreFactory configurationStoreFactory
    • scmPathInfoStoreProvider

      protected final jakarta.inject.Provider<ScmPathInfoStore> scmPathInfoStoreProvider
  • Constructor Details

    • ConfigurationAdapterBase

      protected ConfigurationAdapterBase(ConfigurationStoreFactory configurationStoreFactory, jakarta.inject.Provider<ScmPathInfoStore> scmPathInfoStoreProvider, Class<DAO> daoClass, Class<DTO> dtoClass)
      Creates the resource. To do so, you have to provide the ConfigurationStoreFactory and the ScmPathInfoStore as a Provider and implementations for the DAO and the DTO.
      The DAO class has to have a default constructor that creates the default (initial) configuration.
      The DTO class should be created with @GenerateDto annotation using Conveyor. If the implementation is done manually, it has to provide two methods:
      • A static method DTO from(DAO, Links) creating the DTO instance for the given DAO with the provided links.
      • A method DAO toEntity() creating the DAO from the DTO.
      If either one is missing, you will see ConfigurationAdapterBase.IllegalDaoClassExceptions on your way.
      The implementation may look like this:
      Parameters:
      configurationStoreFactory - The configuration store factory provided from injection.
      scmPathInfoStoreProvider - The path info store provider provided from injection.
      daoClass - The DAO class instance.
      dtoClass - The DTO class instance.
  • Method Details

    • getConfiguration

      public DAO getConfiguration()
    • getName

      protected abstract String getName()
    • getStoreName

      protected String getStoreName()
    • get

      @GET @Produces("application/json") @Path("") public DTO get(@Context jakarta.ws.rs.core.UriInfo uriInfo)
    • update

      @PUT @Consumes("application/json") @Path("") public void update(@NotNull @Valid DTO payload)
    • enrich

      public final void enrich(HalEnricherContext context, HalAppender appender)
      Description copied from interface: HalEnricher
      Enriches the response with hal specific attributes.
      Specified by:
      enrich in interface HalEnricher
      Parameters:
      context - contains the source for the json mapping and related objects
      appender - can be used to append links or embedded objects to the json response
    • getReadPermission

      @Nullable protected com.github.sdorra.ssp.PermissionCheck getReadPermission()
    • getWritePermission

      @Nullable protected com.github.sdorra.ssp.PermissionCheck getWritePermission()