Creating Your First Service

Creating your own services is not difficult. Here are the necessary steps:

  1. Create service Java class.
  2. Add workflow rule definition to the database.
  3. Create a view to call the new workflow rule.

As an exercise, let's create a simple service.

Step 1: Create service Java class

  • Select the com.archibus.app.solution.logiccookbook package in the Package Explorer window.
  • Right-click on the package name and select New --> Other menu item:
    image082.JPG

  • Select Java --> Class and click on the Next button:
    image084.JPG

  • Type "MyTestService" in the Name field, and click on the Finish button:
    image086.JPG

  • Eclipse will open the MyTestService.java in the editor:
    image088.JPG

  • Add a new method that returns an information message to the view:
    image104.JPG

  • Press CTRL+S to save the file.

Step 2: Add workflow rule definition to the database

Note: You only need to add new workflow rule definitions to the database when you create a new event-handler class. You can create additional event-handler methods in the same class later without adding workflow rule definitions to the database.

  • Start the application server.

  • Select System Administration --> Add-In Manager--> Workflow Rules task.

  • Select AbSolutionsLogicAddIns application.

  • Click on the Add New button in the Workfow Rules grid panel.

  • Enter the following values in the Workflow Rule form:
    • Active? : Yes
    • Rule Name : MyTestService
    • Rule Class :com.archibus.app.solution.logiccookbook.MyTestService
      image102.JPG

  • Click on the Save button.

  • Restart the application server to load the new workflow rule definition.

Step 3: Create a view to call the new workflow rule

  • Select the schema\ab-products\solutions\logic-cookbook folder in the Package Explorer window.
  • Right click and select New --> File menu item:
    image092.JPG

  • Type the view name (ab-my-test.axvw) and click on the Finish button:
    image094.JPG

  • Eclipse will open the view file in the editor. Add the following text to the view file:
    image106.JPG