Examples of Custom Objects

The following examples show you how to test specific situations; you can combine these custom objects with actions in a rule, to take appropriate action:

 

Example: Using custom objects in custom action and custom rule

The following example shows you how to use the Axeda® Connected Product Management Applications SDK to create an Action and then use the two custom objects in a custom action and custom rule: Custom Object Example: Creating a custom rule with two of the example custom objects

Examples: IDM agents, IDM Agent WS Extension

For examples of custom objects you may want to use with Axeda IDM Agents, refer to the topic, Custom Object Examples - IDM Agent. For an example of using the IDM Agent WS Extension type of custom object, refer to Example Custom Object of Type IDM Web Service Extension. For an example of using a custom object to create a property called Communication Mode and set its value for an IDM Agent, refer to Custom Object Example: Creating a Communication Mode Property for IDM Agents.

Example: Transport for the Shoulder Tap Delivery method

For an example of using a custom object as the Transport for the Shoulder Tap Delivery method, refer to Custom Object Example: Transport for Shoulder Tap Delivery Method.

Example: Custom object for Extended UI Module

By default, the Platform passes two parameters to all custom objects or custom applications defined in Extended UI Modules: “assetId” (to identify the related asset) and “extModuleId” (to identify this extended UI module).

If creating a custom object for display in an Extended UI Module (Extended UI Module type), you MUST specify the assetId parameter and configure that parameter for access. The following shows an example of a custom object configured to retrieve the assetID for the related asset (from the Asset dashboard):

import com.axeda.drm.sdk.*;

import com.axeda.drm.sdk.user.*;

 

StringBuilder builder = new StringBuilder();

builder.append('<html>')

builder.append('<body>')

builder.append('<a href="http://www.axeda.com" target="_blank">Visit Axeda</a>')

builder.append(parameters.get("assetId"));

builder.append('</body>')

builder.append('</html>')

 

return ['Content-Type': 'text/html', 'Content': builder.toString()]

Important: If you want to show a custom object in an Extended UI Module, the object MUST return actual, viewable content. If the custom object is not defined to render displayable data, the Extended UI Module will NOT be shown in the related Asset dashboards. In conjunction, if the selected object is deleted from the system or is NOT available to the logged in user, any Extended UI Module defined for that custom object is not shown in the related Asset dashboards.

Example: Custom object to send an email

The following example shows how you can send an email through the API: Custom Object Example: sending email through API

Example: Custom object to upload a file

The following example shows how you can upload a file through the API: Custom Object Example: sending email through API

 

More examples

The following examples show you how to use the logger object with each type of custom object to write information to a log: