Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

A Real-World Business Process Model

Using the WebLogic platform for order management - Part 3

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
  • More Stories By 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.

    Comments (0)

    Share your thoughts on this story.

    Add your comment
    You must be signed in to add a comment. Sign-in | Register

    In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


    IoT & Smart Cities Stories
    All in Mobile is a place where we continually maximize their impact by fostering understanding, empathy, insights, creativity and joy. They believe that a truly useful and desirable mobile app doesn't need the brightest idea or the most advanced technology. A great product begins with understanding people. It's easy to think that customers will love your app, but can you justify it? They make sure your final app is something that users truly want and need. The only way to do this is by ...
    Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
    Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
    DXWorldEXPO LLC announced today that Big Data Federation to Exhibit at the 22nd International CloudEXPO, colocated with DevOpsSUMMIT and DXWorldEXPO, November 12-13, 2018 in New York City. Big Data Federation, Inc. develops and applies artificial intelligence to predict financial and economic events that matter. The company uncovers patterns and precise drivers of performance and outcomes with the aid of machine-learning algorithms, big data, and fundamental analysis. Their products are deployed...
    The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...
    CloudEXPO | DevOpsSUMMIT | DXWorldEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
    Cell networks have the advantage of long-range communications, reaching an estimated 90% of the world. But cell networks such as 2G, 3G and LTE consume lots of power and were designed for connecting people. They are not optimized for low- or battery-powered devices or for IoT applications with infrequently transmitted data. Cell IoT modules that support narrow-band IoT and 4G cell networks will enable cell connectivity, device management, and app enablement for low-power wide-area network IoT. B...
    The hierarchical architecture that distributes "compute" within the network specially at the edge can enable new services by harnessing emerging technologies. But Edge-Compute comes at increased cost that needs to be managed and potentially augmented by creative architecture solutions as there will always a catching-up with the capacity demands. Processing power in smartphones has enhanced YoY and there is increasingly spare compute capacity that can be potentially pooled. Uber has successfully ...
    SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
    When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...