YOUR FEEDBACK
Adobe Flex 2 - Answering Tough Questions About Enterprise Development
A Correct Person wrote: Denis Roebrt commented on the 21 Aug 2006 "Tough Que...
SOA World Conference
Virtualization Conference
$50 Savings Expire May 23, 2008... – Register Today!

2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts

SYS-CON.TV
TOP THREE LINKS YOU MUST CLICK ON


A Real-World Business Process Model
Using the WebLogic platform for order management - Part 3

Digg This!

In Part 1 (Vol. 3, issue 6) of this series I gave you an overview of business process management (BPM) and covered the specifications in this area. I described the order change example and the steps needed to create the business process in WebLogic Integration. In Part 2 (Vol. 3, issue 7), we created a process application - orderChange. In this application we created a new process called orderChange.jpd. To start the process we added a ClientRequest received. Then we added the Web service validate config.

This month we will add a decision point to handle the result from validate config Web service. The decision point helps in handling both the positive and negative outcomes of the result from the process. Then we will add a database control to check the status of the order to be changed and lastly, we will add another decision node to handle the result from the database Control.

Add a Decision Node
When the validate config process node is executed we have two results - one that the product is valid and the other that it is not valid. To decide what to do with the two results we need to add a decision node in the business process. If the configuration is valid, the process will proceed; otherwise, it will end. To add this node, click Decision in the palette, and drag-and-drop the decision node onto the business process in design view, as shown in Figure 1.

You need to define a condition in this decision node. To do this, double-click the condition node to invoke the decision builder. Variable is selected by default. You should use variable as you design the decision based on the value of an element in an XML document namely status, which is valid against an XML Schema. Select the XML element on which the decision is made. To do so, you need to select the attribute status from outValidateConfig. Select the = operator from the Operator list and enter true in the Right Hand Expression field. Click Add to add the condition you just created (BEA) -


data($outValidateConfig/ns:Status)= "true"

This completes the design of the first condition on this node. Figure 2 shows that if the validateConfig status is true, you can go to the next step; if the decision is false, the process ends. During runtime the decision point is evaluated to determine the path of the process.

Add a Database Control
If the configuration is valid the process goes to the next step, which is executed through a database control. Database controls are part of the control framework. (We talked about the control framework in the last article.)

You need to add a database control to the process. The database control provides access to a database containing orderStatus for a particular AccountID. This control sends the AccountID to the database table ORDERSTATUS, which sends a response to reflect whether the order is changeable. You can access a relational database through a database control from your application. Using the database control, you can issue SQL commands to the database which accesses the database through the JDBC driver. You must specify a data source that is configured in WebLogic - in this example, it is cgdatasource. The database control automatically performs the translation from database queries to Java objects so that you can easily access query results.

First you will create a new Java class called record.java. The Record class is a Java object that represents an individual record within a database. In particular, it represents an individual record of the ORDERSTATUS table in the database. This is the code to add to record.java:


public class Record
{
    public String orderStatus;
}

Create a database control file that queries the ORDER STATUS table and then returns a record object containing the results of the query. This database control file is called OrderStatus DB.jcx. JCX stands for Java Control extension. A JCX file extends one of WebLogic Workshop's prebuilt control classes. In this case, it is the com.bea.control.DatabaseControl class, which offers easy access to a database. Most of the built-in controls provided with BEA WebLogic Workshop are customizable - that is, when you add a new built-in control to a project, WebLogic Workshop generates a JCX file that extends the control. In some cases - such as with the database control or the JMS control - you can customize the control by adding or editing methods defined in the JCX file. WebLogic Workshop customizes the EJB control for you based on the EJB that the control will be accessing.

Now add a method named getOrder Status to the database Control file OrderStatus DB.jcx. Then add a SQL query to the method in the property editor, as shown:


SELECT ORDER_STATUS FROM ORDERSTATUS WHERE ACCOUNT_ID={accountId}

In the Java pane, this change is reflected in the method:


public Record getOrderStatus(String accountId)

In source view, the code shows that by passing the AccountID, you get the order_status from the database table ORDERSTATUS (see Listing 1).

