> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get started

> How to install, run, and connect Atoti Sign-Off to an application server, including prerequisites, starter project setup, database configuration, security customizations, and migration guidance.

## Prerequisites

Before you begin, ensure you have the following installed:

* Java 21+
* Maven 3.8+

### Artifactory access

Please ensure you have access to our private Maven repositories in your Maven `settings.xml` file before installation. You will need access to the following repositories:

#### Atoti Server server repository

This repository contains all the dependencies required to run Atoti Server. Atoti Sign-Off is itself an Atoti Server product, which is
why this repository is required.

```xml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
<repository>
    <id>ActiveViamInternalRepository</id>
    <name>ActiveViam Internal Repository</name>
    <url>https://activeviam.jfrog.io/activeviam/mvn/</url>
    <layout>default</layout>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>
```

#### Business Solutions repository

This repository contains all the dependencies required to run ActiveViam Business Solutions.

```xml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
<repository>
    <id>ActiveViamBusinessSolutionsRepository</id>
    <name>ActiveViam Business Solutions Repository</name>
    <url>https://activeviam.jfrog.io/activeviam/activeviam-mvn-accelerators/</url>
    <layout>default</layout>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
</repository>
```

### Third-party dependencies

Atoti Sign-Off uses third-party repositories that are not referenced in maven central repository.
You will need to add these repositories to your Maven `settings.xml` or project pom
as described [here](https://maven.apache.org/guides/mini/guide-multiple-repositories.)
to be able to download the required dependencies.

#### Activiti repository

```xml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
<repository>
  <id>activiti-releases</id>
  <url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-releases</url>
</repository>
```

### License

To use Atoti Server, you will need a valid license. Atoti Sign-Off is itself an Atoti Server product, which is why this license is required.
For details on how to get one, see [the Atoti Server documentation](https://docs.activeviam.com/products/atoti/server/6.1.4/docs/start/license/).

## Install the starter project

The starter project is a reference Spring Boot application that demonstrates how to use Atoti Sign-Off. It contains the default configurations and workflows.
It can be configured, customized, or extended for your specific use cases using Spring.

To install the starter project:

1. Download the [Atoti Sign-Off source code](https://activeviam.jfrog.io/artifactory/activeviam-accelerators-artifacts/signoff/6.2.0/atoti-signoff-6.2.0.zip).
   This contains the starter project and the parent pom file.
2. Extract the source code folder into your workspace.
3. Open the project in your IDE.
4. Run `mvn clean install`.

This will compile the source code, run tests, and package the application. You may exclude test execution by running `mvn clean install -DskipTests`.

## Run the starter

Start the application with:

```sh theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
java -jar ./signoff-starter/target/sign-off-exec.jar
```

By default, the application starts on `http://localhost:9090`.

Alternatively, if using your IDE, run the `com.activeviam.signoff.starter.SignOff` class.

## Connect Atoti Sign-Off to your application server

Atoti Sign-Off performs its sign-off and adjustment logic on another Atoti Server application, known as the application server. You must ensure this application is
configured to communicate via REST with Atoti Sign-Off. This is done by implementing the [Atoti Sign-Off API](https://docs.activeviam.com/products/modules/signoff-api/latest/online-help/).
Please refer to the Atoti Sign-Off API documentation for how this is done.

User and role configurations must be consistent between Atoti Sign-Off and the application server(s) in order to guarantee proper access control. We
recommend placing your security configurations in a single module and referencing that module in both Atoti Sign-Off and the Atoti server.

Once the application server is configured to communicate with Atoti Sign-Off, you must configure the Atoti Sign-Off starter to communicate with the application server.
This is done by setting configuration properties.

<Info>
  We recommend externalizing these properties into a profile. For example if you wish to connect to the [Atoti Market Risk Solution](/solutions/market-risk) then you can use an `mr`
  profile by placing these properties in `application-mr.yml` in `./signoff-starter/src/main/resources` and starting the application with `-Dspring.profiles.active=mr`.
  Similarly, you may configure an `frtb` profile for the [Atoti FRTB Solution](/solutions/frtb).
  You may then connect to both solutions by starting the application with `-Dspring.profiles.active=mr,frtb`.
  See the [Spring Boot docs](https://docs.spring.io/spring-boot/reference/features/profiles.) for more details on profiles.
</Info>

See the following snippet for an example of the properties required to connect to the
[Atoti Market Risk Solution](/solutions/market-risk)

<Accordion title="MR connection properties">
  ```yaml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  sign-off:
     application:
        # The settings for the application server
        settings:
           # The as-of-date dimensions for the application server
           as-of-date-dimensions:
              MR:
                 cube-dimension:
                    "[*]":
                       as-of-date:
                          dimension-name: Dates
                          hierarchy-name: Date
                          level-name: AsOfDate
           # The cubes that are restricted from adjustments
           restricted-cubes:
              MR:
                 - VaR-ES Summary Cube
                 - Sensitivity Summary Cube
                 - PL Summary Cube
                 - Market Data Cube
                 - MRCombinedCube
           # The available scope levels for the application server
           available-scope-levels:
              MR:
                 available-levels-by-cube:
                    "[*]":
                       - dimension-name: Organization
                         hierarchy-name: BookHierarchy
                         level-name: Level 5
                       - dimension-name: Booking
                         hierarchy-name: Books
                         level-name: Book
                       - dimension-name: Booking
                         hierarchy-name: Desks
                         level-name: Desk
                       - dimension-name: Risk
                         hierarchy-name: Scenario Sets
                         level-name: Scenario Set
           feed-member-coordinate:
              dimension-name: Sign-off
              hierarchy-name: Sign-off Status
              level-name: Feed
              member: [ TOTAL REVIEWABLE ]
        rest-apis:
           MR:
              # The URL of the application server
              url: http://localhost:10010/mr-application
              # The user to authenticate as when send REST requests to the application server
              user: admin
              cubes:
                 # The name of the cube in the application server
                 '[VaR-ES Cube]':
                    # The level in the cube that contains the as-of-date dimension
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 '[VaR-ES Summary Cube]':
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 '[Sensitivity Cube]':
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 '[Sensitivity Summary Cube]':
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 PLCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 '[PL Summary Cube]':
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 MRCombinedCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
        # The form of authentication to use
        authentication-mode: jwt
  ```
</Accordion>

See the following snippet for an example of the properties required to connect to the
[Atoti FRTB Solution](/solutions/frtb)

<Accordion title="FRTB connection properties">
  ```yaml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
  sign-off:
     application:
        settings:
           as-of-date-dimensions:
              FRTB:
                 cube-dimension:
                    "[*]":
                       as-of-date:
                          dimension-name: Dates
                          hierarchy-name: Date
                          level-name: AsOfDate
           restricted-cubes:
              FRTB:
                 - IMADRCCube
                 - PLCube
                 - StressCalibrationCube
                 - FRTBCombinedCube
           available-scope-levels:
              FRTB:
                 available-levels-by-cube:
                    "[*]":
                       - dimension-name: Organization
                         hierarchy-name: BookHierarchy
                         level-name: Level 5
                       - dimension-name: Booking
                         hierarchy-name: Books
                         level-name: Book
                       - dimension-name: Booking
                         hierarchy-name: Desks
                         level-name: Desk
           feed-member-coordinate:
              dimension-name: Sign-off
              hierarchy-name: Sign-off Status
              level-name: Feed
              member: [ SNAPSHOT ]
        rest-apis:
           FRTB:
              url: http://localhost:8080/frtb-starter
              user: admin
              password: admin
              cubes:
                 IMADRCCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 InternalModelApproachCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 PLCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 StandardisedApproachCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 StressCalibrationCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
                 FRTBCombinedCube:
                    as-of-date-level: "[Dates].[Date].[AsOfDate]"
        authentication-mode: jwt
  ```
</Accordion>

## Customize the starter

The following section outlines how to modify the starter project to suit your needs. We recommend that you make changes in the following order:

1. **Configurations**: these are usually non-code related changes and are the easiest to migrate.
2. **Customizations**: these are usually code additions that can be easily “swapped in” to the existing codebase to either safely override or augment existing functionality.
3. **Overrides**: these are usually code changes that require a more in-depth understanding of the codebase and may require changes to existing code.
   In general, it is not technically possible to perform these changes as a configuration
   or customization, for example [overriding the default JPA entities](./dev-extensions/override-default-managed-objects).
   These are the hardest to migrate, and if you need to do them **we recommend you raise a [Jira](https://activeviam.atlassian.net/jira/your-work)**
   for us to see if there is a better alternative or if there is a gap in our product that needs to be addressed.

### 1. Configurations

We recommend that you configure the application as much as possible before customizing existing code. The following configurations are commonly used:

#### Configure application properties

Application properties are used to configure functionality of Atoti Sign-Off and most of its dependencies. These can be found in the [properties](../user-ref/properties)
section and updated by modifying the `src/main/resources/application.yml` file, or by using environment variables:

#### Database configuration with Spring JPA

By default, the application uses an in-memory H2 database.

<Info>
  Using the H2 database in production is not recommended. Instead, please use a production-grade database. There is none in particular that we recommend,
  but popular choices include:

  * [Postgresql](https://www.postgresql.org/)
  * [MSSQL](https://www.microsoft.com/en-us/sql-server)
  * [MySQL](https://www.mysql.com/)
</Info>

To use your database, add any relevant drivers to your `pom.xml` and configure connection properties in your `application.yml`. For example, for PostgreSQL this
might look as follows:

```xml theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <scope>runtime</scope>
</dependency>
```

Configure JPA properties:

```properties theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.datasource.driver-class-name=org.postgresql.Driver
```

### 2. Customizations

<Info>
  When you add new code as a customization to the starter project, we **highly recommend** that you use your own package name and avoid using the `com.activeviam`
  package. This will separate your code from our code and make it much easier to migrate.
</Info>

### Customize via Spring beans

The application follows Spring best practices. To customize, you can override existing beans and components by defining them in your application. **This is the
safest form of overriding or augmenting existing code behavior.** We aim to use `@ConditionalOnMissingBean` as much as possible to allow for easy customization.
If we have not exposed a bean you wish to override as `@ConditionalOnMissingBean`, **please raise a [Jira](https://activeviam.atlassian.net/jira/your-work) with
us** and mark your bean as `@Primary`.

### Activiti workflow customization

The application includes default Activiti workflows located in `src/main/resources/processes/`. You’ll probably want to implement your own workflows.
To customize workflows, you need to:

1. Create your BPMN file. You can either edit the existing BPMN files or use a BPMN editor, such as [BPMN.io](https://bpmn.io/).
2. Import any Spring beans or services required by your workflow. This is detailed further in [customizing the Sign-Off workflow](./dev-extensions/custom-workflows).
3. Add the new processes in `src/main/resources/processes/`.
4. Restart the application to ensure the changes are picked up.

### Security customizations

The application comes with a default security configuration. **You need to customize this by implementing your own security configuration.** This is done by
implementing and exposing the following interfaces:

* `com.activeviam.web.spring.api.config.ICorsConfig`: This interface is used to configure CORS settings.
* `org.springframework.security.web.SecurityFilterChain`: This interface is used to configure security filters for REST requests.
* `org.springframework.security.core.userdetails.UserDetailsService`: This interface is used to load user-specific data.

### 3. Override

If you cannot configure or customize the application to meet your requirements, you may need to override the application. This is the most complex form of
modification as it requires an in-depth knowledge of the core codebase and may result in unintended consequences. It is also the most difficult code to migrate,
because it may be difficult to remember if the code was an override in the first place or is a legitimate starter class. We recommend adding a javadoc to
differentiate overrides from released source code.

<Warning>
  If you need to override our code we recommend that you raise a [Jira](https://activeviam.atlassian.net/jira/your-work) ticket with us to see if there is a better
  alternative or if there is a gap in our product that needs to be addressed.
</Warning>

## Migrate Atoti Sign-Off

When migrating to a new version of Atoti Sign-Off, we recommend the following steps:

1. Ensure your code customizations is under a separate package name from the `com.activeviam` package.
2. Create a new branch in your VCS for the upgrade.
3. If you have overridden any of our code, move it to a `tmp.com.activiam` package. This should only apply to **overrides**, not to starter code.
4. Install the starter project for your new version, replacing the old starter `com.activeviam` packages with the new packages.
5. Verify if any of the `tmp.com.activeviam` code can be removed. If so, remove it, otherwise, please raise a [Jira](https://activeviam.atlassian.net/jira/your-work) and merge it with the new code.
6. Run `mvn clean install`
7. If you have any compile errors, consult the migration notes in the release notes for the new version.
8. Repeat steps 6-7 until the code compiles and is correctly installed.

## Frequently asked questions

<AccordionGroup>
  <Accordion title="I can’t download the starter project dependencies due to my company’s policy. What can I do?">
    We store Maven repositories for all of our artifacts on Artifactory. The core Atoti Server jars are available in [the ActiveViam share page](https://artifacts.activeviam.com/share/ActivePivot_stable/), as described in the
    [Atoti Server download guide](https://docs.activeviam.com/products/atoti/server/6.1.4/docs/start/download/).
    From there you can download the Atoti Server 6.1.4 jars.

    The Atoti Sign-Off jars are available from the [Business Solutions artifacts repository](https://activeviam.jfrog.io/artifactory/activeviam-accelerators-artifacts/signoff/6.2.0/signoff-6.2.0-maven-repository.zip).
    From there you can download the Atoti Sign-Off jars. Once downloaded, install these jars in your local repository and re-run the Maven build.
  </Accordion>
</AccordionGroup>
