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.
The following steps show how to compile the sample code into a JAR file using a Docker container with Maven and JDK 17.
-
Navigate to the project directory:
cd decisioncenter/dynamicdomain/src/ilog.rules.studio.samples.bomdomainpopulate
-
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 namebomdomainpopulate-1.0.jar
.
To set up the ODM container with dynamic domain support:
-
Start the ODM container:
docker-compose up odm-dynamic-domain &
Explanation: This command initializes the ODM environment required for the sample.
-
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.
To set up and populate the dynamic domains database:
- 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.
-
Log in into the Business Console.
- user =
rtsAdmin
- password =
rtsAdmin
- user =
-
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
- name =
-
Set the value of the new custom setting to
ilog.rules.studio.samples.bomdomainpopulate.DataBaseDomainValueProvider
-
Navigate to the Library tab.
-
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. -
Navigate to the Library tab. Select the bomdomainpopulate-rules box (click anywhere except the name) and choose the main branch.
-
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. -
Display the rule
CheckCurrency > CurrencyRestriction
. No warning is displayed. -
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"
-
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 fieldstock
can take are dynamically fetched from the database (and not stored in the BOM). -
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) -
Tick Domain to select all the domains, and click the Apply changes button. Confirm the change.
-
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.