Skip to content

Commit

Permalink
Workaround for MVEL issue
Browse files Browse the repository at this point in the history
  • Loading branch information
krisv committed May 7, 2011
1 parent ea8f4ad commit 23339ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -64,8 +65,8 @@
import org.jbpm.task.query.DeadlineSummary;
import org.jbpm.task.query.TaskSummary;
import org.mvel2.MVEL;
import org.mvel2.ParserConfiguration;
import org.mvel2.ParserContext;
import org.mvel2.compiler.ExpressionCompiler;

public class TaskService {
EntityManagerFactory emf;
Expand Down Expand Up @@ -269,16 +270,17 @@ public static Map<String, Class> getInputs() {

public Object eval(String str,
Map vars) {
ExpressionCompiler compiler = new ExpressionCompiler(str.trim());

ParserContext context = new ParserContext();
context.addPackageImport("org.jbpm.task");
context.addPackageImport("org.jbpm.task.service");
context.addPackageImport("org.jbpm.task.query");
context.addPackageImport("java.util");

return MVEL.executeExpression(compiler.compile(context),
vars);
ParserConfiguration pconf = new ParserConfiguration();
pconf.addPackageImport("org.jbpm.task");
pconf.addPackageImport("org.jbpm.task.service");
pconf.addPackageImport("org.jbpm.task.query");
pconf.addPackageImport("java.util");
for(String entry : getInputs().keySet()){
pconf.addImport(entry, getInputs().get(entry));
}
ParserContext context = new ParserContext(pconf);
Serializable s = MVEL.compileExpression(str.trim(), context);
return MVEL.executeExpression(s, vars);
}

public static class ScheduledTaskDeadline
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
Expand Down

0 comments on commit 23339ee

Please sign in to comment.