Class Name

atg.b2bcommerce.order.B2BOrderLookup

Component(s)

/atg/commerce/order/OrderLookup
(ATG Business Commerce only)

The OrderLookup servlet bean retrieves one or more Order objects, depending on the supplied input parameters. It enables you to retrieve a single order, all orders assigned to a particular cost center, all orders placed by a particular user, or all orders placed by a particular user that are in a specific state.

OrderLookup has a security feature that allows the current user to view only her own orders. By default, this feature is enabled. To disable the feature, set the enableSecurity property to false.

Input Parameters

orderId (Either this, userId, or costCenterId is required.)
The ID of the order to retrieve.

userId (Either this, orderId, or costCenterId is required.)
The ID of the user profile whose orders will be retrieved.

costCenterId (Either this, orderId, or userId is required.)
The ID of the cost center whose orders will be retrieved.

state
The desired state of the orders to retrieve.

This parameter can be used in conjunction with userId. You can specify one of the following:

If you specify “open,” then all orders whose states are specified in the openStates property of the OrderLookup component are returned; by default, this list of states is set to the following:

If you specify “closed,” then all orders whose states are specified in the closedStates property of the OrderLookup component are returned; by default, this list of states is set to the following:

You can override either list of states by using the optional openStates or closedStates input parameter (see below).

openStates
A comma-separated list of states that correspond to “open” state.

This parameter can be used in conjunction with the state input parameter when the state input parameter is set to “open.” Use this optional parameter when you want to override the configured list of states in the openStates property of the OrderLookup component.

closedStates
A comma-separated list of states that correspond to “closed” state.

This parameter can be used in conjunction with the state input parameter when the state input parameter is set to “closed.” Use this optional parameter when you want to override the configured list of states in the closedStates property of the OrderLookup component.

sortBy
A string that specifies an Order property by which to sort the orders.

This parameter can be used in conjunction with userId. When using this parameter, you can specify the name of any Order Repository property (that is, the name of any property defined in orderrepository.xml), such as id, state, or submittedDate.

sortAscending
True or false. This parameter is used in conjunction with the sortBy input parameter. If set to true, the Order objects in the resulting array are sorted in ascending order by the property specified in the sortBy input parameter. The default value is false.

numOrders
The number of orders to return for the given query.

startIndex
The index of the first order in the result set. This parameter is useful for cycling through a large number of orders.

queryTotal
Indicates whether the number of retrieved orders will be calculated into a total that’s accessible through the totalCount and total_count output parameters. Setting this property to false prevents the total count from being generated, regardless of the value specified in the queryTotal property. Omitting this parameter causes the default value, true, to be used. Use this parameter to ensure that queries to the database are made only when necessary.

queryTotalOnly
Indicates whether the total number of orders and the orders themselves are produced from the servlet bean. Setting this parameter to true makes the total number of retrieved orders available through the totalCount and total_count output parameters. The orders themselves are not retrieved or accessible. Use this parameter to ensure that queries to the database are made only when necessary.

Omitting this parameter, which is the same as setting it to false, saves a list of order objects to the output open parameter as well as the total number of orders to the totalCount and total_count output parameters.

If queryTotal=false (orders, no total) and queryTotalOnly=true (total, no orders), a total is generated only as specified in the queryTotalOnly parameter.

Output Parameters

result
The array of Order objects. If the orderId input parameter was used, then this parameter contains a single Order object.

errorMsg
If an error occurred, this is the detailed error message for the user.

count
The size of the array of Order objects.

totalCount
If the queryTotal property is set to true, this parameter indicates the total number of orders that meet the criteria for the order lookup.

total_count
Identical to the totalCount output parameter (above).

startRange
The index number that marks the beginning of a range of orders. For example, if 5 orders were returned from a given OrderLookup query, the startRange is set to 1.

endRange
The index number that marks the end of a range of orders. For example, if 5 orders were returned from a given OrderLookup query with a startRange of 6, the endRange is set to 10.

nextIndex
The index of the first order in the next set of results. If the startIndex or numOrders input parameter was null, then this parameter will be null.

previousIndex
The index of the first order in the previous set of results. If the startIndex or numOrders input parameter was null, then this parameter will be null.

Open Parameters

output
The open parameter rendered if the orders are successfully retrieved.

empty
The open parameter rendered if there are no orders to return.

error
The open parameter rendered if an error occurs.

Example

The following example describes how to use the OrderLookup servlet bean to retrieve all open orders for the current user and to display their IDs.

<dsp:droplet name="/atg/commerce/order/OrderLookup">
 <dsp:param bean="/atg/userprofiling/Profile.repositoryId" name="userId"/>
 <dsp:param value="open" name="state"/>
 <dsp:oparam name="output">
    <dsp:droplet name="/atg/dynamo/droplet/ForEach">
       <dsp:param param="result" name="array"/>
       <dsp:oparam name="outputStart">
          <OL>
       </dsp:oparam>
       <dsp:oparam name="output">
          <LI> <dsp:valueof param="element.id">no order number</dsp:valueof>
       </dsp:oparam>
       <dsp:oparam name="outputEnd">
          </OL>
       </dsp:oparam>
       <dsp:oparam name="empty">
          No open orders.
       </dsp:oparam>
    </dsp:droplet>
 </dsp:oparam>
 <dsp:oparam name="error">
    <span class=profilebig>ERROR:
       <dsp:valueof param="errorMsg">no error message</dsp:valueof>
    </span>
 </dsp:oparam>
</dsp:droplet>
 
loading table of contents...