© 2002 BEA Systems, Inc.


com.beasys.commerce.ebusiness.order
Class OrderManagerBean

java.lang.Object
  |
  +--com.beasys.commerce.ebusiness.order.OrderManagerBean

public class OrderManagerBean
extends java.lang.Object
implements javax.ejb.SessionBean

The OrderManagerBean is a session bean that isolates the JSP type calls from dealing directly with Order Entity Beans in a piece-meal fashion and improves performance by keeping the calls on the EJB sides.
Its main purpose is to create an Order and to retrieve OrderValue's using a variety of criteria, customerPK, a date range, a SKU, a Status.
The returned objects on those finder methods may be either straight collection with all the orderValue objects filled, or a more sophisticated ScrollableModel which caches the PK and a few orderValues only.
Finally, the OrderManagerBean deals with getting and setting an Order's status, and helps the JSP presentation by providing the only possible statuses an Order can move to.

See Also:
OrderValue, StateMachine,
, OrderManagerHome, OrderManager, Serialized Form

Constructor Summary
OrderManagerBean()
          The constructor gets an order state machine for any status associated action.
 
Method Summary
protected static void close(java.sql.Connection connection, java.sql.PreparedStatement statement, java.sql.ResultSet resultSet)
          Close database "stuff" quietly and without exceptions.
 javax.ejb.Handle createOrder(OrderPk orderPK, OrderValue orderValue, Quote adjustments)
          Creates an order using a value object.
 void ejbActivate()
          Empty ejb method implementation
 void ejbCreate()
          Empty ejb method implementation
 void ejbPassivate()
          Empty ejb method implementation
 void ejbPostCreate()
          Empty ejb method implementation
 void ejbRemove()
          Empty ejb method implementation
 java.util.Collection findByCustomer(CustomerPk customerPk)
          Finds the OrderValues associated with a customer and returns a collection
 ScrollableModel findByCustomer(CustomerPk customerPK, int pageSize)
          Finds the OrderValues associated with a customer and returns a scrollable model
 java.util.Collection findByDates(java.sql.Date startDate, java.sql.Date endDate)
          Finds a collection of orders given a range of dates.
 ScrollableModel findByDates(java.sql.Date startDate, java.sql.Date endDate, int pageSize)
          Finds the OrderValues associated with a date range and returns a scrollable model
 OrderValue findByPK(OrderPk pk)
          Finds an order value given its primary key.
 java.util.Collection findBySKU(java.lang.String SKU)
          This method uses a prepared statement and a Jdbc Connection to retrieve Order Values from the WLCS_ORDER_LINE table, based on the SKU of a product item.
 ScrollableModel findBySKU(java.lang.String sku, int pageSize)
          This method uses a prepared statement and a Jdbc Connection to retrieve Order Values organized in a ScrollableModel from the WLCS_ORDER_LINE table, based on the SKU of a product item.
 java.util.Collection findByStatus(java.lang.String status)
          Finds the OrderValues associated with a status and returns a collection
 ScrollableModel findByStatus(java.lang.String status, int pageSize)
          Finds the OrderValues associated with a status and returns a scrollable model
 java.lang.String getOrderStatus(OrderPk pk)
          Gets the status of an order, given the order's primary key.
 java.lang.String[] getValidNewStatuses(OrderPk orderPK)
          Retrieves all the possible statuses an Order can move to based on its primary key.
 void queryOrderAdjusments(OrderPk orderPk, OrderValue orderValue)
          this call fills an orderValue with the adjustments that are associated with it.
 void setOrderStatus(OrderPk pk, java.lang.String orderStatus)
          Sets an order's status to a specified value, given the order's primary key.
 void setSessionContext(javax.ejb.SessionContext context)
          Set the session context
 void updateOrderDiscounts(OrderPk orderPk, OrderValue orderValue, Quote adjustments)
          updates the discounts associated with an order
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrderManagerBean

public OrderManagerBean()
                 throws java.lang.Exception
The constructor gets an order state machine for any status associated action. Check license first!
Method Detail

createOrder

public javax.ejb.Handle createOrder(OrderPk orderPK,
                                    OrderValue orderValue,
                                    Quote adjustments)
                             throws java.rmi.RemoteException
Creates an order using a value object. It also persist the ajustments associated with that order

Parameters:
orderPK, - the primary key for the order
orderValue, - the value object for the order
adjustments, - the adjustments for the order (and its lines)
Returns:
a handle over the order

findByPK

public OrderValue findByPK(OrderPk pk)
                    throws java.rmi.RemoteException
Finds an order value given its primary key.

Parameters:
pk - The primary key of the order to be found
Returns:
The order value
Throws:
java.rmi.RemoteException -  

findByCustomer

public ScrollableModel findByCustomer(CustomerPk customerPK,
                                      int pageSize)
                               throws java.rmi.RemoteException
Finds the OrderValues associated with a customer and returns a scrollable model

Parameters:
CustomerPk -  
pageSize, - the size of a page of cached order values
Returns:
the ScrollableModel that manages the corresponding Order values

findByCustomer

public java.util.Collection findByCustomer(CustomerPk customerPk)
                                    throws java.rmi.RemoteException
Finds the OrderValues associated with a customer and returns a collection

