This section provides a few actor definition examples. Note that to create an ActorChainService component, you must create both a Nucleus component and an XML file that contains the actor-template instance definition. Note that when working with actor definitions, it is best to use XML combination to add your customizations.

Example: Creating a Order Confirmation Actor

The following is an example that creates a ComponentActor that adds a component to the ModelMap. This actor will reference a Nucleus component and an XML file that defines the actor-template.

Example: Creating a Shipping Address Actor

The following is an example that creates a Nucleus component and an XML file that defines an actor-template instance that allows you to access shipping address data.

  1. Define the Nucleus component and identify the XML file that defines the actor-template:

    /custom/atg/commerce/ShippingAddressesActor.properties
    $class=atg.service.actor.ActorChainService
    definitionFiles+=/custom/atg/commerce/shippingAddressesActor.xml

  2. Create the XML file that creates a shippingAddresses actor-chain:

    /custom/atg/commerce/shippingAddressesActor.xml
    <actor-template>
      <actor-chain id="shippingAddresses" transaction="SUPPORTS">
        <!-atg.service.actor.DropletActor processes this tag.-->
        <droplet id="ShippingGroupDroplet"
            name="/atg/commerce/custsvc/order/ShippingGroupDroplet">
          <!-The droplet input is taken from the query string -->
          <!-This tag sets the droplet input parameter -->
          <input name="clear" value="${param.init}"/>
          <input name="initShippingGroups" value="${param.init}"/>
          <input name="initShippingInfos" value="${param.init}"/>
          <input name="initBasedOnOrder" value="${param.init}"/>
          <input name="shippingGroupTypes" value="${nucleus["/atg/commerce/
              custsvc/util/CSRConfigurator"].
              shippingGroupTypesToBeInitialized"/>
        </droplet>
        <!-atg.service.actor.DropletActor processes this tag.-->
        <droplet id="ApplicableShippingGroups"
            name="/atg/commerce/custsvc/order/ApplicableShippingGroups"
            var="applicableShippingGroupsParams">
          <!-This tag sets the droplet input parameter -->
          <input name="order" value="${nucleus["/atg/commerce/custsvc/
              environment/CSREnvironmentTools"].currentOrder}"/>
          <oparam name="output">
            <output name="shippingAddresses"
                value="${applicableShippingGroupsParams.shippingAddress}"
                filter-id="shippingAddress"/>
          </oparam>
        </droplet>
      </actor-chain>
    <actor-template>

Example: Creating a Profile Form Handler Actor

The following example demonstrates how to create an actor-template with multiple chains. This allows you to define multiple chains in the same XML file. However, it is best to define XML files based on a single functional area.

This example creates a ProfileActor, which contains XML chains for its functional areas. This actor contains profile-related functions such as getting, creating, or deleting a profile, profile address, or credit card. It is best to provide the form handler or any single-service function within an actor, as doing so groups related chains together and reduces the number of Nucleus components that must be defined.


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