Go to Samples and Tutorials window in Rule designer. Select Data sources for BOM domains in decision center tab and click on import projects.
The serverbompopulate project will be imported to the Rule designer. The src folder of serverbompopulate contains two classes DomainValueProvider and DomainHelper. When we click the DomainHelper class, we will see this following code
We can see the values are hard coded and it is not dealing with Database. So we are going to change the code so that it can work with DB. Delete the DomainHelper.java and download the two java files given in the link Click Here. Place the java files in serverbompopulate package of src folder. Add the required database driver jar into the lib folder. If Oracle DB is used, then add ojdbc6.jar into the lib folder. If derby DB is used, add derbyclient.jar into the lib folder. Here Oracle DB is taken as reference in this context.
Then click on the serverbompopulate project and click properties. Select Java Build Path and click on add jars. Add the jar which is recently added to the lib folder of serverbompopulate.
Now we need to do some modifications in the bulid.xml file to make this project work in context with the changes. So The below fig., depicts the changes that are needed to be done in build.xml.
Give the name of your jar file in the boxes shown in the above image. As we have used Oracle DB, it is ojbc6.jar. Now the changes are done. Now go to window and then show view. Click on ant. Double-click on the repack command in the build.xml file.
This command does a series of tasks. It copies the jrules-team server.ear file into a temporary location. In that temporary location, it unpacks the ear file and then unpacks the teamserver ear file. After that, it converts the src folder of serverbompopulate to a jar file and also copies the ojdbc6.jar file to lib folder of the war file. Then it packs the war file again and then it packs the ear file. The final ear file will be seen in the websources folder of the serverbompopulate project in Rule Designer.
After you see the BUILD SUCCESSFUL message in the console, click on deploy command in build.xml. This copies the ear file and it deploys it in the samples server.
After successful deployment, click on set-config-param command to assign the custom property with key derbyDataBaseDomainProvider. The sample logs generated when executing the repack, deploy and set-config-param can be seen here.
Now go to decision center and select bomdomainpopulate-rules project. Depending on the ODM version, it will be in Work on a rule project or in Work on a decision service.
Go to Project tab and click on Update dynamic domains
Click on the required type that is needed to be updated and click on update.
On successful updation, a message will be displayed as shown
Now we will be able to see the new domain value. If we removed a domain value from the database, then that value will be shown as deprecated and it cannot be visible in the dropdown box as shown.
For understanding the execution flow Click Here
Hi. Can you recheck the link to Google Drive storing the two sample Java file? It says need permission to access. Thanks!
ReplyDelete