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 to Yes .
  • 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 the callMethodWithParameters 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.


II. Convert Java Service Code to Use Class-level Workflow Rule Security

Methods for creating new java classes using class-level workflow rule security are outlined in the Business Logic section.