Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?

Defining the context Object

Defining the context Object

You can define the context object of a BPL business process from the Context tab of the Business Process Designer. You can click the magnifying glass to launch the Finder Dialog for each of the following fields:

  • Request Class — Choose the class of the incoming request for this process.

  • Response Class — Choose the class of the response returned by this process.

  • Context Superclass — Use this option to provide custom context properties, in a different way than adding to the Context properties list, described next. To use Context Superclass, create a custom subclass of Ens.BP.Context. In this subclass, define class properties to use as context properties. Use the name of this class as the value of Context Superclass in the business process. Then when you create <assign> actions, for example, you can choose these custom properties in addition to the standard properties of the context object.

You can add to the list of Context properties by clicking the plus sign to launch the Business Process Context Property wizard. Then enter values in the following fields:

  • Property Name — Must be a valid identifier.

  • Choose if the property data is one of the following: Single Value, List Collection, or Array Collection

  • Property Type — Type of this property including parameters.

    Enter a data type class name in the Type field or click the magnifying glass to browse for a class you want to use as a data type.

  • Default Value (ignored for collections) — Enter an initial expression for a single value data type.

  • Instantiate — Select this check box for object-valued properties if you want the object to be instantiated when it is created.

  • Description — Enter an optional description of the context property.

Click OK to save your changes, Cancel to discard them. The Business Process Designer generates the necessary <context> and <property> elements in the BPL code.

To set property parameters such as MINVAL, MAXVAL, MINLEN, MAXLEN, or others in the Business Process Designer, add data type parameters to a context property when you first add the property, or at any subsequent time, by inserting a comma-separated list of parameters enclosed in parentheses after the data type class name. That is, rather than simply entering %String or %Integer, you can enter data types such as:

%String(MAXLEN=256)
%Integer(MINVAL=0,MAXVAL=100)
%String(VALUELIST=",Buy,Sell,Hold")

The Business Process Designer generates the necessary <parameters> element in the BPL code.

Once you have defined properties on the context object, you can refer to them anywhere in BPL using ordinary dot syntax and the property name, as in: context.MyData

For reference details, see the following resources:

  • Typically you choose the property type from the system library of data types described in “Data Types” in Using Caché Objects. These include %String, %Integer, %Boolean, etc.

  • System data types have optional parameters. For details, see the Parameters section in the chapter “Data Types” in Using Caché Objects. These include the MINLEN and MAXLEN parameters that set the minimum and maximum allowed lengths of a %String property. The default maximum %String length is 50 characters; you can reset this by setting the MAXLEN for that %String property to another value.

By default, the ruleContext passed to the rule is the business process execution context. If you specify a different object as a context, there are some restrictions on this object: It must have a property called %Process of type Ens.BusinessProcess; this is used to pass the business process calling context to the rules engine. You do not need to set the value of this property, but it must be present. Also, the object must match what is expected by the rule itself. No checking is done to ensure this; it is up to the developer to set this up correctly.

Feedback