Java-Based Resource Providers
Resource providers defined using Java classes extends the com.ptc.resource.ResourceProvider class or one of its subclasses and overrides the following methods to support CRUD operations:
  • createResources
  • updateResources
  • deleteResources
  • findResources
  • findResource
If the data source is to be treated as read-only, then the resource provider can reject attempts to modify its resources. It is expected, however, that the findResource and findResources are both fully implemented. This includes fully supporting all parameters of findResources, and full support for $skip and $top entries in the "extraParams" parameter and for the "query" parameter (to support result filtering and sorting). It is also expected that resource providers gracefully ignore fields requested through their services' "dataShape" or "dataShapeName" parameters that the resource does not actually have.
Note that the com.ptc.resource.ResourceProvider class provides a utility method to convert the JSON representation of a query to a com.thingworx.types.data.queries.Query object as needed:
```java

    protected Query createQuery(JSONObject queryJson, DataShapeDefinition dataShape) throws Exception

``
This is useful when overriding findResources(), depending on the resource providers needs. For more information, see the Javadoc for createQuery.