Working with method pipeline stages
As discussed inMethod pipelines, business object methods are implemented as pipelines, each of which executes a specific set of one or more pipeline stages, which execute one at a time and in order. The pipeline operates by passing a result set between each stage. Stages can read and write attribute values from the set; depending on the purpose of each stage, it might submit existing values to the data source, fill the result set with records and values from the data source and/or update values in the result set by making calculations based on existing values, constants and/or values from the data source.
When you design a business object method, you must start by establishing the basic method pipeline and its settings . When you do this, the pipeline initially contains a single stage, which matches the basic type established when you create the pipeline (e.g., find, insert, delete, etc.). You might then choose to fine-tune the stage, add additional stages or even replace the stage with another one.
Adding, removing, and editing stages in a pipeline
To add a stage to a pipeline, right-click on the target pipeline and choose Add Stage from the contextual menu. The stage Properties window opens, which you must then use to establish the stage settings (see "Setting Stage Properties", below). You can then use the positioning controls to establish the position at which the stage should execute.
To delete a stage, right-click on the target stage and choose Delete Stage from the contextual menu.
To edit the properties of an existing stage, double-click on the target stage. The stage Properties window opens, which you can then use to modify the stage settings (see "Setting Stage Properties", below).
Setting stage properties
The stage properties window is presented whenever you add a new stage or edit an existing one ("Adding, removing, and editing stages in a pipeline", above).
The settings work as follows:
-
Data source: This drop-down list establishes the stage package you will use and, for data-access stages, the data-source configuration for communicating with a specific back-end system. The drop-down list includes all of the data sources currently configured for your application (including those listed as "custom stages"). Custom stages typically perform calculations within the pipeline, but do not access any back-end system, so this setting controls only the package that supplies custom stage you want to use (you must fine-tune this to identify a specific custom-stage from that package using the other settings in this window, described below).
-
Type: Select the type of operation that the stage should perform (find, insert, update, iterator, procedure, etc.). See the table below for details about each available type. This setting affects the way that the code generator will create the Java class during deployment.
-
Package Prefix: This is the "Java path", or package name, of where the code for the stage is found/generated. Normally, you will not edit this value; it is found automatically based on your selections in the Data Source and Full Name fields (see below). Some custom stages may require special settings here; these will be described in documentation accompanying the custom stages or as established by your own stage developers.
-
Name: Enter a short name that describes the purpose of the stage.
Note: Only the characters a-z, A-Z, 0-9 and _ (underscore) are allowed.Ensure that the name you choose is not already used for any other stages belonging to the same pipeline.
-
Full Name: For data-access stages, such as the SQL Server Connector, this value is generated automatically based on your other settings in this window (it is a concatenation of Package, Type and Name) and should not be edited. For custom stages, click on the ellipsis button to select a specific stage from the currently specified Data Source; your selection will update the Package, Name, and Full Name fields to match your choice. This becomes the name of the Java class that is deployed to the application server for the method.
-
Mapping: This drop-down list includes all of the mapping variants established for the current business object and data source combination (custom stages typically do not use mappings). Select the variant that you wish to use to map the current stage to the data source. The use of variants can vary according to the type of data source connector you are using. If the mapping you want to use does not yet exist, click on the Mapping button to open the Business Object Mappings window, which enables you to configure mappings for your selected data source.
-
Use if condition: You can, optionally, specify a Use if condition from the drop-down list. During deployment, the code for this stage is only generated if the condition is satisfied — that is, the application property is True or False (according to which radio button is selected). For example, you can specify that code for an M3-specific stage is only generated if the M3 Connector is enabled. This field is set to <always> by default.
-
Call at runtime: You can, optionally, specify whether or not to execute a particular stage at runtime by selecting a parameter to evaluate in the drop-down list. The drop-down list includes all the boolean input parameters of a business object's method. The selected parameter is evaluated at runtime. The stage is executed if the value of the parameter is True. A False value skips the exectuion of the stage. This field is set to <always> by default.
-
Comment: This area is for your own use; it is not used anywhere else. Use it to keep notes and other comments relevant for the current stage.
This table describes the stage types.
Stage type | Available for | Description |
---|---|---|
Find | SQL Connector Stage | The stage will execute a standard database search. |
Insert | SQL Connector Stage | The stage will create a new record in the database. |
Update | SQL Connector Stage | The stage will update an existing record in the database. |
Delete | SQL Connector Stage | The stage will update an existing record in the database. |
Count | SQL Connector Stage | The stage will retrieve the total number of business object entries matching the search and filtering criteria used for normal search stages. The count will be returned as the resultset parameter "TotalSearchCount". |
Iterator |
|
The stage will make multiple stored-procedure calls using each of several input values. This might be used, for example, to fetch the price of each of several items currently found in the result set (as fetched by a previous stage). This type does not support stored procedures that return a result table. |
Procedure |
|
The stage will make a single call to a stored procedure. This type is able to accept result tables returned by the stored procedure |
Custom |
|
The stage is a custom stage for which the "type" setting is not otherwise used. |
Positioning stages in the pipeline
Because each stage usually modifies the content of the pipeline result set and/or the data in the data source, the order in which they execute is important when you have more than one stage in a pipeline. To arrange the stages in the pipeline, right-click on the stage you wish to move and then select the up or down arrow from the context menu.