Cars Online Part 3 - Calculating Delivery Date

Up until this blog the trail has not been GlassFish ESB (Open ESB) specific but this entry will delve into the first of the Business Processes that have been written to back the functionality available within the Cars Online Application. As mentioned previously the Web pages are simply built using HTML / JavaScript / CSS / AJAX and are simply the User façade capable of running on any Web Server using AJAX to access the backing Servlets and hence the underlying Business Processes. Hence we can, if we choose, run this one multiple machines with multiple levels of Security.

The first of the Business Processes described, in this entry, is the Get Delivery Date. One of the key demonstration features of Cars Online was that we can generate a guaranteed Delivery Date based on the Car information selected and that this is dynamic based on previous orders.

<script type="text/javascript">$(document).ready(function(){ $("#traildiv").load("../resource/cars-online/CarsOnlineTrail.html"); }); </script>

Overview


The Get Delivery Date functionality is provided by the Business Service bpProductionDeliveryDate.bpel which takes the Car details and checks a number of summary table generated by an Intelligent Event Process (IEP) application that is running within the GlassFish application. The Business Service functionality is quite simple in that it will retrieve the current, average, delivery time for the Body Style, Engine, Interior and Exterior for the given car and then simply take the maximum value and add it to today date and return that as the delivery date. The IEP generated delivery delivery information can readily be seen displayed on the pages for Engine, Interior and Exterior as the blue bars within each of the data tables.

Page 1

Intelligent Event Process

The IEP functionality will be executed for each Order taken through the system, see later trail entries, and simply aggregates that data of a time based window. The results of the aggregations are then stores within a database to be retrieved by the application as necessary. You will notice from the IEP process below that we aggregate information for the Engine, Wheels, Interior, Exterior (Colour) and Body style.

IEP

Business Service - bsProductionDeliveryEstimate.bpel

The Business Service receives a Message based on the ProductionCom Common Envelope and the BsiProduction WSDL (See Cars Online Part 2) and then simply executes four database queries in parallel to retrieve the delivery estimate for Body Style, Engine, Interior and Exterior. If we do not find any information then we will assign a default value of 0 days to the value and ignore it later.

Business Service

Once we have retrieved the information we simply check to see which of the delivery dates is the largest and then add that many days to today's date. This is achieved using the functionality described in blog entry "Adjusting and Formatting DateTimes in BPEL". Once calculated the Delivery Date is returned and displayed.

AjaxGetDeliveryDateServlet

The Business Service is called by the AjaxGetDeliveryDateServlet Servlet running within the CarsOnlineServerApplication deployment. It can be seen, from the code below, it simply uses a NetBeans Generated Web Service Client to call the Web Service having built the appropriate Common Object structure. In can also be seen from the code below that this again has no direct ties to the GlassFish ESB Web Service and can hence run on its own Server.



Get Delivery Data JavaScript

The Cars Online Web façade accesses the AjaxGetDeliveryDateServlet Servlet using an Asynchronous JAvaScript Ajax call using the JQuery notation and simply placed the returned text, which is assumed to be a formatted date, in the html element.



Comments:

Post a Comment:
Comments are closed for this entry.
About

As a member of the Oracle A-Team we specialise in enabling and supporting the Oracle Fusion Middleware communities.

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today