< Previous | Next >

Generating Java components

In this lesson, you will generate Java™ components to provide implementation code for the tasks created in WebSphere® Business Modeler.

This section discusses how to provide the implementation code for the following Java components:
  • CheckCustomerAccountStatus
  • UpdateOrderDatabase
  • CancelOrderandSendNotification
  • CreditRating
Complete the following steps:
  1. Double-click the assembly diagram.
  2. Right-click in a blank area on the assembly diagram panel and select Automatic Layout. Save your work.
  3. Double-click CheckCustomerAccountStatus.
    Check Account Status
    The CheckCustomerAccountStatusImpl.java window opens.
  4. Replace the contents of the following method:
    public commonj.sdo.DataObject InputCriterion(commonj.sdo.DataObject Input) {
    		//TODO Needs to be implemented.
    		return null;
    	}

    with the following content:

    public DataObject InputCriterion(DataObject input) {
    		System.out.println(
    "Check Customer Account Status Invoked");
        //	create CreditRating bean
    		com.clipstacks.credit.CreditRating creditRating =
    		new com.clipstacks.credit.CreditRating();
        //	call CreditRating bean to update the BO
    		DataObject orderOut = creditRating.calculateCreditRating(input);
    		return orderOut;
    	}
  5. Save your work. Ignore the errors at this time because they will be fixed after you create the Java™ components in the next steps.
  6. For UpdateOrderDatabase, replace the contents of the following method:
    public commonj.sdo.DataObject InputCriterion(commonj.sdo.DataObject input) {
    		//TODO Needs to be implemented.
    		return null;
    	}
    with the following content:
    public DataObject InputCriterion(DataObject input) {
    	   System.out.println("Update Order Database invoked");
    	   return input;
    }
  7. For CancelOrderandSendNotification,
    1. Select all of the text on the CancelOrderandSendNotificationImpl.java window and delete it.
    2. Open the CancelOrderandSendNotificationImpl.java file, then copy and paste its contents into the CancelOrderandSendNotificationImpl.java window.
  8. Save your work and close the window.
  9. Create a Java package to implement calculation of customer credit rating by clicking File > New > Other and then Java > Package. Click Next .
  10. In the Source folder field, click Browse and select ClipsAndTacksF1 > gen/src. Click OK.
  11. For the Java package name, enter com.clipstacks.credit and then click Finish.
    Java Package
  12. Switch to the Physical Resources view by clicking the Physical Resources tab (located in the same area as the Business Integration tab).
  13. Expand ClipsAndTacksF1 > com > clipstacks > credit and copy the CreditRating.java file that you downloaded following the directions in Download and import samples. Then paste the file into the credit folder.
    Clips and Tacks Folder
  14. Switch back to the assembly diagram editor and save it.
  15. Save any unsaved items. An open window with an asterisk (*) on the tab indicates that it is not saved. You should not have errors now.
  16. Rebuild all the projects by clicking Project > Clean, and then click OK.
    Project clean
< Previous | Next >