Skip to content

Commit

Permalink
TEIIDDES-1612: Fixes accumulation of inputs in transformation
Browse files Browse the repository at this point in the history
* AttributeMappingHelper
 * The element collector visitor implementations store the returned
   elements in a field. As a consequence, using the visitor in a loop means
   the previously found elements are also returned with newly found
   elements.
 * Creates a new instance of the visitor each time it is required to
   avoiding erroneous caching of elements.
  • Loading branch information
Paul Richardson committed Mar 7, 2013
1 parent bea4bf7 commit e1d4e43
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public static boolean updateAttributeMappings(Object transMappingRoot, Object tx
List attrs = TransformationHelper.getTransformationTargetAttributes((EObject)transMappingRoot);

IQueryService queryService = ModelerCore.getTeiidQueryService();
IElementCollectorVisitor elementCollectorVisitor = queryService.getElementCollectorVisitor(true);

// Iterate attributes, setting each mapping
Iterator iter = attrs.iterator();
Expand All @@ -106,7 +105,13 @@ public static boolean updateAttributeMappings(Object transMappingRoot, Object tx
// Find element matching the attribute name (if it exists)
IExpression seSymbol = getSymbolWithName(projectedSymbols,colName);
if(seSymbol!=null) {
/**
* Note as per TEIIDDES-1612, the elementCollectorVisitor implementations stores
* the found elements in a field so reuse of an existing instance must be avoided
* when using a loop.
*/
// Get the ElementSymbols / corresponding EObjs
IElementCollectorVisitor elementCollectorVisitor = queryService.getElementCollectorVisitor(true);
Collection elemSymbols = elementCollectorVisitor.findElements(seSymbol);
Collection<EObject> elemEObjs = TransformationSqlHelper.getElementSymbolEObjects(elemSymbols,command);
// Set Elem EObjs as inputs for attr Mapping
Expand Down

0 comments on commit e1d4e43

Please sign in to comment.