Skip to content

Commit

Permalink
Put ETL rules through exec controller (fixes #51)
Browse files Browse the repository at this point in the history
  • Loading branch information
agarciadom committed Sep 11, 2023
1 parent 1ec427e commit 300c42f
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.eclipse.epsilon.common.util.AstUtil;
import org.eclipse.epsilon.common.util.CollectionUtil;
import org.eclipse.epsilon.eol.dom.ExecutableBlock;
import org.eclipse.epsilon.eol.dom.IExecutableModuleElementParameter;
import org.eclipse.epsilon.eol.dom.Parameter;
import org.eclipse.epsilon.eol.exceptions.EolRuntimeException;
import org.eclipse.epsilon.eol.execute.context.IEolContext;
Expand All @@ -26,7 +27,7 @@
import org.eclipse.epsilon.etl.execute.context.IEtlContext;
import org.eclipse.epsilon.etl.parse.EtlParser;

public class TransformationRule extends ExtensibleNamedRule {
public class TransformationRule extends ExtensibleNamedRule implements IExecutableModuleElementParameter {

protected Parameter sourceParameter;
protected List<Parameter> targetParameters = new ArrayList<>(2);
Expand Down Expand Up @@ -211,7 +212,6 @@ public Collection<?> transform(Object source, IEtlContext context) throws EolRun
}

protected void executeSuperRulesAndBody(Object source, Collection<Object> targets_, IEtlContext context) throws EolRuntimeException {

List<Object> targets = CollectionUtil.asList(targets_);
// Execute super-rules
for (ExtensibleNamedRule rule : superRules) {
Expand All @@ -228,8 +228,8 @@ protected void executeSuperRulesAndBody(Object source, Collection<Object> target
Parameter tp = targetParameters.get(offset);
variables[i] = Variable.createReadOnlyVariable(tp.getName(), targets.get(offset));
}
body.execute(context, variables);

context.getExecutorFactory().execute(this, context, variables);
}

@Override
Expand Down Expand Up @@ -269,4 +269,13 @@ public void dispose() {
rejected = null;
transformedElements = null;
}


/**
* TEMPORARY: get Rules tab working again (think about better fix?)
*/
@Override
public Object execute(IEolContext context, Object variables) throws EolRuntimeException {
return body.execute(context, (Variable[]) variables);
}
}

0 comments on commit 300c42f

Please sign in to comment.