Parameters:
CustomerPk -  
Returns:
the Collection that manages the corresponding Order values

findByStatus

public ScrollableModel findByStatus(java.lang.String status,
                                    int pageSize)
                             throws java.rmi.RemoteException
Finds the OrderValues associated with a status and returns a scrollable model

Parameters:
status, - e.g. "Authorized"
pageSize, - the size of a page of cached order values
Returns:
the ScrollableModel that manages the corresponding Order values

findByStatus

public java.util.Collection findByStatus(java.lang.String status)
                                  throws java.rmi.RemoteException
Finds the OrderValues associated with a status and returns a collection

Parameters:
status, - e.g. "Authorized"
Returns:
the collection that manages the corresponding Order values

findBySKU

public java.util.Collection findBySKU(java.lang.String SKU)
                               throws java.rmi.RemoteException
This method uses a prepared statement and a Jdbc Connection to retrieve Order Values from the WLCS_ORDER_LINE table, based on the SKU of a product item. Each OrderValue found appears only once in the Collection, even if there are many OrderLines in a single Order for a single SKU (unlikely, but physically possible).

Parameters:
SKU -  
Returns:
a Collection (ArrayList) of OrderValue's

findBySKU

public ScrollableModel findBySKU(java.lang.String sku,
                                 int pageSize)
                          throws java.rmi.RemoteException
This method uses a prepared statement and a Jdbc Connection to retrieve Order Values organized in a ScrollableModel from the WLCS_ORDER_LINE table, based on the SKU of a product item.
Each OrderValue found appears only once in the ScrollableModel, even if there are many OrderLines in a single Order for a single SKU (unlikely, but physically possible).

Parameters:
SKU -  
pageSize -  
Returns:
a ScrollableModel (ArrayList) managing the Order Values

findByDates

public ScrollableModel findByDates(java.sql.Date startDate,
                                   java.sql.Date endDate,
                                   int pageSize)
                            throws java.rmi.RemoteException
Finds the OrderValues associated with a date range and returns a scrollable model

Parameters:
startDate - of the date range
endDate - of the date range
pageSize, - the size of a page of cached order values
Returns:
the ScrollableModel that manages the corresponding Order values

findByDates

public java.util.Collection findByDates(java.sql.Date startDate,
                                        java.sql.Date endDate)
                                 throws java.rmi.RemoteException
Finds a collection of orders given a range of dates.

Parameters:
startDate -  
endDate -  
Returns:
The Collection of order for the date range
Throws:
java.rmi.RemoteException -  

getOrderStatus

public java.lang.String getOrderStatus(OrderPk pk)
                                throws java.rmi.RemoteException
Gets the status of an order, given the order's primary key.

Parameters:
pk - The primary key of the order in question
Returns:
A string with the order's status
Throws:
java.rmi.RemoteException -  

setOrderStatus

public void setOrderStatus(OrderPk pk,
                           java.lang.String orderStatus)
                    throws java.rmi.RemoteException
Sets an order's status to a specified value, given the order's primary key.

Parameters:
pk - The order's primary key
orderStatus -  
Throws:
java.rmi.RemoteException -  

getValidNewStatuses

public java.lang.String[] getValidNewStatuses(OrderPk orderPK)
                                       throws java.rmi.RemoteException
Retrieves all the possible statuses an Order can move to based on its primary key. This can then be used by the presentation layer

Parameters:
orderPK -  
Returns:
a String array, one per status the order can be moved to

queryOrderAdjusments

public void queryOrderAdjusments(OrderPk orderPk,
                                 OrderValue orderValue)
                          throws java.rmi.RemoteException
this call fills an orderValue with the adjustments that are associated with it.

Parameters:
orderPk, - the order primary key.
orderValue, - the order value to fill with adjustments

updateOrderDiscounts

public void updateOrderDiscounts(OrderPk orderPk,
                                 OrderValue orderValue,
                                 Quote adjustments)
                          throws java.rmi.RemoteException
updates the discounts associated with an order

Parameters:
orderPk - the order primary key.
orderValue - the order value which contains the creation date and the orderline
adjustments - a Quote object containing the adjustments
Since:
WLCS 3.5 sp3, added as a customer support case

setSessionContext

public void setSessionContext(javax.ejb.SessionContext context)
Set the session context
Specified by:
setSessionContext in interface javax.ejb.SessionBean


ejbRemove

public void ejbRemove()
Empty ejb method implementation
Specified by:
ejbRemove in interface javax.ejb.SessionBean


ejbActivate

public void ejbActivate()
Empty ejb method implementation
Specified by:
ejbActivate in interface javax.ejb.SessionBean


ejbPassivate

public void ejbPassivate()
Empty ejb method implementation
Specified by:
ejbPassivate in interface javax.ejb.SessionBean


ejbCreate

public void ejbCreate()
Empty ejb method implementation


ejbPostCreate

public void ejbPostCreate()
Empty ejb method implementation


close

protected static void close(java.sql.Connection connection,
                            java.sql.PreparedStatement statement,
                            java.sql.ResultSet resultSet)
Close database "stuff" quietly and without exceptions. This convenience method takes a Statement, ResultSet, and Connection. If the argument is null or not one of the recognized types, nothing is done.


© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved