Converting Workflow Rule Records to Class Format
Converting Workflow Rule Records to Class Format
Converting workflow rule records from the "record per method" to the "record per class" format allows for many advantages, including reducing the number of rule records that must be maintained, allowing for the addition of new rules without adding new
afm_wf_rules
records, and speeding up server start-up time.
I. Use Existing Java Service Code without Modification
To modify only the
afm_wf_rules
table and the JS code that calls workflow rules without modifying the actual Java service code, use the following steps:
1) Create a new Workflow Rule record.
For example, to encompass the Capital Projects application create a new workflow rule named "CapitalProjectsService":
-
Enter the
Rule Name
field. Example: CapitalProjectsService. -
Enter the
Rule Class
field. Example: com.archibus.app.solution.common.eventhandler.CapitalProjects.CapitalProjectsHandler. -
Do not enter the
Rule Method
field. -
Set
Active
toYes
. -
Click the
Save
button. - Restart Web Central server.
2) Find usages of all workflow rules for this application. Modify and test one workflow rule call at a time.
-
Replace the
runRuleAndReturnResult
method by thecallMethodWithParameters
method. -
Modify the
rule ID
to match the new rule name and method name. The method name typically (but not always) matches the old rule name.
Old code example:
var result = Workflow.runRuleAndReturnResult('AbCapitalBudgeting-generateProgramBudget', parameters);
New code example:
var result = Workflow.callMethodWithParameters('AbCapitalBudgeting-CapitalProjectsService-generateProgramBudget', parameters);
where:
CapitalProjectsService is the name of the new workflow rule (
Rule Name
)
generateProgramBudget is the Java service method name.
3) Test the view in the browser. Remember to clear the browser cache after you change the Java Script code.
4) After you have finished testing the complete application, send the list of new workflow rules and the list of workflow rules that need to be removed to your database manager.