Web authoring application sample details
You use Decision Center to run this sample.
Running this sample
Create action rules and decision tables.
Update the definition property for action rules and decision tables that are created by users in the group.
Update any other elements.
View any elements.
Delete action rules and decision tables if created by users in the group.
Delete all other elements.
Decision Center provides a locking mechanism for rule elements to prevent concurrent editing. You cannot edit an element if it is locked. Elements are locked when you edit them, and unlocked afterward, when you close the elements with or without changes.
- Viewing project security settings.
- Using the web application that gives access to Decision Center data.
- Checking the permissions of the Loan Validation Service project.
Open a web browser and enter the following URL to access Decision Center:
http://localhost:<PORT>/decisioncenter/
Sign in to Decision Center by using the following details:
User name: Paul
Password: Paul
Click the Administration menu, and open the Project Security tab.
Inspect the Loan Validation Service. Notice that security is enforced on all the rule projects in Loan Validation Service, and that rmtUserGroup is one of the groups set for all the rule projects in Loan Validation Service.
Sign out of Decision Center.
Open your web browser and enter the following URL:
http://localhost:<PORT>/dcclient
Sign in by using the following details:
User name: rmtuser
Password: rmtuser
The selected project is Loan Validation Scoring, which is part of the Loan Validation Service decision service.
Click Choose your action rule to view the action rules in the Loan Validation Scoring project.
- Open the Decision Table tab to see the decision tables in the project.
Go back to the Rule tab, and select neverBankruptcy.
Notice that the Save and Remove buttons are enabled but clicking them produces a permission error. This is because you signed in as rmtuser and can update only the rules that were created by your group.
Go to the Decision Table tab, and select bankruptcyScore in the Decision Table tab.
It displays the definition of the decision table. Notice that all the decision table buttons are enabled, but you get a permission error when you click Save or Remove. This error occurs because the decision table was not created by your group.
Go back to the Rule tab.
Create a new action rule in the computation package, and name it NewRule.
Notice that the Remove and Save buttons now work.
Sign out.
Open a web browser and enter the following URL:
http://localhost:<PORT>/dcclient
Sign in by using the following details:
User name: Paul
Password: Paul
Select the rule neverBankruptcy.
Notice that the Save and Remove buttons now work. By signing in as Paul, you can update any rule.
Rebuilding this sample
In the Samples Commands view, navigate to .
Double-click build to compile the code.
To restore the initial security settings for the Loan Validation Service project, run the run.remove.permission Ant command.
How this sample works
How to set and unset the permissions on a project.
How to use the Decision Center web components.
How to lock and unlock objects.
The main of the class PermissionHelper (located in <InstallDir>/teamserver/samples/servercomponents/src/com/ibm/rules/web/sample/utils) unsets the permission if there is an argument, otherwise it sets them. To set the permissions, see the setPermissionsForRole() function.
addGroup(session, userGroup): Adds the user and group to Decision Center.
enForceSecurity(session, project, userGroup): Enforces the permission and adds the new group for all the rule projects in Loan Validation Service.
loadSorted(resourceName): Reads the properties file and builds a map of permissions with it. The property file is data/rmtUserGroup.properties.
setPermissionsForRole(session, usergroup, propertiesMap): Sets the permissions map to the user.
To unset the permissions, see the function disableSecurity(session, project). It calls the Decision Center API to disable the security for a project.
- AppServlet: This servlet manages the load of projects from Decision Center, selects the current project to use, and top-level project content (the lists of packages, decision tables, and action rules for the project). The commands for this servlet can be found in src/com/ibm/rules/web/sample/servlet/command/app.
- DecisionTableEditorServlet: This servlet manages the commands for decision tables, for example, create, save, and remove. The commands are in src/com/ibm/rules/web/sample/servlet/command/dt.
- RuleEditorServlet: This servlet manages commands for action rules, for example, load, create, save, and remove. The commands are in src/com/ibm/rules/web/sample/servlet/command/rule.
The editing components are used in sample.jsp. The sample uses drop-down menus for selecting projects, rules, and decision tables. The page is dynamic, and its content is based on Dojo.
- isElementBusy(session, element): Checks whether the element can be edited.
- lockElement(session, element): Locks the element.
- unlockElement(session, element): Unlocks the element.
Source files
This sample is located in <InstallDir>/teamserver/samples/servercomponents/src/com/ibm/rules/web/sample.
login()
This method creates a new Decision Center session with the provided parameters.
logout()
This method signs you out of the Decision Center session.
A helper class provides functions to create action rules or decision tables in the Decision Center, and to check the permissions: utils/RTSHelper.java.
Commands to manage projects, decision tables, and action rules are dispatched to different places based what is managed:
- src/com/ibm/rules/web/sample/servlet/command/app
- src/com/ibm/rules/web/sample/servlet/command/dt
- src/com/ibm/rules/web/sample/command/rule/
utils/PermissionHelper.java
You can also view and modify the sample source files in Rule Designer. To import the sample into your workspace, click the Import projects link in the Samples and Tutorials view.