Adding Custom Limit Structure Templates

When creating a new limit structure via the UI, you can pre-populate fields with default values from a custom template. This can be useful when creating limit structures that share common attributes.

How it works

To create your own template, you will need to create a bean of the LimitStructureTemplate class. Note that the templateName and serverName fields are required:

@Data
@SuperBuilder(toBuilder = true)
@NoArgsConstructor
public class LimitStructureTemplate {

  // The name of the template - must be unique
  @NonNull private String templateName;

  // The server this template belongs to - required
  @NonNull private String serverName;

  // LimitStructureDTO fields that can be templated
  protected String group;
  protected String name;
  protected String referenceId;
  protected String comment;
  protected KpiType kpiType;
  protected PollingFrequency pollingFrequency;
  protected String measureName;
  protected boolean absoluteValueIndicator;
  protected int warningThreshold;
  protected String exceptionWorkflow;
  protected String limitChangesWorkflow;
  protected String cubeName;
  protected String utilizationDashboardID;
  protected List<String> scopeKeys;
}

Defining the beans

To define a LimitStructureTemplate bean, you have two options:

LimitStructureTemplates can be created via configuration properties. This is the recommended approach as it allows you to define multiple templates in a single file and have the Spring beans created automatically.

To define a template in application.yml, add the description under the limits.structure.templates property. A minimal template can be defined as follows, where MyConnectedServer is the name of the Atoti Server that Limits will connect to and serves as the key in the map:

limits:
  structure:
    templates:
      MyTemplate:
          template-name: MyTemplate
          server-name: MyConnectedServer

A more complex example can define default values for all configurable fields of a LimitStructureDTO for multiple templates:

limits:
  structure:
    templates:
      MyTemplate1:
        template-name: MyTemplate1
        server-name: MyConnectedServer
        group: Group1
        name: LimitStructure1
        reference-id: refId1
        comment: This is a comment
        kpi-type: GREATER
        polling-frequency: EOD
        measure-name: PnL
        absolute-value-indicator: true
        warning-threshold: 0
        exception-workflow: Exception
        limit-changes-workflow: StraightThrough
        cube-name: MyConnectedServerCube
        utilization-dashboard-id: 5b4
        scope-keys:
          - Book@Books@Booking
      MyTemplate2:
        template-name: MyTemplate2
        server-name: MyConnectedServer
        group: Group2
        name: LimitStructure2
        reference-id: refId2
        comment: This is another comment
        kpi-type: BETWEEN
        polling-frequency: EOD
        measure-name: PnL
        absolute-value-indicator: false
        warning-threshold: 0
        exception-workflow: Exception
        limit-changes-workflow: StraightThrough
        cube-name: ConnectedAccCube
        utilization-dashboard-id: 9d1
        scope-keys:
          - ID@Trades@Trades

Option 2: Define a LimitStructureTemplate bean in a configuration class

To define your own template, add a method in any @Configuration class. Annotate the method with @Bean and return a LimitStructureTemplate object. See Importing Spring Beans into the Project for more information.

Example:

@Bean
public LimitStructureTemplate myTemplate() {
  return LimitStructureTemplate.builder()
    .templateName("My Template")
    .serverName("My Server")
    .group("My Group")
    .name("My Name")
    .referenceId("My Reference ID")
    .comment("My Comment")
    .kpiType(KpiType.COUNT)
    .pollingFrequency(PollingFrequency.MINUTE)
    .measureName("My Measure Name")
    .absoluteValueIndicator(true)
    .warningThreshold(10)
    .exceptionWorkflow("My Exception Workflow")
    .limitChangesWorkflow("My Limit Changes Workflow")
    .cubeName("My Cube Name")
    .utilizationDashboardID("My Utilization Dashboard ID")
    .scopeKeys(List.of("My Scope Key"))
    .build();
}

Using the template

Once you have defined your template beans, they will be available for selection in the UI when creating a new limit structure: