Class Name

atg.commerce.order.OrderLookup

Component(s)

/atg/commerce/order/AdminOrderLookup

/atg/commerce/order/OrderLookup

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 placed by a particular user, or all orders placed by a particular user that are in a specific state. For more information on the OrderLookup servlet bean, see the Implementing Order Retrieval chapter.

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

Input Parameters

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

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

quoteOrderHistory
This flag should be set to true to obtain quote history for an order. This flag and the order ID are needed to return quote history.

costCenterId
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.

openStates
A comma-separated list of states that correspond to the “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 the “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.

siteIds
A collection of site IDs used to limit the query to orders associated with the specified sites.

organizationIds
The IDs of organizations that are associated with a specific order.

siteScope
If you are using Oracle Commerce Platform’s multisite feature, you can filter orders by site. Use siteScope if no siteId is specified, and provide one of the following scopes:

The default siteScope can be set through a configurable property on the component. The default value is null.

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>

The following example describes how to use the OrderLookup servlet bean to display information about a particular order with the ID of 123:

<dsp:droplet name="/atg/commerce/order/OrderLookup">
  <dsp:param value="123" name="orderId"/>
  <dsp:oparam name="error">
    <p>
    ERROR:
    <dsp:valueof param="errorMsg">no error message</dsp:valueof>
    <p>
  </dsp:oparam>
  <dsp:oparam name="output">
    <p>
    order #<dsp:valueof param="result.id">no order id</dsp:valueof>
    <p>
This order is in state:
<dsp:valueof param="result.stateAsString"/>
    <p>
    This order was placed on
      <dsp:valueof date="MMMMM d, yyyy" param="result.submittedDate"/>.
    <p>
  </dsp:oparam>
</dsp:droplet>

Copyright © 1997, 2019 Oracle and/or its affiliates. All rights reserved. Legal Notices