Methods and Workflow

This chapter describes options that you can use to create automated actions in your application, outlines the primary configuration options, and summarizes the available tools.

This chapter covers the following topics:

Introduction

Demantra provides two closely related options that you can use to create automated actions in your application:

These two options are closely related because most methods actually include a workflow.

Methods

Each method is associated with a specific level. Also, a method can be available in all worksheets or in a single specific worksheet.

Demantra provides a set of default methods that you can redefine or disable as needed. When you create a level, Demantra automatically creates the following default methods for it:

You can customize, disable, or delete these methods. You can add other methods as needed.

Method Security

Within the Demantra Local Application Administrator, you can specify user access to all methods (as well as to all menu bar items). See “Specifying Permissions for Menu Items”.

Workflows

In Demantra, a workflow is a logically connected set of steps. Each step can be automated or can require interaction from one or more users or groups. Demantra provides a set of workflow steps, each with predefined behavior.

A workflow is associated with one component, the component to which its creator belongs. A workflow can include any users of the component, as well as any groups (groups can be defined across multiple components).

Caution: Access to the Workflow Manager, including the ability to add and edit a workflow, should only be provided to key users. Workflows are used to drive many administrative flows and critical behind-the-scene processes, including data loading, purging, and execution of the analytical engine.

Overview of Method Types

To execute a method, the user right-clicks a level member in a worksheet (or in a Members Browser content pane) and then selects the method name from the menu. The behavior after that depends on the type of method.

Method Types

Demantra provides the following method types:

Constructor Prompts the user for values of the attributes of the new member and then adds the member in the database.
Destructor Removes the member from the database.
Edit Prompts the user for new values of the attributes for this member and then saves the changes.
View Displays the values of the attributes for this member.
Custom Optionally prompts the user for new values of the attributes for this member and then runs a workflow.
Open Opens the default worksheet, filtered to the selected member. You specify a default worksheet when defining the method.
Open With Similar to Open, but enables the user to select from a list of available worksheets.
Copy Copies the selected member to the clipboard. Valid only for promotional levels.
Paste Pastes the member that was last copied to the clipboard. Before pasting, the user can modify the dates of the promotion or choose to derive them from the worksheet. This option is valid only for promotional levels.
Paste From Clipboard Enables the user to specify which member to paste from the clipboard. Before pasting, the user can modify the dates of the promotion or choose to derive them from the worksheet. This option is valid only for promotional levels.
Add Note Add a comment or additional information about the selected member.

Constructor, Destructor, and Edit type methods can also run workflows. The workflow is run after the level member is created, removed, or edited.

Constructor, Edit, and Custom Methods

If the method type is Constructor, Edit, or Custom, the following occurs:

  1. Depending on how the method is configured, Demantra may save the worksheet data immediately.

  2. Demantra optionally displays a dialog box that prompts the user for values of attributes for this level member, as follows:

    the picture is described in the document text

    For a Custom type method, this dialog box includes an additional check box at the bottom. With this, the user can specify whether to save the attribute changes to the database.

    You can customize the following:

    • Text at the top of the dialog box

    • Attributes to list and the order in which to show them. The possible attributes include Name, each parent of this level, and any additional attributes. You can specify which attributes are required and which are editable. Required attributes are shown in red.

    • Label on the OK button (“Create” in this example).

  3. Demantra creates or edits the member as indicated, and saves the changes to the database.

  4. If the method includes a workflow schema, Demantra continues as follows:

    1. Demantra constructs the set of arguments to pass to the workflow in memory. Specifically, it constructs an array that consists of the following:

    2. Name-value pairs of the attributes of the member, using the values that the user provided.

      Note: Demantra does not necessarily pass all the attribute values to the method itself. For a custom method, you specify which attributes should be passed to the workflow.

    3. Additional name-value pairs that describe the context in which the method was invoked; see “Passing Arguments to a Method”.

    4. Demantra runs the associated workflow.

      Within the Business Modeler, the method configuration may include additional parameters that control how the method behaves. See “Passing Arguments to a Method”. If any of these parameters have the same name as the arguments that are passed to the method, the values that are passed in memory take precedence over the values in the method definition.

      For example, suppose the configuration for a given method includes a parameter called unit_cost and specifies the value for this parameter as 3.00. If the user invokes this method and specifies unit_cost as 3.50, then the value of 3.50 is saved in the database and is used in the method execution. On the other hand, if the user does not specify a value for unit_cost, the value of 3.00 is used in the method execution.

  5. Demantra optionally displays an output dialog box. The output dialog box is similar to the input dialog box, except that the attributes are not editable.

