The ScheduledOrderHandler
is responsible for creating, updating, deleting, activating, and deactivating scheduled orders. ATG Commerce provides an instance of atg.b2bcommerce.order.scheduled.ScheduledOrderHandler
, which extends atg.repository.servlet.RepositoryFormHandler
. It is located in Nucleus at /atg/commerce/order/scheduled/ScheduledOrderFormHandler
.
A scheduled Order
has some complex properties that are incapable of being mapped directly from the user interface to the value Dictionary defined in the RepositoryFormHandler
(of which ScheduledOrderHandler
is a subclass). Simple properties, such as name
and state
, can be handled by the superclass RepositoryFormHandler
. However, other complex properties map to a large number of user input fields. For example, the startDate
and endDate
properties in the value Dictionary are both mapped to Year, Month, Date, and Hour input fields. Similarly, the schedule
property maps to a large number of input fields. Each property of a scheduled Order
that maps to more then one form element or needs special processing is represented by an instance of the abstract class atg.b2bcommerce.order.scheduled.ComplexScheduledOrderProperty
or one of its subclasses. The ComplexScheduledOrderProperty
class has two methods that facilitate the mapping between the property in the value Dictionary and the corresponding user input fields in a form, namely remapValueFromScheduledOrder()
and remapValueFromUserInputField()
.
The ScheduledOrderFormHandler.complexScheduledOrderProperties
property is a Map
that specifies the complex properties in the scheduled Order
. The keys to the Map
are the names of the complex properties, and the values are the names of the classes that represent those properties, as shown in the following ScheduledOrderFormHandler.properties
file:
$class=atg.b2bcommerce.order.scheduled.ScheduledOrderHandler
$scope=session
#From RepositoryFormHandler
itemDescriptorName=scheduledOrder
repository=/atg/commerce/order/OrderRepository
requireIdOnCreate=false
clearValueOnSet=true
#From ScheduledOrderFormHandler
localeService=/atg/userprofiling/LocaleService
profile=/atg/userprofiling/Profile
orderManager=/atg/commerce/order/OrderManager
transactionManager=/atg/dynamo/transaction/TransactionManager
scheduledOrderTools=ScheduledOrderTools
complexScheduledOrderProperties=\
calendarSchedule=atg.b2bcommerce.order.scheduled.CalendarSchedu
leProperty,\
startDate=atg.b2bcommerce.order.scheduled.DateProperty,\
endDate=atg.b2bcommerce.order.scheduled.DateProperty,\
templateOrderId=atg.b2bcommerce.order.scheduled.TemplateOrderProperty
Note that the templateOrderId
property is represented by the TemplateOrderProperty
class, which extends ComplexScheduledOrderProperty
. When a user designates an existing Order
as a template Order
, the existing Order
is copied, and the new template Order
is assigned a new ID. The templateOrderId
property contains a reference to the repository ID of the new template Order
. When the user later views the scheduled Order
, this property loads the associated template Order
represented by the templateOrderId
.
Once a scheduled order template has been modified, ScheduledOrderLookup
can be used to provide information on scheduled orders for a scheduled order ID (itemId
), template ID (templateId
) or profile ID (profileId
). Output parameters include scheduledOrders
and count
.
Scheduling information can be displayed in different formats. Using a scheduled order item or ID, ScheduledOrderInfo
can provide a reference to scheduled objects, the scheduled order item and a readable string representation of the schedule. Output parameters to ScheduledOrderInfo
are scheduledOrderItem
, readableSchedule
and schedule
.
The following table describes the important handle methods of ScheduledOrderFormHandler
:
Method | Description |
---|---|
| Called when the user wants to review or update a scheduled The method retrieves all of the property values for the scheduled |
| Called when the user wants to review the input data for the scheduled |
| Creates a scheduled |
| Updates an existing scheduled |
| Deletes an existing scheduled |
| Inactivates an existing scheduled |
| Activates an existing scheduled Order in the Order Repository by changing the state of the |
Note that the ScheduledOrderFormHandler
uses ScheduledOrderTools
to fire events for all of the actions that are associated with these handle methods.
Using the scheduledOrderFormHandler
is very similar to using the RepositoryFormHandler
. (For more information on using the RepositoryFormHandler
, see the Using Repository Form Handlers chapter of the ATG Page Developer’s Guide.) Simple properties like name
, state
, and nextScheduledRun
can all be set in the following manner:
<dsp:form action="setName.jsp"> new name : <dsp:input bean="ScheduledOrderHandler.value.name" type="text"/><br> <dsp:input bean="ScheduledOrderHandler.update" value="update name" type="submit"/> </dsp:form>
Complex properties of the scheduled Order
are set according to the configuration of ScheduledOrderFormHandler.complexScheduledOrderProperties
property. As shown in the ScheduleOrderFormHandler.properties
file above, the startDate
and endDate
complex properties of a scheduled Order
are represented by the DateProperty
class. The following JSP example illustrates how to change these properties, using the month in the startDate
as an example:
<dsp:form action="setStartDateMonth.jsp"> New start month : <dsp:input bean="ScheduledOrderFormHandler.value.startDate.month" type="text"/> <br> <dsp:input bean="ScheduledOrderFormHandler.update" value="update month" type="submit"/> </dsp:form>
You can modify the schedule
property of a scheduled Order
in a similar manner. Two classes in package atg.commerce.order.scheduled
can represent the schedule
property of a scheduled Order
:
atg.commerce.order.scheduled.CalendarScheduleProperty
If used, the
schedule
property is represented by aCalendarSchedule
, and theschedule
property is mapped to the user input form fields used by theCalendarSchedule
.A
CalendarSchedule
specifies a task that occurs according to units of the calendar and clock (for example, at 2:30 AM on the 1st and 15th of every month).atg.commerce.order.scheduled.PeriodicScheduleProperty
If used, the
schedule
property is represented by aPeriodicSchedule
, and theschedule
property is mapped to the user input form fields used by thePeriodicSchedule
.A
PeriodicSchedule
specifies a task that occurs at regular intervals (for example, every 10 seconds in 20 minutes without catch up).
The following JSP example illustrates how to change the schedule
property. In this example, the frequency of a schedule whose scheduledMode
is Monthly is updated:
<dsp:form action="setSchedule.jsp"> … <dsp:select bean="ScheduledOrderFormHandler.complexScheduledOrderMap.calendarSchedule. userInputFields.scheduleMode" size="1" name="select"> <dsp:option value="onceMonthly"/>once a month. <dsp:option value="biMonthly"/>every two months. <dsp:option value="quarterly"/>every quarter. </dsp:select> … <dsp:input bean="ScheduledOrderFormHandler.update" value="Update" type="submit"/> </dsp:form>
For more information on CalendarScheduleProperty
and PeriodicScheduleProperty
, see the ATG API Reference. For more information on CalendarSchedule
and PeriodicSchedule
, see the Scheduler Services section of the Core Dynamo Services chapter in the ATG Programming Guide.