To pass the AccountID from the XML received from the client to the database control a transformation is used. This transformation maps the AccountId from the received XML to the AccountID sent by the database control. Once the order status is obtained, as shown in Listing 1, it can be sent to the next node in the process.

Add Another Decision Node
The next step is to check whether the orderStatus result allows for the order to be changed. For this, insert another decision point. To make the decision here, use a Java method instead of a variable. To use a Java method, select a method as shown in Figure 3. Select condition in the Java method name. If the condition's return value is boolean, as shown in the code below, then the order is changeable. If the order is changeable, go to the next step; otherwise, stop the process.


public boolean condition()
    {
       record = "OK";
    return true;
	}

Summary
In this article we have seen how the first decision node is added to the process. This node helps to handle the two results obtained from the validate config Web service, namely whether the configuration is valid or not valid. If the configuration is valid, the process calls the next node, which is a database control.

We also looked at the details of creating and adding a database control that checks the database for the order status. This order status will determine if the order is changeable. Then we added a decision to handle the result of the output from the database control.

In my next article we will see if the order status is changeable and how we write this change to a file. This change can then be uploaded to an ERP system like SAP and the order can be changed. In the final article in this series, we will see how this process is executed and monitored.

References

  • BEA WebLogic Workshop Help: http://e-docs.bea.com/workshop/docs81/doc/en/core/index.html
  • About Anjali Anagol-Subbarao
    Anjali Anagol-Subbarao works in HP's IT organization as an IT architect. She has 12 years of IT experience, the last five in Web services. Her book on J2EE Web services on BEA WebLogic was published in October 2004.

    BEA WEBLOGIC LATEST STORIES
    3rd International Virtualization Conference & Expo: Themes & Topics
    From Application Virtualization to Xen, a round-up of the virtualization themes & topics being discussed in NYC June 23-24, 2008 by the world-class speaker faculty at the 3rd International Virtualization Conference & Expo being held by SYS-CON Events in The Roosevelt Hotel, in midtown
    Microsoft To Keynote 4th International Virtualization Conference & Expo
    Mike Neil is general manager for virtualization strategy in the Windows Server Division at Microsoft. Mike is focused on the delivery of the Windows virtualization technology, including Windows Server 2008 Hyper-V, Microsoft Hyper-V Server and Virtual PC 2007. Mike also directs the tec
    Virtualization Meets DaaS - Desktop-as-a-Service
    After a $1.5 million angel round, Desktone, which was started in 2006 by Eric Pulier, who also started SOA Software, US Interactive and IVT, picked up $17 million in first-round funding about a year ago from Highland Capital Partners, SoftBank Capital, Citrix Systems and the China-base
    Engelbart's Usability Dilemma: Efficiency vs Ease-of-Use
    The mouse was the original idea of Doug Engelbart who was the head of the Augmentation Research Center (ARC) at Stanford Research Institute. Engelbart's philosophy is best embodied, in my opinion, in the design of another device that he invented, the five-finger keyboard - with keys li
    Web 2.0 Is Fundamentally About Empowering People
    'Unlocking content to be remixed into new business value' is the driver of Web 2.0 in the enterprise, says Rod Smith, IBM VP of Emerging Internet Technologies, in this Exclusive Q&A with Jeremy Geelan on the occasion of IBM's release of a new technology created by IBM researchers, code
    Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
    Here is a question that I have been pondering on and off for quite a while: Why do 'cool kids' choose Ruby or PHP to build websites instead of Java? I have to admit that I do not have an answer. Why do I even care? Because I am a Java developer. Like many Java developers, I get along w
    SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
    SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON FEATURED WHITEPAPERS

    MOST READ THIS WEEK
    ADS BY GOOGLE
    BREAKING NEWS FROM THE WIRES
    AmberPoint Extends SOA Governance to Apache ServiceMix, BEA AquaLogic Service Bus 3.0, BEA WebLogic Integration, Cisco ACE XML Gateway, JBoss Enterprise Application Platform and Oracle Fusion
    AmberPoint announced today that it has extended the reach of its runtime SOA governance