Introduction to the Oracle Business Rules Dictionary Component

25-28 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 25–34 Choosing Tab Libraries

c. Click Libraries and Classpath from the left panel and click the Add Library

button to display the Add Library dialog box.

d. Click Oracle Rules and Oracle Rules Dictionary Component from the

Extension list and then click OK as shown in Figure 25–35 . Figure 25–35 Selecting Oracle Rules and Rules Dictionary Component This adds the Rules SDK and the Rules Dictionary Editor tag libraries to the project. Using Declarative Components and Task Flows 25-29

e. Click OK to close the Project Properties dialog box.

6. Select Save All from the Oracle JDeveloper File menu to save the project.

You have to ensure that all the required tag libraries are added:

1. Right-click the useRuleDictDC project in the Application Navigator of Oracle

JDeveloper and select Project Properties to display the Project Properties dialog box.

2. Click JSP Tag Libraries from the left panel and check if all the tag libraries are

added as shown in Figure 25–36 . Figure 25–36 Checking the Required Tag Libraries for Rules Dictionary Editor To create the RuleDictionaryModel object: The Rules Dictionary Editor component requires a oracle.bpel.ruledictionarydc.model.impl.RuleDictionaryModel object. The component uses this object to read Globals, Bucketsets, and Rulesets information from the dictionary. So, the next task is to create a managed bean called SomeBean.java that creates a RuleDictionaryModel object. The steps are:

1. Open Oracle JDeveloper.

2. From the File menu, select New to display the New Gallery dialog box.

3. In the New Gallery dialog box, select Java under General from the Categories

panel. Ensure that Java Class under Items is selected and click OK to display the Create Java Class dialog box.

4. Enter the name of the Java class, for example SomeBean.java, and click OK to

create the Java class in your project as shown in Figure 25–37 . 25-30 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 25–37 Creating a Java Class 5. In SomeBean.java, provide a method that returns the RuleDictionaryModel object. You must specify the location of the rules file here. The following is a sample of the SomeBean.java file: package useruledictdc; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.util.ArrayList; import java.util.List; import oracle.bpel.ruledictionarydc.model.impl.RuleDictionaryModel; import oracle.rules.sdk2.dictionary.DictionaryFinder; import oracle.rules.sdk2.dictionary.RuleDictionary; import oracle.rules.sdk2.exception.SDKException; import oracle.rules.sdk2.exception.SDKWarning; public class SomeBean { private RuleDictionaryModel ruleDictModel; private static final String RULES_FILE1 = C:\\scratch\\asuraj\\system\\rules\\OrderBookinRules.rules; public SomeBean { super; } public RuleDictionaryModel getRuleDictModel { if ruleDictModel = null return ruleDictModel; cache ruleDictModel instead of re-creating it each time