Creating BPL Business Processes
This page describes at a high level how to create and edit BPL business processes for interoperability productions.
For these tasks, you use the BPL Editor. To open the BPL Editor, select Interoperability > Build > Business Processes in the Management Portal.
Creating a BPL Business Process
To create a BPL business process, do the following in the BPL Editor:
-
Click New.
This displays a dialog box.
-
Specify some or all of the following information:
-
Package (required)—Enter a package name or click the arrow to select a package in the current namespace.
Do not use a reserved package name; see Reserved Package Names.
-
Name (required)—Enter a name for your BPL business process class.
-
Description—Enter a description for your BPL business process class; this becomes the class description.
-
-
Click OK.
The start and end points of the BPL diagram display in the BPL Editor, ready for you to add activities to your BPL business process.
Opening a BPL Business Process
To open a BPL business process, do the following in the BPL Editor:
-
Click Open.
If you are currently viewing a BPL and you have made changes but have not yet saved them, InterSystems IRIS prompts you to confirm that you want to proceed (which will discard those changes).
-
Click the package that contains the BPL.
Then click the subpackage as needed.
-
Click the BPL class.
-
Click OK.
Setting General Properties of the BPL Business Process
Each BPL business process has a small set of properties that apply to the process as a whole. To set these properties, do the following in the BPL Editor
-
Click the General tab.
-
Modify the following settings:
-
Language—Can be Python or ObjectScript.
-
Layout—Select either Automatic or Manual for the size of the diagram. If you select Manual you can enter a Width and Height.
-
Annotation—Enter text to include in the class description.
-
Includes—An optional comma-delimited list of include file names, so that you can use macros in your <code> segments.
-
Version—Enter an optional version number of the BPL diagram
-
Is component—If true, include this process in the component library where it can be called by other processes.
See <process> for details on these properties.
-
Defining the context Object
Each BPL business process has a context object that provides information available for use in the BPL logic. To define this object, do the following in the BPL Editor:
-
Click the Context tab.
-
Modify the following settings:
-
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.ContextOpens in a new tab. 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.
-
-
To add a property, click the plus sign next to Context properties.
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 or click Cancel to discard them.
To set property parameters such as MINVAL, MAXVAL, MINLEN, MAXLEN, or others, 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 %StringOpens in a new tab or %IntegerOpens in a new tab, you can enter data types such as:
%String(MAXLEN=256) %Integer(MINVAL=0,MAXVAL=100) %String(VALUELIST=",Buy,Sell,Hold")
Once you have defined properties of 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 types described in Data Types. These include %StringOpens in a new tab, %IntegerOpens in a new tab, %BooleanOpens in a new tab, and so on.
-
System data types have optional parameters. For details, see Parameters. These include the MINLEN and MAXLEN parameters that set the minimum and maximum allowed lengths of a %StringOpens in a new tab property. The default maximum %StringOpens in a new tab length is 50 characters; you can reset this by setting the MAXLEN for that %StringOpens in a new tab 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.BusinessProcessOpens in a new tab; 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.
Adding an Activity
Each BPL business process consists of a set of connected activities. In general, to add an activity to a BPL business process, do the following in the BPL Editor:
-
Click Add Activity in the ribbon bar.
This adds a new shape to the BPL diagram.
-
Edit the activity details in the Activity tab on the right.
-
Use drag and drop options to modify how this activity is connected to others.
For details, see Adding Activities to BPL and Editing a BPL Diagram.
Undoing a Change
To undo the previous change in the BPL Editor, click the Undo button
.
Saving a BPL
To save a BPL while in the BPL Editor, do one of the following:
-
Click Save.
-
Click Save As. Then specify a new package, class name, and description and click OK.
-
Click Compile. This option saves the BPL and then compiles it.
Compiling a BPL
To compile a BPL while in the BPL Editor, click Compile. This option saves the BPL and then compiles it.
Notes on Creating BPL in Studio
When you save a diagram from the BPL Editor, it generates a class definition—that is, a text document—in correct BPL syntax. The BPL diagram and the BPL document are equally valid descriptions of the same BPL business process class. Studio recognizes each format interchangeably. A change to one automatically generates a change to the other. Therefore, while viewing the class in Studio, you can switch between diagram and text views of the BPL document by clicking
View Other Code or pressing Ctrl-Shift-V.
When switching from the text view to the graphical view, sometimes it is necessary to close and reopen the class to see the graphical view again.
Some of the tools in the Management Portal do not appear with the others; existing Studio commands provide the same functions.
| Command | Studio Equivalent |
|---|---|
| New | On the File menu, click New and then click Business Process on the Production tab. |
| Open | On the File menu, click Open to launch the finder dialog to choose an existing BPL business process class to load and begin editing it. |
| Save | On the File menu, click Save to save any changes you have made to the business process diagram. |
| Save As | On the File menu, click Save As to save your changes as a new BPL business process class. |
| Compile | On the Build menu, click Compile to compile the BPL business process class. |
![]() |
On the File menu, click Print to open the Print dialog. |
You can export a BPL diagram to an XML file which can later be imported into another InterSystems IRIS installation. The rules for doing this are the same as for importing or exporting any other class to a file. In Studio, use the Tools Export and Tools Import commands.
There are tasks you can do in the BPL code when defining the context object:
In BPL code, insert <property> elements inside the <context> element, one for each property, as described in Business Process and Data Transformation Language Reference.
To set property parameters such as MINVAL, MAXVAL, MINLEN, MAXLEN, or others in BPL code, you must allow the <property> element to specify the data type with its type attribute (class name only) and include a <parameters> element inside the <property> element to describe any data type parameters that you want to include, as described in Business Process and Data Transformation Language Reference. For example:
<context>
<property name='Test' type='%Integer' initialexpression='342' >
<parameters>
<parameter name='MAXVAL' value='1000' />
</parameters>
</property>
<property name='Another' type='%String' initialexpression='Yo' >
<parameters>
<parameter name='MAXLEN' value='2' />
<parameter name='MINLEN' value='1' />
</parameters>
</property>
</context>
