Composite Attribute Workflows
You add composite attribute workflows to set up dependencies between the workflows of primitive attributes when the latter are added as members to a composite attribute. You can, for example, set up general transitions for the composite attribute workflow so that updating the value of one primitive attribute automatically sets the value for another attribute. A composite attribute workflow is also used to enable workflows for primitive attributes per-table-row of a composite attribute in Table mode. You apply a composite attribute workflow by adding the workflow to an asset type containing the workflow’s composite attribute.
For a composite attribute in Simple mode, the workflow state is given by the aggregation of the member attributes’ values and workflow transitions involve updating these values. For a composite attribute in Table mode, each table row is associated with its own workflow state. Workflow transitions involve adding, updating, or removing a table row. You can define any number of workflows for a specific composite attribute.
The Composite Attribute Workflows page, opened by clicking Composite Workflows in the Database navigation sidebar, shows a table with all composite attribute workflows in the database. The table columns are:
The Label column — the label of the composite attribute workflow.
The Description column — the optional description of the composite attribute workflow.
Click on the label of a composite attribute workflow in the table to show more details for that composite attribute workflow. Click the Add button to add a new composite attribute workflow.
Adding Composite Attribute Workflows
To add a new composite attribute workflow:
1
Workflows can be defined for composite attributes in both Simple mode and Table mode.
2
3
Click Continue to continue to the next page.
The Add Composite Attribute Workflow page shows the composite attribute and the workflow label provided on the previous page in the Attribute and Label fields, respectively.
4
A composite attribute workflow contains lists of Member Workflows, State Conditions, Transitions, Activities, and Permissions. A list can be left empty. Click Save to add the new composite attribute workflow once you are finished setting these lists up.
To apply the composite attribute workflow to your assets, you must also add the workflow as a member workflow to an asset type — see Using Workflows with Asset Types.
Member Workflows
To enable a workflow for a primitive attribute found inside a composite attribute, you must first add it to a composite attribute workflow as a member. To add a member workflow, select a primitive attribute workflow from the Add workflow list under the Member workflows table. Only workflows for primitive attributes that are members of the composite attribute are available for selection. Multiple member workflows may be added for the same attribute. You can rearrange the member workflows using drag and drop — see also Rearranging Table Rows. The top-to-bottom sort order reflects the order in which the workflows are evaluated when saving an asset.
You introduce default values for new table rows of a composite attribute in Table mode by defining a workflow for the composite attribute that has member workflows with State value conditions set as default state conditions. The workflow must also be added to relevant asset types.
State Conditions
State conditions for composite attribute workflows are defined similar to those of Primitive Attribute Workflows. A state condition for a composite attribute in Table mode is satisfied if it is satisfied for at least one table row. Composite attribute workflows support state conditions of type State expression and the built-in state conditions listed in Table 3-9. State values are not supported.
To add a state condition to the workflow:
1
2
For a State expression, write its label and optional description in the Label and Description field, respectively.
3
For a State expression, specify the expression statement in the Expression field. You write the statement by combining primitive attribute field expressions for the member attributes using boolean AND and OR operators, NOT and ANY operators, and by grouping them with parentheses. Unlike a primitive attribute workflow, you do not include the attribute identifier of the composite attribute itself in the expression. As an example,
@<member-attribute-identifier-1>:<state-value-expression-1> OR
@<
member-attribute-identifier-2>:<state-value-expression-2>
Only member attributes of value type Boolean, Integer, Keyword, Keyword array, User, and User array can be used in a state expression.
For a composite attribute in Simple mode, the state conditions apply on the aggregated values of the member attributes. For a composite attribute in Table mode, the state conditions apply on a per-table-row basis.
See Adding Primitive Attribute Workflows for how to write the primitive attribute field expressions themselves.
Table 3-9: All available state conditions of built-in type for a composite attribute workflow..
A condition that is always satisfied. Combines the Any state value and No state value built-in state conditions.
For a composite attribute in Simple mode, a state condition that is satisfied if at least one member attribute has a non-empty value. For the table row of a composite attribute in Table mode, a condition that is satisfied if at least one table cell in the row has a non-empty value.
For a composite attribute in Simple mode, a state condition that is satisfied if all member attributes have an empty value. For the table row of a composite attribute in Table mode, a condition that is satisfied if all table cells in the row have an empty value.
A state condition of type Never is primarily useful to temporarily disable a transition by adding it as a from-state condition or as a to-state condition. The No state value condition may also be used to match updates to a table that involves adding or removing table rows.
Transitions
As for Primitive Attribute Workflows, transitions for a composite attribute workflow correspond to changes made to the attribute values of the composite attribute when saving an asset. For the from-state and to- state conditions, you can use any state condition belonging to the composite attribute workflow itself, as well as any state condition from a member workflow. Action transitions are not supported for a composite attribute workflow.
A transition for a composite attribute workflow is enabled before saving an asset if the following criteria are fulfilled:
An enabled transition for a composite attribute workflow has fired after saving an asset if the following criteria are fulfilled:
A transition that is enabled when adding a table row has from-state conditions that match a “default” table row populated with the values corresponding to the default state conditions of member workflows. If no member workflow has default state conditions, a No state value condition from the composite attribute workflow itself is enough as a from-state condition. Otherwise, at least one default state condition from a member workflow must be used. An Any state value condition can be used as a to-state condition for the transition. If the composite attribute has a primary member, you can also use the state expression conditions
NOT @<primary-identifier>:ANY and @<primary-identifier>:ANY as an alternative from-state and to-state condition, respectively. Finally, if you define a workflow for the primary member and add it as a member workflow, you can use No state value and Any state value conditions from the member workflow as from-state and to-state condition, respectively.
A transition that fires when removing a table row has to-state conditions that match an empty table row. A No state value condition from the composite attribute workflow itself is enough as a to-state condition. An Any state value condition can be used as a from-state condition for the transition to be enabled.
To add a transition to the workflow:
1
Click Add Transition.
2
Write the label of the transition in the Label field. Write an optional description in the Description field.
3
In the From and To field, select state conditions to add as from-state and to-state conditions for the transition, respectively.
You can select any number of state conditions belonging to the workflow itself and to its member workflows.
4
In the Permissions table for the transition, add users and groups that are granted permission to perform the transition. Leave the table empty to grant everyone permission.
In the Permissions with State Conditions table cell, next to the Perform transition permission type, add state conditions from the Add State Condition menu to conditionally grant the permission. The permission is granted to the user or group if at least one state condition is satisfied before saving the asset. The permission is always granted if the collection of state conditions is empty.
See also Permissions for changing the composite attribute value itself.
Activities
You can define activities for a transition that should run whenever the transition fires.
A perform transition activity consists of a collection of action transitions that will be fired by Model Manager server if they were enabled before saving the asset. Any number of action transitions belonging to member workflows of the composite attribute workflow can be added to the activity.
A transition cancellation activity associated with a transition consists of a collection of state conditions such that, if at least one condition in the collection is satisfied before the save, the save of an asset is canceled. A state condition can either belong to the composite attribute workflow itself or to one of its member workflows. The save is always canceled if the collection is empty.
To add an activity to a transition:
1
Select either Perform transition or Transition cancellation. in the Add Activity menu below a transition.
2
Write the label of the activity in the Label field. Write an optional description in the Description field.
3
For a Perform transition activity, select transitions from the Add Transition menu.
For a Transition cancellation activity, select state conditions from the Add State Condition menu.
Multiple activities of the same type run from top-to-bottom when the transition fires. Click the up and down arrow buttons to change their run order. Click the Delete button (trashcan) to remove an activity.
The state conditions of all transitions are evaluated before any Perform transition activities have been run. This prevents any cascading effects where running an activity inadvertently fires unrelated transitions.
The action transitions performed by Perform transition activities are not subject to any access control checks. Only access control for the fired transition, that the activities themselves belong to, is checked.
Permissions
As for primitive attribute workflows, you can grant permissions to users and groups that can update the attribute values of the composite attribute overall:
1
Add a user or group to the Permissions table at the bottom of the page.
2
In the Permissions with State Conditions table cell, next to the Change values permission type, add state conditions from the Add State Condition menu to conditionally grant the permission. A state condition can either belong to the composite attribute workflow itself or to one of its member workflows.
The Change values permission is granted to the user or group if at least one state condition is satisfied by the composite attribute values before saving the asset. The permission is always granted if the collection of state conditions is empty.
The Composite Attribute Workflow Page
The Composite Attribute Workflow page contains details on a composite attribute workflow in the database. The fields are:
Attribute. The composite attribute for the workflow.
Label. The label for the workflow.
Description. The optional description for the workflow.
Member workflows. The primitive attribute workflows that are members of the workflow.
State conditions. The list of state conditions for the workflow, with all State expression conditions shown first followed by all built-in state conditions. Hidden if the workflow does not have any state conditions.
Transitions. The list of transitions for the workflow, including their from-state condition, to-state conditions, activities, and granted permissions. Hidden if the workflow does not have any transitions.
Permissions. The list of granted permissions for changing the values of the composite attribute. Hidden if no permissions have been explicitly granted, which means that all users are allowed to change the values.
Click Edit to edit the composite attribute workflow.
Click Delete Permanently if you want to permanently delete the composite attribute workflow in the database. The workflow will be automatically removed from any asset type using it.
Examples of Workflows for Composite Attributes
This section lists a few applications of workflows for composite attributes. See also Examples of Workflows for Primitive Attributes.
Default Table Cell
Given a table cell that you want to initialize with a default value when adding a new table row, define a Free workflow for the corresponding primitive attribute with a default state condition. Add the primitive attribute workflow as a member workflow to a workflow of the composite attribute.
Required Table Cell
Given a table column that you want to ensure never has empty table cells, define a Missing value State expression for a composite attribute workflow with expression statement:
NOT @<attribute-identifier>:ANY
Define a transition for the workflow that fires when the value is cleared:
Label: Clearing value
From: Always
TO: Missing value
The from-state condition uses the Always built-in state condition. Finally, add a Transition cancellation activity without any state conditions to this transition. Its label could be Required value.
You cannot use a No state value condition belonging to a member workflow for the required table column as such a transition would not fire when adding a new table row (as the empty table cell would be considered unmodified).
Restricted Table
Given a table that only a restricted group of users should be able to add, update, or remove table rows of, define a workflow for the composite attribute with a Change values permission granted to that group.
Modeling Tasks
Add a Modeling Task primitive attribute with allowed values CAD, Physics, Simulation, and Results. Create a Process workflow for the primitive attribute that describes the allowed values as steps for building and solving a model using COMSOL Multiphysics together with other tools. Each allowed value is represented by a State value condition. An action transition is defined for each adjacent-pair of allowed values.
Add a composite attribute in Table mode with a Model version picker attribute as a primary member. Also add the Modeling Task primitive attribute as a member. Finally, add a workflow for the composite attribute with the step-workflow as a member workflow.
The composite attribute workflow can be used for a list of models that people from different teams are currently adding features to based on their domain of expertise (CAD geometries, physics setups, solvers, and so on). Different models in the list may be in different stages at any given time. The Asset page for an asset type containing the composite attribute and its workflow shows a transition button per-table-row for the next step of each model.