The Adjustments Services API standalone module

The Adjustments Services API standalone module

This standalone library was created to provide interfaces, service implementations and DTOs for adjustments and what-if operations executions. The objective is to offer an easier integration of these capabilities in any application server.

Dependencies

The Adjustments Services API uses the signoff-ext module as a dependency. For details, see the Sign-Off API documentation.

Interfaces and implementations

Branch-aware adjustment (what-if) support

Interfaces and implementations that allow an application server to publish the list of supported branch-aware adjustment types and required inputs for branch-aware adjustments execution.

ISupportedBranchAwareAdjustmentService

An interface to retrieve:

  • The full set of supported branch-aware adjustments
  • A specific branch-aware adjustment by key
  • A set of rejected branch-aware adjustment types

SupportedBranchAwareAdjustmentsService

An implementation of the ISupportedBranchAwareAdjustmentService interface, which autowires a collection of SupportedBranchAwareAdjustmentDTO beans instantiated by the application.

The service rejects any branch-aware adjustment with a duplicate key.

DTOs

DTO Description
SupportedBranchAwareAdjustmentDTO Data object for the definition of supported branch-aware adjustments. Holds information about:
  • The stores the adjustment applies to
  • Required filters (as a set of LevelTypedFieldDTO)
  • Required inputs (as a set of InputTypedFieldDTO)
  • The branch in which the adjustment will be performed
  • The endpoint of the REST service used for the what-if operations
NOTE: The measures field is currently only a placeholder for future implementation. No logic is associated to it currently.

REST service

The supported branch-aware adjustment service is also wrapped in a REST service for interoperability.

ISupportedBranchAwareAdjustmentsRestService interface

A REST service interface wrapping the ISupportedBranchAwareAdjustmentService methods in REST endpoints.

SupportedBranchAwareAdjustmentsRestService class

An implementation of the interface ISupportedBranchAwareAdjustmentsRestService.

Adding branch-aware adjustment support to an application server

Importing the library

To use the Adjustments Services API library, import it into the Maven POM file:

<dependency>
    <groupId>com.activeviam.tools</groupId>
    <artifactId>adjustments-services</artifactId>
    <version>1.0.0</version>
</dependency>

Adding services to the application configuration

Spring configuration

The provided service implementations can be imported directly within the application configuration:

@Import(value = {
        SupportedBranchAwareAdjustmentsService.class,
        SupportedBranchAwareAdjustmentsRestService.class,
})

Once imported, the services autowires any relevant beans provided in the application and exposes the REST service endpoints.

Implementing branch-aware adjustments

Supported branch-aware adjustments

Any Spring Bean of type SupportedBranchAwareAdjustmentDTO is automatically collected and exposed through the SupportedBranchAwareAdjustmentsService.

The service checks the branch-aware adjustment types of the defined Beans against duplication. Any duplicated keys are added to the set of rejected branch-aware adjustments.

Branch-aware adjustment execution

Application servers are responsible for implementing their particular branch-aware adjustment types. The input to each REST service used for the execution request of a branch-aware adjustment type must be an instance of BranchAwareAdjustmentRequestDTO.