Flow Sequence When Using the Compare Step

A flow that supports a Compare step loads the project from both sides, determines the delta between each side, and uses only the difference to synchronize the data during the final update.

Note: The Compare step is used in the Import Project Data flow and the Export Project Data flows. The Import Master Data and the Export Master Data flows do not support the Compare step.

Unlike the normal flow that consists of four steps (load, convert to Gateway, convert from Gateway, and Update Destination), a flow that supports the Compare step includes the following additional steps:

The Compare step is supported by the Gateway framework code; providers do not have to implement it. Providers will need to implement the extra load and convert steps as these must be implemented by the the provider of the destination application. The destination provider must ask for the key of the project that is being loaded to the source side of the implementation when supporting the compare functionality.

Source Provider

For the Import Project Data flow, the source provider needs to communicate to the destination side which project it is loading when the Primavera Gateway loads the initial project data from the source side. To do that, the source provider needs to implement the getProjectKeyForCompare method in the FlowProvider interface.

Normally, a provider will determine which project it is to load from the filter or the parameters that users set in the Gateway user interface. The implementation of the method needs to return a Gateway side value of this project key.

The following is a sample code snippet from the Import Project Data flow in SampleProvider.java:

@Override

public Map<String, String> getProjectKeyForCompare(String flowType, FlowContext context) throws ProviderException {

SampleFlowType type = getFlowType(flowType);

switch (type) {

case SyncProjectImport:

String sampleProjectKey = (String) context.getParameter("ImportProjectId");

if (StringUtils.isEmpty(sampleProjectKey)) {

return null;

} else {

Map<String, String> keyMap = new HashMap<String, String>();

keyMap.put("ObjectId", context.getXRefValueByGuest("Project", sampleProjectKey));

keyMap.put("Id", sampleProjectKey);

return keyMap;

}

default:

throw new UnsupportedOperationException("Compare not supported.");

}

}

Destination Provider

For the Export Project Data flow, Primavera Gateway loads the initial project data from the source side. The destination provider needs to ask for the project key so that it can load the same project.

The LoadStepContext interface has two methods for this use case:

The following is a code snippet from the Export Project Data flow in ProjectLoadStep of the Sample provider:

if (context.isLoadStepForCompare()) {

Map<String, String> projectKeys = context.getProjectKeyForCompare();

String projectId = null;

if (projectKeys != null) {

String objectId = projectKeys.get("ObjectId");

if (StringUtils.isEmpty(objectId)) {

projectId = projectKeys.get("Id");

} else {

projectId = objectId;

}

}

if ((projectId == null) || projectId.isEmpty()) {

return new PDIDocumentImpl();

} else {

return getOneProject(projectId, context);

}

}

Related Topics

Define the Flow Steps in a Flow

Flow Sequence When Importing Master Data

Flow Sequence When Importing Project Data

Flow Sequence When Exporting Project Data

Flow Sequence When Exporting Master Data

Flow Sequence When Using Master Data

Flow Sequence When Using Project Data



Legal Notices
Copyright © 2013, 2015, Oracle and/or its affiliates. All rights reserved.

Last Published Wednesday, March 25, 2015