View Methods

If the method type is View, Oracle Demantra does the following:

  1. Oracle Demantra displays a dialog box that displays the values of attributes for this level member. This dialog box is a read-only version of the one shown in “Constructor, Edit, and Custom Methods”.

  2. When the user clicks OK, Oracle Demantra closes the dialog box.

Destructor Methods

If the method type is Destructor, Oracle Demantra does the following:

  1. If the method includes an associated workflow, Oracle Demantra invokes that workflow.

  2. It displays the standard deletion confirmation dialog box.

  3. When the user clicks OK, Oracle Demantra closes the dialog box and removes the member from the database.

Overview of Workflow Step Types

When you create or edit a workflow schema, the Workflow Manager displays a list of the available kinds of steps:

This section provides a brief overview of all the kinds of available steps, grouped into rough categories. Some kinds of steps fall into multiple categories.

Synchronous and Asynchronous Workflows

By default, Demantra workflows operate synchronously – that is, they wait for one step to complete before proceeding to the next step in the workflow. Synchronous communication works well for most types of Demantra workflow steps, although there are some cases where Asynchronous workflows are better suited. In asynchronous mode, workflow steps are not required to wait for the previous step to complete before executing. For example, workflow steps that notify users are best run asynchronously, so that workflows do not remain idle while waiting for user input.

Asynchronous support is provided for the following types of workflow steps:

For more information on how these workflow steps operate in asynchronous mode, see “Workflow Steps”.

Responding to External Events

A common use of workflows is to wait for specific conditions or external events and then launch actions. For example, a workflow could wait for a file to be updated and then import data into Demantra.

The primary tool here is the Wait Until Step, which pauses the workflow until a specific condition is met, possibly from a set of allowed conditions. When the condition is true, the Workflow Engine continues with the next step in the workflow. In this step, the Workflow Engine can look for a specific file and wait until the file is created, or is modified, or reaches a certain size. Or the Workflow Engine can execute an SQL query repeatedly until it returns a new value (for example, when a price changes). You control the frequency of testing, as well as the time-out period and other timing properties.

The Workflow Engine can also respond to user interaction. Several steps (User Step, Group Step, and Exception Step) send tasks to users and then wait until those users either mark the tasks as done or until the task times out. If the task times out, the workflow can continue with an alternative step.

Finally, the Workflow Manager itself can be used to schedule workflows.

Sending Tasks and Email

Some steps send tasks to users or groups; these tasks appear in the My Tasks module for those users, within Demantra Local Application. A typical task is a request to examine a worksheet, make a decision, and possibly edit data. A task can also include a link to a Web page for more information. A task can be accompanied by email. Also, a workflow step can simply send email.

The following kinds of workflow steps support tasks and email:

Integration

The Transfer Step initiates transfer procedures for the import and export of data. This kind of step is associated with an integration interface, as defined within the Business Modeler.

Managing Demantra Objects

The following workflow steps should be used only as methods. Each of them uses arguments that are available when a user launches a method from a level member or a Members Browser:

Other Demantra Actions

The following specialized workflow steps perform actions that are specific to Demantra needs:

Logic

The following kinds of steps support programming logic within the workflow:

External Functions

Finally, other kinds of steps call external functions:

Typical Step Properties

This section provides an overview of the properties of a typical step.

Connection Handles

Each step has connection handles that you use to connect it to other steps.

Common Properties

When you add a step to a workflow, the Workflow Editor displays a popup page where you can specify properties for that step. Common properties include the following; not all steps have all these properties.

Passing Arguments to a Method

Demantra can pass arguments in memory to the method. Considered as a group, these arguments are the context dictionary. For each argument, Demantra passes a variable name and its associated value.

Available Arguments

The available arguments fall into three general categories:

The following table lists the possible variables.

