Click OK to close the Project Properties dialog box.

25-12 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite return true; } public static void updateDictionaryRuleDictionary dict { if dict == null return; ListSDKWarning warnings = new ArrayListSDKWarning; try { dict.updatewarnings; if warnings.isEmpty { for int i = 0; i warnings.size; i++ System.out.printlnwarnings: + warnings.geti.getLocalizedMessage; } } catch SDKException sdkEx { sdkEx.printStackTrace; } } You can call this method from your Save button public void saveDictionary { RuleDictionary dict = this.getRuleSetModel.getRuleSet.getDictionary; if dict = null { update the dictionary before saving it updateDictionarydict; saveDictionarydict, RULES_FILE; } } call the validation method on the ruleSetModel to update the Validation Panel public void validate { if this.ruleSetModel == null return; this.ruleSetModel.validate; 6. Open the faces-config.xml file in Overview mode and click the + button under Managed Beans to display the Create Managed Bean dialog box. Point to SomeBean.java by providing the Bean Name as someBean and the Scope as session as shown in Figure 25–19 . Figure 25–19 Specifying the Bean Name and Scope The ADFJSF framework makes multiple calls to SomeBean.java to render the user interface. For example, someBean.ruleSetModel is called multiple times. Using Declarative Components and Task Flows 25-13 So, it is better to create the RuleSetModel object once, cache it, and return it each time instead of re-creating it. To create the .jspx file for the Rules Editor Component tag: The next task is to create the .jspx file to include the Rules Editor component tag. 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 JSF under Web Tier from the Categories

panel.

4. Select JSF Page under Items and click OK to display the Create JSF Page dialog

box.

5. In the Create JSF Page dialog box, enter useRulesDC.jspx as the file name as

shown in Figure 25–20 . Figure 25–20 Creating the JSF Page File RulesCompLib in the component palette of Oracle JDeveloper is displayed as shown in Figure 25–21 . 25-14 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 25–21 Rules Editor Component Library in the Component Palette This is because you have added the Rules Editor Component tag library when creating the sample application.

6. Select RulesCompLib to view the Rulesdc tag. You can drag and drop the

Rulesdc tag into the .jspx file. You can also add the Rulesdc tag in the .jspx file manually as shown: ?xml version=1.0 encoding=UTF-8? jsp:root xmlns:jsp=http:java.sun.comJSPPage version=2.1 xmlns:f=http:java.sun.comjsfcore xmlns:h=http:java.sun.comjsfhtml xmlns:af=http:xmlns.oracle.comadffacesrich xmlns:rdc=http:xmlns.oracle.combpelruleseditor jsp:directive.page contentType=texthtml;charset=UTF-8 f:view af:document title=Sample Rules Editor App id=d1 af:form id=f1 af:panelStretchLayout id=psl1 inlineStyle=margin:15px; partialTriggers=cb1 cb3 f:facet name=center rdc:rulesdc rulesetModel={someBean.ruleSetModel} viewOnly=false discloseRules=true genericAction=true genericPattern=true dtColumnPageSize=6 id=r1 dateStyle=yyyy-MM-dd timeStyle=HH-mm-ssrdc:rulesdc f:facet f:facet name=top af:panelGroupLayout id=pgl2 layout=horizontal af:commandButton text=Save Dictionary action={someBean.saveDictionary} id=cb1 af:spacer width=10 height=10 id=s5 af:commandButton text=Validate id=cb3 action={someBean.validate} partialSubmit=true af:panelGroupLayout f:facet af:panelStretchLayout af:form af:document f:view jsp:root Using Declarative Components and Task Flows 25-15 To refer to the oracle.rules and the oracle.soa.rules_editor_dc.webapp shared libraries: After creating the .jspx file, you must refer to the oracle.rules and oracle.soa.rules_editor_dc.webapp shared libraries from the weblogic-application.xml file. The steps are: 1. In Oracle JDeveloper, open the weblogic-application.xml file by browsing to Application Resources, then Descriptors, and then META-INF. 2. Add the following lines to refer to the oracle.rules shared library as shown in Figure 25–22 . library-ref library-nameoracle.ruleslibrary-name library-ref Figure 25–22 Referring to the oracle.rules Shared Library 3. In Oracle JDeveloper,

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

b. In the New Gallery dialog box, select Deployment Descriptors under General

from the Categories panel.

c. Select Weblogic Deployment Descriptor under Items and click OK to display

the Create Weblogic Deployment Descriptor dialog box.

d. Select weblogic.xml from the list and click Finish.

e. In Oracle JDeveloper, in the Overview mode of weblogic.xml, select Libraries

from the left panel and enter oracle.soa.rules_editor_dc.webapp as the library name as shown in Figure 25–23 . 25-16 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 25–23 Adding the Rules Editor Component Library

f. Click Save All.

4. Deploy the oracle.rules shared library to the embedded Weblogic server:

a. Launch WLS console http:host:portconsoleloginLoginForm.jsp. Ensure

that the Weblogic embedded server on Oracle JDeveloper is running.

b. Select Deployments and click Install to display the Install Application

Assistant page.

c. Select JDEV_INSTALLjdevelopersoamodulesoracle.rules_

11.1.1rules.jar and click Finish as shown in Figure 25–24 . Figure 25–24 Deploying the oracle.rules Shared Library 5. Deploy the oracle.soa.rules_editor_dc.webapp shared library to the Weblogic server:

a. In the Weblogic console, select Deployments and click Install to display the

Install Application Assistant page. Using Declarative Components and Task Flows 25-17 b. Select JDEV_INSTALLjdevelopersoamodulesoracle.soa.rules_editor_ dc.webapp_11.1.1oracle.soa.rules_editor_dc.webapp.war and click Next.

c. Select Install this deployment as a library and click Finish as shown in

Figure 25–25 . Figure 25–25 Deploying oracle.soa.rules_editor_dc.webapp Shared Library oracle.soa.rules_editor_dc.webapp is added to the list of deployments as shown in Figure 25–26 . Figure 25–26 oracle.soa.rules_editor_dc.webapp Added to the Deployment List To run the sample Rules Editor application: The last task is running the sample application. To run the sample application, from Oracle JDeveloper, right-click the useRulesDC.jspx file, and select Run. This starts the sample application on a Web browser as shown in Figure 25–27 . 25-18 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite Figure 25–27 Running the Sample Application

25.2.3 How to Deploy a Rules Editor Application to a Standalone Weblogic Server

When you are ready to deploy your application EAR file to the standalone Weblogic server, perform the following:

1. Launch the Weblogic server console

http:host:portconsoleloginLoginForm.jsp and ensure that oracle.rules is displayed in the deployments list.

2. Ensure that oracle.soa.rules_editor_dc.webapp is displayed in the

deployments list. If this is not displayed, click Install and select the JDEV_ INSTALLjdevelopersoamodulesoracle.soa.rules_editor_dc.webapp_ 11.1.1oracle.soa.rules_editor_dc.webapp.war file.

3. Open Oracle JDeveloper.

4. Right-click the project name in the Application Navigator and select Project

Properties .

5. Select Libraries and Classpath from the left panel and click Add Library.

6. In the Add Library dialog box, select Oracle Rules Editor Component and click

OK as shown in Figure 25–28 . Using Declarative Components and Task Flows 25-19 Figure 25–28 Adding the Oracle Rules Editor Component This step enables you to refer to these libraries, but does not deploy these libraries by default. Therefore, the jars are not included in your project WAR file. 7. In the project that has to be deployed where you create the EAR file: a. Add the following lines to the weblogic-application.xml: library-ref library-nameoracle.ruleslibrary-name library-ref b. Add the following lines to weblogic.xml in the project WAR file: library-ref library-nameoracle.soa.rules_editor_dc.webapplibrary-name library-ref c. Deploy the EAR file in the Weblogic server. For more information about creating an EAR file, see How to Create an EAR File for Deployment in Oracle Fusion Middleware Java EE Developers Guide for Oracle Application Development Framework.

25.2.4 What You May Need to Know About the Custom Permissions for the Rules Editor Component

For the role based authorization, Rules DC implements custom JAAS permissions extending oracle.adf.share.security.authorization.ADFPermission class to ensure that the permission can be used by ADF Security. If a Rules Editor application supports ADF security, which means there is support for role-based authentication and authorization, then security is enforced by implementing custom JAAS permissions by extending the oracle.adf.share.security.authorization.ADFPermission class to ensure that the permission can be used by ADF Security. You have to create ADF security policies by granting the following permissions to the user roles based on your application requirement: ■ oracle.rules.adf.permission.AddRulePermission: Displays Add Rule button; if the permission is not granted, the Add Rule button is not visible to the user.