© 2002 BEA Systems, Inc.


examples.e2e.b2b.processors
Class QpaProcessor

java.lang.Object
  |
  +--com.bea.portal.appflow.processor.AbstractPortalProcessor
        |
        +--examples.e2e.b2b.processors.AbstractProcessor
              |
              +--examples.e2e.b2b.processors.QpaProcessor

public class QpaProcessor
extends AbstractProcessor

The QpaProcessor runs business logic for the price query portlet (pricequery.portlet). This class handles the following portlet webflow events (See PortalAppflowConstants.PORTLET_WEBFLOW_EVENT_PARAMETER) directed to the price query portlet:

  1. selectPart
  2. submitQpa
  3. bea.portal.framework.internal.refresh
  4. null

Events are acted upon by the process() method of this class.

The "selectPart" portlet webflow event indicates that the user has selected a part from the part inventory portlet. The processor obtains the part identifier selected by the user from the HttpServletRequest with the help of the getPartParameter() method of Helper. The InventoryProvider EJB is used to obtain the Inventory object corresponding to the part identifier. The examples.e2e.common.Inventory object is stored in the user's SessionState. Following the successful completion of the aforementioned work the StateValue of the SessionState is set to StateValue.PART_SELECTED and a value of Constants.DISPLAY is returned to the caller.

The "submitQpa" portlet webflow event is generated when the user submits the QPA form in the price query portlet. The processor validates the form information and either throws an InvalidFormDataException, which causes the form to be redisplayed with an appropriate message, or creates and submits a QPA to the back-end workflow system. The created QPA is added to the SessionState. The SessionState is also updated to reflect when the quote system will be considered to be timed out (See TIMEOUT_PROP for more details). A PurchaseManager EJB is used to submit the QPA. On successful submission of the QPA the StateValue of the SessionState is set to StateValue.QPA_SENT and a value of Constants.READ_ONLY is returned to the caller.

The "bea.portal.framework.internal.refresh" and "null" events are handled identically. When encountered the processsor simply returns an appropriate response based on the StateValue of the SessionState.

if the StateValue is StateValue.START or StateValue.PRODUCT_SELECTED a value of Constants.NOT_SELECTED is returned by process().

if the StateValue is StateValue.PART_SELECTED a value of Constants.DISPLAY is returned by process().

Otherwise a value of Constants.READ_ONLY is returned by process().


Field Summary
static java.lang.String TIMEOUT_PROP
          Override the default QPA timeout (TIMEOUT_SECONDS) value by setting this system property, "samples.e2e.b2b.qpa.timeout", to some java long value greater than or equal to zero.
static long TIMEOUT_SECONDS
          The default value for the QPA timeout: 300 seconds.
 
Constructor Summary
QpaProcessor()
          Constructs a processor.
 
Method Summary
protected  java.util.Calendar getCalendar(javax.servlet.http.HttpServletRequest request, java.util.Calendar currentDate, RequestState rState)
           
 java.lang.Object process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PortalRequest portalRequest, java.lang.Object requestContext, PipelineSession session, RequestState rState, SessionState sState)
           
 
Methods inherited from class examples.e2e.b2b.processors.AbstractProcessor
getAppflowEvent, getInventoryProvider, getParts, getPipelineSession, getPortalEvent, getPortletEvent, getProducts, getPurchaseManager, getRequestState, getSessionState, getTimeoutCalendar, isPortletMaximized, process, submitPO, submitQPA
 
Methods inherited from class com.bea.portal.appflow.processor.AbstractPortalProcessor
getCurrentPortletState, process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIMEOUT_SECONDS

public static final long TIMEOUT_SECONDS
The default value for the QPA timeout: 300 seconds.

TIMEOUT_PROP

public static final java.lang.String TIMEOUT_PROP
Override the default QPA timeout (TIMEOUT_SECONDS) value by setting this system property, "samples.e2e.b2b.qpa.timeout", to some java long value greater than or equal to zero. The default value will be used if the property is set to an invalid value.
Constructor Detail

QpaProcessor

public QpaProcessor()
Constructs a processor.
Method Detail

process

public java.lang.Object process(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                PortalRequest portalRequest,
                                java.lang.Object requestContext,
                                PipelineSession session,
                                RequestState rState,
                                SessionState sState)
                         throws ProcessingException,
                                InvalidFormDataException

Parameters:
request - an HttpServletRequest to process.
response - the HttpServletRequest associated with the request.
portalRequest - the PortalRequest associated with this http request.
requestContext - the webflow request context.
session - the PipelineSession object associated with this request.
requestState - the RequestState associated with this http request.
sessionState - the SessionState associated with this user session.
Returns:
Constants.NOT_SELECTED if no part has been selected from the product inventory portlet, otherwise a value of Constants.DISPLAY is returned.
Throws:
IllegalStateException - will be thrown for the following errors:

  1. if the part identifier does not exist in the HttpServletRequest or if the part identifier is null when processing a "selectPart" event.
  2. if unable to find a corresponding Inventory object for the part identifier encountered when processing a "selectPart" event.
  3. if no part exists in the SessionState when processing a "submitQpa" event.
E2EProcessingException - will be thrown for the following errors:

  1. if unable to create or call the InventoryProvider EJB when attempting to obtain part Inventory objects during processing of a "selectPart" event.
  2. on a failure to submit the QPA to the back-end workflow system.
InvalidFormDataException - if invalid form data is provided for a "submitQpa" event.
Overrides:
process in class AbstractProcessor

getCalendar

protected java.util.Calendar getCalendar(javax.servlet.http.HttpServletRequest request,
                                         java.util.Calendar currentDate,
                                         RequestState rState)
                                  throws InvalidFormDataException

© 2002 BEA Systems, Inc.

Copyright © 2002 BEA Systems, Inc. All Rights Reserved