extends RepositoryViewImpl

IntegrationRepositoryView is an abstract class that provides some standard operations like applyOptions and getRange. For each type of remote system that you want to integrate with, you need to create an implementation of IntegrationRepositoryView specific for your remote system in order to provide the translation between the ATG Query format, and the format expected by the remote system. When a query is executed, the executeUncachedQuery method is called. That method looks like this:

public RepositoryItem[] executeUncachedQuery(Query pQuery, QueryOptions pOptions)
{
 // Step 1
 Object input = createQueryCommandInput(pQuery, pOptions);

 // Step 2
 RepositoryItem[] items = executeQueryCommand(input);

 // Step 3
 return applyOptions(items, pOptions);
}

The inputs to this method are a standard Query object and a standard QueryOptions object. The executeUncachedQuery method goes through the following steps:

Step 1
The first thing the view needs to do is translate the Query object into an object that is understandable by the remote system. This is the responsibility of your subclass of IntegrationRepositoryView and the only method that you must implement.

Step 2
This step is a call to the method defined in IntegrationRepositoryView that gets the correct Command according to your configuration and calls Command.execute with the provided query input.

Step 3
This step may not be necessary. If your remote system supports sorting and ranging (returning a subset of the items) then it will be more efficient for that information to be included in the command input. In that case this step can be skipped in the executeUncachedQuery and you should override the applyOptions method to do nothing.

The only thing required for querying to work is to subclass IntegrationRepositoryView and implement createQueryCommandInput. The implementation of this method will introspect the Query class and create an input object. The type and contents of the input object depend on the requirements of your application and the remote system you are querying. You then need to create a Command that knows what to do with this input.

In addition, you will typically need to implement a processResults method in your IntegrationRepositoryView subclass. This method is responsible for translating between the remote data format and the repository items in the local repository.

The default implementation of IntegrationRepositoryView.processResults calls IntegrationRepositoryTools.createRepositoryItems. It passes in the results from pCommandResult.getResults() as the first argument. The createRepositoryItems method uses DynamicBeans to look at the given command results. For each object in the result it uses the IntegrationRepositoryItemDescriptor to find the external ID. It uses this external ID to look for an existing item in the local repository with the same external ID. If one is found, this method iterates across the properties in the result object (using DynamicBeans) and updates the properties. If one is not found, a new item is first created, then the properties are updated.

 
loading table of contents...