The depends element defines actors that must be executed before another actor can run. If the actor that must be run first cannot be found, an error will occur, but the current actor will still execute. This element allows you to order actors in an actor-chain when the actors have been XML combined. If you do not specify a depends attribute, actors will be executed in the order in which they appear in the definition file.

The depends-if-present element is similar to the depends element, in that it specifies an actor that must run prior to the current actor’s execution. However, in the depends-if-present element, the specified actor is not required in the actor-chain. This element is best used when an actor in the actor-chain may not be available. The element allows you to identify actor order, but will not generate an error if the requirements are not met.

Both the depends and the depends-if-present elements use the required id attribute, which identifies the ID of the actor that must run before the current actor.

Ordering Actors

The depends and the depends-if-present elements control actor-chain ordering. If your actors are defined in a single file, the order in which you define your actors is the way they will be executed. However, if you have actors that you have defined in various overriding layers and you want to change their order, you must identify the order using the depends and depends-if-present elements. If actor order is not important, these elements are not required in the actor definition. For example, if you have a base configuration file for shipping groups:

<actor-template>
  <droplet id="ApplicableShippingGroups" name="/atg/commerce/custsvc/
      order/ApplicableShippingGroups" var="applicableShippingGroups">
    <!-- The ShippingGroupDroplet must be initialized before the
         ApplicableShippingGroups droplet can be invoked -->
    <input name="order" value="${nucleus["/atg/commerce/custsvc/environment/
        CSREnvironmentTools"].currentOrder}"/>
    <oparam name="output">
      <output name="shippingAddresses" value="${applicableShippingGroups.
          shippingGroups}" filter-id="shippingAddress"/>
    </oparam>
  </droplet>
 </actor-chain>
<actor-template>

The file that you would create in your local configuration directory to order actors would contain:

<actor-template>
  <actor-chain id="shippingAddresses" transaction="TX_SUPPORTS">
    <droplet id="ShippingGroupDroplet"
        name="/atg/commerce/custsvc/order/ShippingGroupDroplet">
      <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>
    <droplet id="ApplicableShippingGroups">
    <!-The ShippingGroupDroplet must be initialized before the
        ApplicableShippingGroups droplet can be invoked -->
      <depends id="ShippingGroupDroplet"/>
    </droplet>
  </actor-chain>
<actor-template>

In this example, the ShippingGroupDroplet initializes the shipping group information. However, because it must be invoked before running the ApplicableShippingGroups droplet, you must define a depends element, indicating that the ShippingGroupDroplet should be executed first.


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