Examples: Windchill Customization Using WRS
This section provides several customization examples using WRSCaller.
Workflow Routing
This example showcases how to use WRSCaller in workflows to create conditional routes. In this example, a workflow task will be created if the system contains the GOLF CART demo dataset:
1. Load this sample workflow template:.
WT_HOME/prog_examples/WRSCallerExamples/loadFiles/customization/wrscaller/WRSCaller_example_WFtemplate.xml -u wcadmin -p wcadmin
2. To initiate the workflow process, go to > > . Right click WRSCaller example process, and then click Initiate workflow process.
3. Click Start Process.
This creates a new workflow task Check Golf Cart data.
Table Builder
In this example, WRSCaller is used in a custom TableBuilder to fetch the Golf Cart data and populate the table. It demonstrates how to parse the response, use the $skiptoken, and get the next page’s data.
The source file for the Table Builder is available in:
WT_HOME/prog_examples/WRSCallerExamples/src/com/acme/odata/customizationExamples/wrscaller/mvc/builders/WRSCallerGETExampleTableBuilder.java.
Refer to the
Getting Started with Windchill+ Tailoring section to learn how to deploy this customization.
Once deployed, the custom table is available at the following URL:
<hostname>/Windchill/app/#ptc1/comp/customization.example.wrs.table.getRequest
Actions
There are two different custom UI actions examples that use WRSCaller:
• WRS Update Description
• WRS Update Description (batch)
All these actions are defined in WTDocument. Once deployed, to test them, you must have a WTDocument with the secondary content (file attachments).
The source code for the action configuration (action models) is available in the XML files in WT_HOME/prog_examples/WRSCallerExamples/config/actions, and the action registration is available in WT_HOME/prog_examples/WRSCallerExamples/wrsCallerCustomizationExamples-wt.properties.xconf.
Refer to the
Getting Started with Windchill+ Tailoring section to learn how to deploy this customization.
Example #1: Update the Document Description
This example shows a PATCH operation made via WRSCaller.
On a Document’s working copy, this custom UI action makes a PATCH request to WRS using the current document OID to update its description attribute. If the document is not checked out, the action handles the HTTP error code and returns the error message to the user.
The source code for this customization example is available at:
WT_HOME/prog_examples/WRSCallerExamples/src/com/acme/odata/customizationExamples/wrscaller/forms/WRSCallerUpdateCommand.java
Example #2: Update Description $batch
This example shows how to make a batch request with WRSCaller.
This custom UI action makes a batch request to check out the current document, to update document’s description attribute, and check the document back in.
The source code for this customization example is available at:
WT_HOME/prog_examples/WRSCallerExamples/src/com/acme/odata/customizationExamples/wrscaller/forms/WRSCallerBatchCommand.java