Modifying Provider Code for Flexible Object Mapping

Flexible object mapping allows you to specify new mappings between business objects in the source and destination applications. This feature gives you the added flexibility to design object mappings for specific use-case scenarios. To implement flexible object mappings:

However you will need to also ensure the provider is modified to handle and process the new object mappings.

Note: Using this method, new objects can now be supported in the provider without using the Convert step code to create the destination side objects.

Consider the following scenario of defining a Role (Sample provider) to Resource (Gateway and P6) mapping. When the flow is going from Sample to P6, no change is required . However, when a Role is created in Sample side based on a Resource in Gateway side, the following code change must be made in the updateXref method of the destination provider::

protected void updateXref(String sampleObjectName, String pdiObjectName, SaveStepContext context, PDIDocument data) throws XRefException {

List<PDIObject> objects = data.getObjects(sampleObjectName);

if ((objects != null) && !objects.isEmpty()) {

for (PDIObject obj: objects) {

String action = obj.getAttributeValue("action");

String executed = obj.getAttributeValue("executed");

if ("create".equals(action) || "create".equals(executed)) {

String oldKey = obj.getFieldValue("ElementId");

XRefItem xrefItem = context.getXRefItemByApp(sampleObjectName, oldKey);

if (xrefItem == null) {

String pdiValue = context.getPDIXRefValue(sampleObjectName, oldKey);

context.setAppXRefValueByPDI(pdiObjectName, pdiValue, sampleObjectName, obj.getAttributeValue("realElementId"));

} else {

context.setAppXRefValueByPDI(xrefItem.getPDIObjectName(), xrefItem.getValue(null), sampleObjectName, obj.getAttributeValue("realElementId"));

}

}

}

}

}

Result: The Gateway-side object name supplied to the call to context.setAppXRefValueByPDI now looks up from the cross reference item imported into Gateway instead of a static value.



Legal Notices | Your Privacy Rights
Copyright © 2013, 2021

Last Published Thursday, December 16, 2021