FlowElementPortDescription joinedPort = context.getOutputPort(SideDataJoin.ID_OUTPUT_JOINED);
FlowElementPortDescription missedPort = context.getOutputPort(SideDataJoin.ID_OUTPUT_MISSED);
DataObjectMirror resultCache = context.createModelCache(joinedPort.getDataType());
DataClass outputType = getEnvironment().getDataClasses().load(joinedPort.getDataType());
List<Statement> process = Lists.create();
process.add(resultCache.createReset());
Joined annotation = TypeUtil.erase(joinedPort.getDataType()).getAnnotation(Joined.class);
Set<String> saw = Sets.create();
for (Joined.Term term : annotation.terms()) {
DataClass inputType = getEnvironment().getDataClasses().load(term.source());
Expression input;
if (term.source().equals(context.getInputPort(SideDataJoin.ID_INPUT_TRANSACTION).getDataType())) {
input = context.getInput();
} else {
input = helper.getGetRawMasterExpression();
}
for (Joined.Mapping mapping : term.mappings()) {
if (saw.contains(mapping.destination())) {
continue;
}
saw.add(mapping.destination());
Property sourceProperty = inputType.findProperty(mapping.source());
Property destinationProperty = outputType.findProperty(mapping.destination());
process.add(destinationProperty.createSetter(
resultCache.get(),
sourceProperty.createGetter(input)));
}