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. To load this sample workflow template, in a Windchill shell, run the following:
windchill wt.load.LoadFromFile -d WT_HOME/prog_examples/WRSCallerExamples/loadFiles/customization/wrscaller/WRSCaller_example_WFtemplate.xml -u wcadmin -p wcadmin
2. To initiate the workflow process, go to Site > Utilities > Workflow Template Administration. 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.
This customization can be deployed by following the general Getting Started with Windchill Customization section.
Once deployed, the custom table is available at the following URL:
<hostname>/Windchill/app/#ptc1/comp/customization.example.wrs.table.getRequest
Actions
There are three different custom UI actions examples that use WRSCaller.
All of them are defined on WTDocument.
Once deployed, to test them, you must have a WTDocument with secondary content (file attachments).
The source code for the action configuration (action models) are 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.
These customizations can be deployed by following the general Getting Started with Windchill Customization section.
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
Example #3: Download the Zip File
This example showcases how to call an unbound action (POST request), with WRSCaller. It also illustrates how to deal with file downloads.
This custom UI action calls the unbound action DownloadContentAsZip to download all attachments of the current Document.
The source code for this customization example is available at:
WT_HOME/prog_examples/WRSCallerExamples/src/com/acme/odata/customizationExamples/wrscaller/forms/WRSCallerDownloadZipCommand.java
Was this helpful?