Skip to content

Latest commit

 

History

History
99 lines (77 loc) · 5.06 KB

File metadata and controls

99 lines (77 loc) · 5.06 KB

Introduction

This readme explains how to run the BOM dynamic domain sample in Docker.

Doing so, you do not need to have ODM installed. Instead we are relying on the ODM for developers container image.

Before following the steps below, make sure you have built the customization JAR as explained in README.md.

Configuring the Sample for Docker

1. Build the Sample Code

The following steps show how to compile the sample code into a JAR file using a Docker container with Maven and JDK 17.

  1. Navigate to the project directory:

    cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
  2. Run the command below to build the JAR file:

    docker run --rm \
         -v "$(pwd)":/usr/src/sample \
         -w /usr/src/sample \
         maven:3.8.5-openjdk-17 \
         mvn clean install -Dtarget.docker

    Result: The generated JAR file will be located in the target directory with the name bomdomainpopulate-1.0.jar.

2. Start the ODM Container

To set up the ODM container with dynamic domain support:

  1. Start the ODM container:

    docker-compose up odm-dynamic-domain &

    Explanation: This command initializes the ODM environment required for the sample.

  2. Copy and configure the H2 database library for Decision Center:

    docker-compose exec odm-dynamic-domain sh -c "cp /config/resources/h2*.jar /config/apps/decisioncenter.war/WEB-INF/lib/h2.jar"
    docker-compose restart odm-dynamic-domain

    Explanation: The H2 database library is needed to support the dynamic domains sample. Restarting ensures all configurations take effect.

3. Initialize the Dynamic Domains Database

To set up and populate the dynamic domains database:

  1. Run the initialization script:
    docker-compose exec odm-dynamic-domain sh -c "java \
        -cp /config/resources/h2*.jar \
        org.h2.tools.RunScript \
        -url jdbc:h2:/config/dbdata/bomdomain \
        -user sa \
        -script /script/sql/createAndPopulate.sql \
        -showResults"

    Explanation: This command initializes the H2 database schema for the sample and populates it with the necessary data, enabling ODM to recognize and use the dynamic domain setup.

Using the sample

  1. Log in into the Business Console.

    • user = rtsAdmin
    • password = rtsAdmin
  2. Navigate to the Administration tab. In the Settings sub-tab, click Custom Settings and click the Add custom setting icon and set:

    • name = teamserver.derbyDataBaseDomainProvider
    • description = derbyDataBaseDomainProvider
    • type = String
    • leave default value empty
  3. Set the value of the new custom setting to ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider

  4. Navigate to the Library tab.

  5. Import the rule project archive projects/bomdomainpopulate-rules.zip.

    Note: this rule project bomdomainpopulate-rules is only aimed at editing rules to demonstrate loading domains from a database. It is missing a deployment configuration and cannot be executed.

  6. Navigate to the Library tab. Select the bomdomainpopulate-rules box (click anywhere except the name) and choose the main branch.

  7. Display the rule CheckOrder > OrderType. Notice the error Value (string) 'CompanyX' is incorrect. Edit the rule and either remove "CompanyX" and press SPACE or double-click "CompanyX". A list of suitable companies gets displayed in a drop-down. Close down the rule without saving.

  8. Display the rule CheckCurrency > CurrencyRestriction. No warning is displayed.

  9. Let's now make some changes in the dynamic domains in the database. Run:

    docker-compose exec odm-dynamic-domain sh -c "java \
        -cp /config/resources/h2*.jar \
        org.h2.tools.RunScript \
        -url jdbc:h2:/config/dbdata/bomdomain \
        -user sa \
        -script /script/sql/modifyTables.sql \
        -showResults"
  10. Display the rule CheckOrder > OrderType back again. Notice that there is no error anymore. The effects of the changes done in the database are taken into account automatically because the values that the field stock can take are dynamically fetched from the database (and not stored in the BOM).

  11. Conversely if you display the rule CheckCurrency > CurrencyRestriction, there is still no warning. So let's now import the changes done in the database into the BOM. Click the Model tab, and then the Dynamic Domains sub-tab. Expand all the three domains. You should see this: (Notice that the Australian Dollar was removed)

    Dynamic Domains update

  12. Tick Domain to select all the domains, and click the Apply changes button. Confirm the change.

  13. Display the rule CheckCurrency > CurrencyRestriction back again. Now a warning 'Australian Dollar' is deprecated is displayed as the result of the update of the Dynamic Domains in the BOM.