Category Variable* Value Data Type
System ws_id Identifier of the worksheet from which the method was launched. Java.util.String
System worksheet_filter The filter population of the worksheet from which the method was launched. Represented as a list of pairs of level_id and member_id. java.util.String level_id,member_id;
pairs separated by comas and semicolons.
System view_name The name of the active view from which the method was called. java.util.String
Member level_id Identifier of the level from which the method was launched. java.util.String
Member member_id Identifier of the member from which the method was launched. java.util.String
Member Combination_path The context of the selected member for the method. Will be represented as a list of pairs of level_id and member_id. java.util.String level_id,member_id
Member population.filters
(example)
Applies only to promotion levels. The population attribute of the selected member. The name of this variable is based on the name of the population attribute as follows:
population_attribute_name.filters
Array of com.demantra.applicationServer.metaDataObjects.level.levelFilters.LevelFilterGetters
Member population.from_date
(example)
Applies only to promotion levels. The from_date attribute of the selected member. The name of this variable is based on the name of the population attribute as follows:
population_attribute_name.from_date
java.util.Date
Member population.to_date
(example)
Applies only to promotion levels. The to_date attribute of the selected member. The name of this variable is based on the name of the population attribute as follows:
population_attribute_name.to_date
java.util.Date
Inputs Attribute_column_name Values of the attributes of the selected member that are specified as inputs to the method (all attributes on the Select Input Arguments screen). The name of each variable is the same as the name of the column in which the attribute is stored. java.util.Object

Passing Arguments

In order to pass arguments to the method, you must explicitly configure the variables that each workflow step should receive. To do so, you type the parameter names on the Parameters list for that step; see “Properties Used as Arguments for a Method”.

Note: The parameter names are case-sensitive.

For the input variables, you also specify which variables to pass when you configure the method. Specifically you select the desired attributes on the Select Input Arguments screen.

Properties Used as Arguments for a Method

When you configure a workflow as a method, Demantra can pass arguments in memory to the method. Considered as a group, these arguments are the context dictionary. For each argument, Demantra passes a variable name and its associated value.

In order to make these arguments available to a workflow step, you must explicitly configure the variables that each workflow step should receive. To do so, you type each variable name in the Name column of the Parameters list for that step, as follows:

the picture is described in the document text

In this example, the first two arguments are standard member variables, from the table in “Available Arguments”. These arguments can be used in any method.

The remaining three arguments are input variables; these variables refer to attributes of the member. Specifically these are the names of the columns in which these attributes are stored (Product Family, Brand, and Name).

Note: In the Parameters list:

Workflow Schema Examples

Workflows are very often used to import data. In the process of importing data, it is often necessary to perform various kinds of integrity checking and data cleanup, which you do within database procedures. As a consequence, many workflow schemas include the Stored Procedure Step in addition to the Transfer Step.

Example 1

the picture is described in the document text

Example 2

the picture is described in the document text

Example 3

the picture is described in the document text

Workflow Recovery

There may be an occasion when a workflow fails and requires recovery. The primary reasons for this happening are:

Failure in a specific workflow step is typically resolved by correcting an underlying issue with the step itself. A failure by the Application Server can result from a variety of sources that are outside of Demantra's control. When the application server fails and is restarted any workflows which have not completed can be restarted. The Recovery setting of the workflow step that was executing when the application server failed determines the action taken as follows:

Specifying the Workflow Step from which you want to Recover

You can specify a recovery step that the workflow will try to execute if the current step fails. If no Recovery Step is specified then the workflow will retry to execute the current step.

  1. From the Workflow Editor, open a workflow.

  2. For each workflow step for which you want to set a recovery step:

    • Open the workflow step.

    • From the Recovery drop-down list box choose Restart at Recovery Step.

    • From the Recovery Step drop-down list box, choose the step where you want to restart if this step fails.

Skipping a Workflow Step During Recovery

When a workflow is run in recovery mode it may make sense to skip one or more of the remaining workflow steps. This may be due to time constraints for long running processes which are not critical or the fact that precursor steps needed for this step to be valid did not complete. Each workflow step has a Skip During Recovery check box. Enable this check box to have the workflow skip the current step during recovery.

Configuration Notes

This section contains configuration notes related to methods, workflows, and automation in general

Dependencies

Before you can configure a workflow, you may need to define the following elements that it might use:

Before you create a method, you may need to define the following elements that it might use:

Design Considerations

Before you begin creating a workflow schema, you should have a clear idea of the intended purpose, flow, and users of the schema. Also, you should consider the following issues:

Tools

Demantra provides the following tools for creating and configuring methods and workflows:

Tool Purpose/Notes
Configure > Method option in the Business Modeler Defines methods.
Workflow Manager Defines workflows.