Unlike static resource operations such as UPDATE or DELETE, tool-defined resource operations can be dynamically returned by a tool. There are only two reasons for using a tool-defined resource operation instead of a static one:
The resource operations to be processed by AWM are returned by the tool at run time by using specific syntax:
operation(refid,REFRESH,SELECT): properties
See the table below for more information.
Keyword | Description |
---|---|
operation * | The resource operation to be executed.
Valid values:
The values are equivalent to the static resource operations INSERT, INSERT-CHILD, REMOVE and UPDATE. |
refid [O] | A reference ID, which is a logical name that creates a separate context that can be accessed by other tools within the action.
Properties returned by this resource operation are stored in the separate context instead of the main context.
Any following tools of the action that have the reference ID modeled as Affected Resource Name (relationship Action has Tool) use that separate context. See Relationship: Action Has Tool for more information. |
REFRESH [O] | Determines whether to execute the "Get All Properties" action of the element. This action is executed directly after the tool that returned this resource operation. |
SELECT [O] | Selects the element in the view where the action was executed. Only relevant if the properties of the resource operation contain a valid element ID (combination of ID definition properties). See ID Definition for more information. |
properties | Depending on the resource operation, the following rules apply to tool output parameters:
Returned resource operation properties must be modeled as output parameters of the type ToolDefinedResourceOperation. |
Tool-defined resource operations can provide a logical name to create a separate, independent execution context to be used by subsequent tools. This context is called an Affected Resource Context and is only used by tools which refer to its logical name in the relationship Action has Tool . Exceptions to this are related save/close actions, see note below.
Scenarios can occur where the element of interest changes during an action. It is possible to create multiple affected resource contexts during an action.
An action “Create Test Case…” is executed on a program. Its first tool creates a test case element and returns an INSERT tool-defined resource operation with affected resource name TESTCASE and properties for the new test case element. The second tool opens the test case in an editor, using TESTCASE as the affected resource name (relationship Action has Tool). This is necessary, because both the program and the test case element have common properties, for example, path, name, and suffix. The edit tool requires the path, name, and suffix from the test case element, not from the program.