Chapter 61. Work item definitions
Red Hat Process Automation Manager requires a work item definition (WID) file to identify the data fields to show in Business Central and accept API calls. The WID file is a mapping between user interactions with Red Hat Process Automation Manager and the data that is passed to the work item handler. The WID file also handles the UI details such as the name of the custom task, the category it is displayed as on the palette in Business Central, the icon used to designate the custom task, and the work item handler the custom task will map to.
In Red Hat Process Automation Manager you can create a WID file in two ways:
-
Use a
@Wid
annotation when coding the work item handler. -
Create a
.wid
text file. For example,definitions-example.wid
.
61.1. @Wid Annotation
The @Wid
annotation is automatically created when you generate a work item handler project using the Maven archetype. You can also add the annotation manually.
@Wid Example
@Wid(widfile="MyWorkItemDefinitions.wid", name="MyWorkItemDefinitions", displayName="MyWorkItemDefinitions", icon="", defaultHandler="mvel: new com.redhat.MyWorkItemWorkItemHandler()", documentation = "myworkitem/index.html", parameters={ @WidParameter(name="SampleParam", required = true), @WidParameter(name="SampleParamTwo", required = true) }, results={ @WidResult(name="SampleResult") }, mavenDepends={ @WidMavenDepends(group="com.redhat", artifact="myworkitem", version="7.52.0.Final-example-00007") }, serviceInfo={ @WidService(category = "myworkitem", description = "${description}", keywords = "", action = @WidAction(title = "Sample Title"), authinfo = @WidAuth(required = true, params = {"SampleParam", "SampleParamTwo"}, paramsdescription = {"SampleParam", "SampleParamTwo"}, referencesite = "referenceSiteURL")) } )
Description | |
---|---|
| Top-level annotation to auto-generate WID files. |
| Name of the file that is automatically created for the custom task when it is deployed in Red Hat Process Automation Manager. |
| Name of the custom task, used internally. This name must be unique to custom tasks deployed in Red Hat Process Automation Manager. |
| Displayed name of the custom task. This name is displayed in the palette in Business Central. |
|
Path from |
| Description of the custom task. |
|
The work item handler Java class that is linked to the custom task. This entry is in the format |
| Path to an HTML file in the current project that contains a description of the custom task. |
|
Child annotation of
Note Due to the possibility of this name being used in API calls over transfer methods such as REST or SOAP, this name should not contain spaces or special characters.
|
|
Child annotation of
Note Due to the possibility of this name being used in API calls over transfer methods such as REST or SOAP, this name should not contain spaces or special characters. |
|
Child annotation of
|
|
Child annotation of
|
|
Object of
|
|
Object of
|
61.2. Text File
A global WorkDefinitions
WID text file is automatically generated by new projects when a business process is added. The WID text file is similar to the JSON format but is not a completely valid JSON file. You can open this file in Business Central. You can create additional WID files by selecting Add Asset > Work item definitions from an existing project.
Text file example
[ [ "name" : "MyWorkItemDefinitions", "displayName" : "MyWorkItemDefinitions", "category" : "", "description" : "", "defaultHandler" : "mvel: new com.redhat.MyWorkItemWorkItemHandler()", "documentation" : "myworkitem/index.html", "parameters" : [ "SampleParam" : new StringDataType(), "SampleParamTwo" : new StringDataType() ], "results" : [ "SampleResult" : new StringDataType() ], "mavenDependencies" : [ "com.redhat:myworkitem:7.52.0.Final-example-00007" ], "icon" : "" ] ]
The file is structured as a plain-text file using a JSON-like structure. The filename extension is .wid
.
Description | |
---|---|
| Name of the custom task, used internally. This name must be unique to custom tasks deployed in Red Hat Process Automation Manager. |
| Displayed name of the custom task. This name is displayed in the palette in Business Central. |
|
Path from |
| Name of a category within the Business Central palette under which this custom task is displayed. |
| Description of the custom task. |
|
The work item handler Java class that is linked to the custom task. This entry is in the format |
| Path to an HTML file in the current project that contains a description of the custom task. |
|
Specifies the values to be populated in the Business Central GUI or expected by API calls as data inputs for the custom task. Parameters use the |
|
Specifies the values to be populated in the Business Central GUI or expected by API calls as data outputs for the custom task. Results use the |
|
Optional: Specifies Maven dependencies required for the correct functioning of the work item handler. Dependencies can also be specified in the work item handler |
Red Hat Process Automation Manager tries to locate a .wid
file in two locations by default:
-
Within Business Central in the project’s top-level
global/
directory. This is the location of the defaultWorkDefinitions.wid
file that is created automatically when a project first adds a business process asset. -
Within Business Central in the project’s
src/main/resources/
directory. This is where WID files created within a project in Business Central will be placed. A WID file may be created at any level of a Java package, so a WID file created at a package location of<default>
will be created directly insidesrc/main/resources/
while a WID file created at a package location ofcom.redhat
will be created atsrc/main/resources/com/redhat/
Red Hat Process Automation Manager does not validate that the value for the defaultHandler
tag is executable or is a valid Java class. Specifying incorrect or invalid classes for this tag will return errors.