Example: Salesforce Resource Provider
TWX_Converge_Salesforce_ResourceProviders_ExtensionPackage exposes data from Salesforce systems as resources based on theThingWorx Utilities ontology. It provides a generic Salesforce resource provider for exposing any Salesforce object type as aThingWorx Utilities resource. This can be done using the om.ptc.twx.resource.sf.SalesforceResourceProvider Java class and the PTC.Resource.SalesforceResourceProviderTemplate thing template. This extension also provides specific extensions of the generic resource provider to address specific Salesforce objects and maps them into theThingWorx Utilities ontology.
These specific extensions are provided using additional thing templates backed by subclasses of com.ptc.twx.resource.sf.SalesforceResourceProvider. The extensions are provided as an example of this approach that is used to attain default configuration in a thing template. However, you can create a resource provider thing directly from PTC.Resource.SalesforceResourceProviderTemplate using the ThingWorx Composer to configure the required SalesforceObjectType configuration setting and otherwise configuring the Things as needed.
Services
TWX_Converge_Salesforce_ResourceProviders_ExtensionPackage provides implementations for the CRUD operations required by TWX_Converge_Core_ExtensionPackage.
Mappings
The following mappings are provided by the extension:
  • Object Types
    ThingWorx Utilities
    Salesforce
    Customer
    Account
  • Field Names
ThingWorx Utilities
Salesforce
CreateTimeStamp
CreatedDate
Number
AccountNumber
Picture
PhotoURL
ShippingLocation
ShippingAddress
BillingLocation
BillingAddress
Extension Dependencies
  • TWX_Converge_Core_ExtensionPackage— Because the TWX_Converge_Salesforce_ResourceProviders_ExtensionPackage is built on top of the TWX_Converge_Core_ExtensionPackage, the extension will not import unless the TWX_Converge_Core_ExtensionPackage exists.
  • TWX_Salesforce_Connector_ExtensionPackage— TWX_Converge_Salesforce_ResourceProviders_ExtensionPackage uses the TWX_Salesforce_Connector_ExtensionPackage to perform CRUD operations in the Salesforce system.
Best Practices for Developing Resource Provider Extensions
This section describes the components required to create a custom resource provider extension.
  • A class for each resource type in the external system that needs additional default mappings. For an example, see SaleforceCustomerResourceProvider.
  • Each resource provider class should extend ResourceProvider or a subclass—usually JavaBasedResourceProvider.