[jboss-svn-commits] JBL Code SVN: r17050 - in labs/jbossrules/trunk/drools-compiler/src: main/java/org/drools/rule/builder and 8 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Dec 5 18:59:31 EST 2007
Author: mark.proctor at jboss.com
Date: 2007-12-05 18:59:31 -0500 (Wed, 05 Dec 2007)
New Revision: 17050
Added:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ReturnValueDescr.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/Dialect.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel
labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java
Log:
JBRULES-1352 Allow Constraints to also use dialectable expression evaluations
-constraints now working end to end with dialects and rules and code; includes integration test.
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/Dialect.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/Dialect.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/Dialect.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -21,6 +21,7 @@
import org.drools.rule.builder.ProcessClassBuilder;
import org.drools.rule.builder.QueryBuilder;
import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.RuleClassBuilder;
import org.drools.rule.builder.RuleConditionBuilder;
@@ -65,6 +66,8 @@
ConsequenceBuilder getConsequenceBuilder();
ActionBuilder getActionBuilder();
+
+ ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder();
RuleClassBuilder getRuleClassBuilder();
@@ -88,7 +91,7 @@
void addRule(final RuleBuildContext context);
- void addAction(final ProcessBuildContext context);
+ void addProcess(final ProcessBuildContext context);
void addFunction(final FunctionDescr functionDescr,
TypeResolver typeResolver);
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -29,10 +29,12 @@
import org.drools.lang.descr.ActionDescr;
import org.drools.lang.descr.ProcessDescr;
import org.drools.rule.Package;
+import org.drools.rule.ReturnValueConstraint;
import org.drools.rule.builder.ProcessBuildContext;
import org.drools.ruleflow.common.core.Process;
import org.drools.ruleflow.core.ActionNode;
import org.drools.ruleflow.core.Connection;
+import org.drools.ruleflow.core.Constraint;
import org.drools.ruleflow.core.MilestoneNode;
import org.drools.ruleflow.core.Node;
import org.drools.ruleflow.core.RuleFlowProcess;
@@ -42,10 +44,12 @@
import org.drools.ruleflow.core.impl.ActionNodeImpl;
import org.drools.ruleflow.core.impl.ConstraintImpl;
import org.drools.ruleflow.core.impl.DroolsConsequenceAction;
+import org.drools.ruleflow.core.impl.ReturnValueConstraintEvaluator;
import org.drools.ruleflow.core.impl.RuleFlowConstraintEvaluator;
import org.drools.ruleflow.core.impl.RuleFlowProcessImpl;
import org.drools.ruleflow.core.impl.RuleFlowProcessValidatorImpl;
import org.drools.ruleflow.core.impl.SplitImpl;
+import org.drools.spi.ReturnValueEvaluator;
import com.thoughtworks.xstream.XStream;
@@ -113,34 +117,46 @@
ProcessDescr processDescr = new ProcessDescr();
processDescr.setClassName( rfp.getName() );
processDescr.setName( rfp.getPackageName() );
-
+
+ Dialect dialect = this.packageBuilder.getDialectRegistry().getDialect( "java" );
+
+ ProcessBuildContext context = new ProcessBuildContext( this.packageBuilder.getPackageBuilderConfiguration(),
+ this.packageBuilder.getPackage(),
+ process,
+ processDescr,
+ this.packageBuilder.getDialectRegistry(),
+ dialect );
+
for ( Node node : rfp.getNodes() ) {
if ( node instanceof ActionNode ) {
- buildAction(process, processDescr, (ActionNodeImpl) node );
+ buildAction(process, processDescr, context, (ActionNodeImpl) node );
} else if ( node instanceof SplitImpl ) {
+ buildSplit(process, processDescr, context, (SplitImpl) node );
}
- }
+ }
+
+ if ( !context.getErrors().isEmpty() ) {
+ this.errors.addAll( context.getErrors() );
+ }
+
+ for ( Iterator it = this.packageBuilder.getDialectRegistry().iterator(); it.hasNext(); ) {
+ dialect = ( Dialect ) it.next();
+ dialect.addProcess( context );
+ }
+
}
- public void buildAction(Process process, ProcessDescr processDescr, ActionNodeImpl actionNode) {
+ public void buildAction(Process process, ProcessDescr processDescr, ProcessBuildContext context, ActionNodeImpl actionNode) {
DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
ActionDescr actionDescr = new ActionDescr();
- actionDescr.setText( action.getConsequence() );
+ actionDescr.setText( action.getConsequence() );
- Dialect dialect = this.packageBuilder.getDialectRegistry().getDialect( action.getDialect() );
+ Dialect dialect = this.packageBuilder.getDialectRegistry().getDialect( action.getDialect() );
- ProcessBuildContext context = new ProcessBuildContext( this.packageBuilder.getPackageBuilderConfiguration(),
- this.packageBuilder.getPackage(),
- process,
- processDescr,
- this.packageBuilder.getDialectRegistry(),
- dialect );
-
dialect.getActionBuilder().build( context, actionNode, actionDescr );
- dialect.addAction( context );
}
- public void buildSplit(Process process, ProcessDescr processDescr, SplitImpl splitNode) {
+ public void buildSplit(Process process, ProcessDescr processDescr, ProcessBuildContext context, SplitImpl splitNode) {
// we need to clone the map, so we can update the original while iterating.
Map map = new HashMap( splitNode.getConstraints() );
for ( Iterator it = map.entrySet().iterator(); it.hasNext(); ) {
@@ -156,7 +172,18 @@
ruleConstraint.setPriority( constraint.getPriority() );
splitNode.setConstraint( connection, ruleConstraint );
} else if ( "eval".equals( constraint.getType() ) ) {
+ ReturnValueConstraintEvaluator returnValueConstraint = new ReturnValueConstraintEvaluator();
+ returnValueConstraint.setDialect( constraint.getDialect() );
+ returnValueConstraint.setName( constraint.getName() );
+ returnValueConstraint.setPriority( constraint.getPriority() );
+ returnValueConstraint.setPriority( constraint.getPriority() );
+ splitNode.setConstraint( connection, returnValueConstraint );
+ ReturnValueDescr returnValueDescr = new ReturnValueDescr();
+ returnValueDescr.setText( constraint.getConstraint() );
+
+ Dialect dialect = this.packageBuilder.getDialectRegistry().getDialect( constraint.getDialect() );
+ dialect.getReturnValueEvaluatorBuilder().build( context, returnValueConstraint, returnValueDescr );
}
}
}
@@ -199,12 +226,15 @@
Node[] nodes = ruleFlow.getNodes();
for (int i = 0; i < nodes.length; i++) {
- if (nodes[i] instanceof Split) {
+ if (nodes[i] instanceof Split ) {
Split split = (Split) nodes[i];
if (split.getType() == Split.TYPE_XOR || split.getType() == Split.TYPE_OR) {
- for (Iterator iterator = split.getOutgoingConnections().iterator(); iterator.hasNext(); ) {
+ for (Iterator iterator = split.getOutgoingConnections().iterator(); iterator.hasNext(); ) {
Connection connection = (Connection) iterator.next();
- builder.append( createSplitRule(process, connection, split.getConstraint(connection).getConstraint()) );
+ Constraint constraint = split.getConstraint( connection );
+ if ( "rule".equals( constraint.getType() ) ) {
+ builder.append( createSplitRule(process, connection, split.getConstraint(connection).getConstraint()) );
+ }
}
}
} else if (nodes[i] instanceof MilestoneNode) {
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ReturnValueDescr.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ReturnValueDescr.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ReturnValueDescr.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,24 @@
+package org.drools.compiler;
+
+import org.drools.lang.descr.BaseDescr;
+
+public class ReturnValueDescr extends BaseDescr {
+ private String text;
+
+ public ReturnValueDescr() {
+
+ }
+
+ public ReturnValueDescr(String text) {
+ super();
+ this.text = text;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/ReturnValueEvaluatorBuilder.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,14 @@
+package org.drools.rule.builder;
+
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.ruleflow.core.impl.ActionNodeImpl;
+import org.drools.ruleflow.core.impl.ReturnValueConstraintEvaluator;
+
+public interface ReturnValueEvaluatorBuilder {
+
+ public void build(final PackageBuildContext context,
+ final ReturnValueConstraintEvaluator returnValueConstraintEvaluator,
+ final ReturnValueDescr returnValueDescr);
+
+}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaActionBuilder.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -51,9 +51,9 @@
final ActionNodeImpl actionNode,
final ActionDescr actionDescr) {
- final String className = "action";
+ final String className = "action" + context.getNextId();
- JavaDialect dialect = (JavaDialect) context.getDialect();
+ JavaDialect dialect = (JavaDialect) context.getDialect( "java" );
Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
actionDescr,
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -58,6 +58,7 @@
import org.drools.rule.builder.ProcessClassBuilder;
import org.drools.rule.builder.QueryBuilder;
import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.RuleClassBuilder;
import org.drools.rule.builder.RuleConditionBuilder;
@@ -72,47 +73,47 @@
implements
Dialect {
- public static final String ID = "java";
+ public static final String ID = "java";
- private final static String EXPRESSION_DIALECT_NAME = "MVEL";
+ private final static String EXPRESSION_DIALECT_NAME = "MVEL";
// builders
- private final PatternBuilder pattern = new PatternBuilder();
- private final QueryBuilder query = new QueryBuilder();
- private final SalienceBuilder salience = new MVELSalienceBuilder();
- private final JavaAccumulateBuilder accumulate = new JavaAccumulateBuilder();
- private final JavaEvalBuilder eval = new JavaEvalBuilder();
- private final JavaPredicateBuilder predicate = new JavaPredicateBuilder();
- private final JavaReturnValueBuilder returnValue = new JavaReturnValueBuilder();
- private final JavaConsequenceBuilder consequence = new JavaConsequenceBuilder();
- private final JavaActionBuilder actionBuilder = new JavaActionBuilder();
- private final JavaRuleClassBuilder ruleClassBuilder = new JavaRuleClassBuilder();
- private final JavaProcessClassBuilder processClassBuilder = new JavaProcessClassBuilder();
- private final MVELFromBuilder from = new MVELFromBuilder();
- private final JavaFunctionBuilder function = new JavaFunctionBuilder();
- private final CollectBuilder collect = new CollectBuilder();
- private final ForallBuilder forall = new ForallBuilder();
+ private final PatternBuilder pattern = new PatternBuilder();
+ private final QueryBuilder query = new QueryBuilder();
+ private final SalienceBuilder salience = new MVELSalienceBuilder();
+ private final JavaAccumulateBuilder accumulate = new JavaAccumulateBuilder();
+ private final JavaEvalBuilder eval = new JavaEvalBuilder();
+ private final JavaPredicateBuilder predicate = new JavaPredicateBuilder();
+ private final JavaReturnValueBuilder returnValue = new JavaReturnValueBuilder();
+ private final JavaConsequenceBuilder consequence = new JavaConsequenceBuilder();
+ private final JavaActionBuilder actionBuilder = new JavaActionBuilder();
+ private final ReturnValueEvaluatorBuilder returnValueEvaluatorBuilder = new JavaReturnValueEvaluatorBuilder();
+ private final JavaRuleClassBuilder ruleClassBuilder = new JavaRuleClassBuilder();
+ private final JavaProcessClassBuilder processClassBuilder = new JavaProcessClassBuilder();
+ private final MVELFromBuilder from = new MVELFromBuilder();
+ private final JavaFunctionBuilder function = new JavaFunctionBuilder();
+ private final CollectBuilder collect = new CollectBuilder();
+ private final ForallBuilder forall = new ForallBuilder();
//
- private KnowledgeHelperFixer knowledgeHelperFixer;
- private DeclarationTypeFixer typeFixer;
- private JavaExprAnalyzer analyzer;
+ private KnowledgeHelperFixer knowledgeHelperFixer;
+ private DeclarationTypeFixer typeFixer;
+ private JavaExprAnalyzer analyzer;
- private JavaDialectConfiguration configuration;
+ private JavaDialectConfiguration configuration;
- private Package pkg;
- private JavaCompiler compiler;
- private List generatedClassList;
- private MemoryResourceReader src;
- private PackageStore packageStoreWrapper;
- private Map errorHandlers;
- private List results;
+ private Package pkg;
+ private JavaCompiler compiler;
+ private List generatedClassList;
+ private MemoryResourceReader src;
+ private PackageStore packageStoreWrapper;
+ private Map errorHandlers;
+ private List results;
+ private TypeResolver typeResolver;
+ private ClassFieldExtractorCache classFieldExtractorCache;
- private TypeResolver typeResolver;
- private ClassFieldExtractorCache classFieldExtractorCache;
-
// a map of registered builders
- private Map builders;
+ private Map builders;
public JavaDialect() {
@@ -204,9 +205,8 @@
"java",
this.src );
ruleDescr.setClassName( StringUtils.ucFirst( ruleClassName ) );
- }
+ }
-
public String getExpressionDialectName() {
return EXPRESSION_DIALECT_NAME;
}
@@ -214,17 +214,17 @@
public AnalysisResult analyzeExpression(final PackageBuildContext context,
final BaseDescr descr,
final Object content,
- final Set[] availableIdentifiers ) {
+ final Set[] availableIdentifiers) {
JavaAnalysisResult result = null;
try {
//new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()}
result = this.analyzer.analyzeExpression( (String) content,
- availableIdentifiers);
+ availableIdentifiers );
} catch ( final Exception e ) {
context.getErrors().add( new DescrBuildError( context.getParentDescr(),
- descr,
- e,
- "Unable to determine the used declarations.\n" + e) );
+ descr,
+ e,
+ "Unable to determine the used declarations.\n" + e ) );
}
return result;
}
@@ -237,12 +237,12 @@
try {
// new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()}
result = this.analyzer.analyzeBlock( text,
- availableIdentifiers);
+ availableIdentifiers );
} catch ( final Exception e ) {
context.getErrors().add( new DescrBuildError( context.getParentDescr(),
- descr,
- e,
- "Unable to determine the used declarations.\n" + e) );
+ descr,
+ e,
+ "Unable to determine the used declarations.\n" + e ) );
}
return result;
}
@@ -313,11 +313,15 @@
public ConsequenceBuilder getConsequenceBuilder() {
return this.consequence;
}
-
+
public ActionBuilder getActionBuilder() {
return this.actionBuilder;
}
+ public ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
+ return this.returnValueEvaluatorBuilder;
+ }
+
public RuleClassBuilder getRuleClassBuilder() {
return this.ruleClassBuilder;
}
@@ -325,7 +329,7 @@
public ProcessClassBuilder getProcessClassBuilder() {
return this.processClassBuilder;
}
-
+
public FunctionBuilder getFunctionBuilder() {
return this.function;
}
@@ -355,11 +359,11 @@
if ( result.getErrors().length > 0 ) {
for ( int i = 0; i < result.getErrors().length; i++ ) {
final CompilationProblem err = result.getErrors()[i];
-
-// System.out.println("Line: "+err.getStartLine());
-// LineMappings maps = this.pkg.getPackageCompilationData().getLineMappings( err.getFileName().replace( '/', '.' ).substring( 0, err.getFileName().length() - 5 ) );
-// int line = err.getStartLine() + maps.getStartLine() - maps.getOffset() -1;
-// System.out.println("Map: "+line);
+
+ // System.out.println("Line: "+err.getStartLine());
+ // LineMappings maps = this.pkg.getPackageCompilationData().getLineMappings( err.getFileName().replace( '/', '.' ).substring( 0, err.getFileName().length() - 5 ) );
+ // int line = err.getStartLine() + maps.getStartLine() - maps.getOffset() -1;
+ // System.out.println("Map: "+line);
final ErrorHandler handler = (ErrorHandler) this.errorHandlers.get( err.getFileName() );
if ( handler instanceof RuleErrorHandler ) {
final RuleErrorHandler rh = (RuleErrorHandler) handler;
@@ -393,12 +397,12 @@
*/
public void addRule(final RuleBuildContext context) {
RuleClassBuilder classBuilder = context.getDialect().getRuleClassBuilder();
-
+
String ruleClass = classBuilder.buildRule( context );
// return if there is no ruleclass name;
if ( ruleClass == null ) {
return;
- }
+ }
final Rule rule = context.getRule();
final RuleDescr ruleDescr = context.getRuleDescr();
@@ -442,19 +446,19 @@
mapping.setOffset( ruleDescr.getConsequenceOffset() );
context.getPkg().getPackageCompilationData().getLineMappings().put( name,
- mapping );
+ mapping );
}
-
+
/**
* This will add the rule for compiling later on.
* It will not actually call the compiler
*/
- public void addAction(final ProcessBuildContext context) {
+ public void addProcess(final ProcessBuildContext context) {
ProcessClassBuilder classBuilder = context.getDialect().getProcessClassBuilder();
-
+
String processClass = classBuilder.buildRule( context );
-
+
final Process process = context.getProcess();
final ProcessDescr processDescr = context.getProcessDescr();
@@ -464,8 +468,8 @@
processClass,
this.src,
new ProcessErrorHandler( processDescr,
- process,
- "Process Compilation error" ) );
+ process,
+ "Process Compilation error" ) );
for ( final Iterator it = context.getInvokers().keySet().iterator(); it.hasNext(); ) {
final String className = (String) it.next();
@@ -485,22 +489,22 @@
text,
this.src,
new ProcessInvokerErrorHandler( processDescr,
- process,
- "Unable to generate action invoker." ) );
+ process,
+ "Unable to generate action invoker." ) );
}
-
+
// setup the line mappins for this rule
// @TODO must setup mappings
-// final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
-// final LineMappings mapping = new LineMappings( name );
-// mapping.setStartLine( ruleDescr.getConsequenceLine() );
-// mapping.setOffset( ruleDescr.getConsequenceOffset() );
-//
-// context.getPkg().getPackageCompilationData().getLineMappings().put( name,
-// mapping );
+ // final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
+ // final LineMappings mapping = new LineMappings( name );
+ // mapping.setStartLine( ruleDescr.getConsequenceLine() );
+ // mapping.setOffset( ruleDescr.getConsequenceOffset() );
+ //
+ // context.getPkg().getPackageCompilationData().getLineMappings().put( name,
+ // mapping );
- }
+ }
public void addFunction(final FunctionDescr functionDescr,
final TypeResolver typeResolver) {
@@ -526,7 +530,7 @@
mapping.setStartLine( functionDescr.getLine() );
mapping.setOffset( functionDescr.getOffset() );
pkg.getPackageCompilationData().getLineMappings().put( functionClassName,
- mapping );
+ mapping );
}
/**
@@ -572,7 +576,7 @@
String lngLevel = this.configuration.getJavaLanguageLevel();
settings.setTargetVersion( lngLevel );
- settings.setSourceVersion( lngLevel );
+ settings.setSourceVersion( lngLevel );
break;
}
}
@@ -601,9 +605,9 @@
* @return
*/
public static String getUniqueLegalName(final String packageName,
- final String name,
- final String ext,
- final ResourceReader src) {
+ final String name,
+ final String ext,
+ final ResourceReader src) {
// replaces all non alphanumeric or $ chars with _
String newName = "Rule_" + name.replaceAll( "[[^\\w]$]",
"_" );
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaReturnValueEvaluatorBuilder.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Declaration;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.dialect.mvel.MVELDialect;
+import org.drools.ruleflow.core.impl.ActionNodeImpl;
+import org.drools.ruleflow.core.impl.ReturnValueConstraintEvaluator;
+import org.drools.spi.PatternExtractor;
+
+/**
+ * @author etirelli
+ *
+ */
+public class JavaReturnValueEvaluatorBuilder extends AbstractJavaProcessBuilder
+ implements
+ ReturnValueEvaluatorBuilder {
+
+ /* (non-Javadoc)
+ * @see org.drools.semantics.java.builder.ConsequenceBuilder#buildConsequence(org.drools.semantics.java.builder.BuildContext, org.drools.semantics.java.builder.BuildUtils, org.drools.lang.descr.RuleDescr)
+ */
+ public void build(final PackageBuildContext context,
+ final ReturnValueConstraintEvaluator constraintNode,
+ final ReturnValueDescr descr) {
+
+ final String className = "returnValueEvaluator" + context.getNextId();
+
+ JavaDialect dialect = (JavaDialect) context.getDialect( "java" );
+
+ Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+ descr,
+ descr.getText(),
+ new Set[]{Collections.EMPTY_SET, context.getPkg().getGlobals().keySet()} );
+
+ if ( analysis == null ) {
+ // not possible to get the analysis results
+ return;
+ }
+
+ final List[] usedIdentifiers = analysis.getBoundIdentifiers();
+
+
+ final Map map = createVariableContext( className,
+ descr.getText(),
+ (ProcessBuildContext) context,
+ (String[]) usedIdentifiers[1].toArray( new String[usedIdentifiers[1].size()] ) );
+ map.put( "text",
+ descr.getText() );
+
+ generatTemplates( "returnValueEvaluatorMethod",
+ "returnValueEvaluatorInvoker",
+ (ProcessBuildContext)context,
+ className,
+ map,
+ constraintNode,
+ descr );
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELActionBuilder.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -35,7 +35,7 @@
String text = actionDescr.getText();
try {
- MVELDialect dialect = (MVELDialect) context.getDialect();
+ MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
actionDescr,
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -84,6 +84,7 @@
private final MVELReturnValueBuilder returnValue = new MVELReturnValueBuilder();
private final MVELConsequenceBuilder consequence = new MVELConsequenceBuilder();
private final MVELActionBuilder actionBuilder = new MVELActionBuilder();
+ private final MVELReturnValueEvaluatorBuilder returnValueEvaluatorBuilder = new MVELReturnValueEvaluatorBuilder();
//private final JavaRuleClassBuilder rule = new JavaRuleClassBuilder();
private final MVELFromBuilder from = new MVELFromBuilder();
private final JavaFunctionBuilder function = new JavaFunctionBuilder();
@@ -248,7 +249,7 @@
}
- public void addAction(final ProcessBuildContext context) {
+ public void addProcess(final ProcessBuildContext context) {
// @TODO setup line mappings
}
@@ -488,6 +489,10 @@
public ActionBuilder getActionBuilder() {
return this.actionBuilder;
}
+
+ public MVELReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
+ return this.returnValueEvaluatorBuilder;
+ }
public RuleConditionBuilder getEvalBuilder() {
return this.eval;
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueEvaluatorBuilder.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,125 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.base.mvel.DroolsMVELFactory;
+import org.drools.base.mvel.MVELAction;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELReturnValueEvaluator;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DescrBuildError;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.rule.builder.ActionBuilder;
+import org.drools.rule.builder.ConsequenceBuilder;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.ruleflow.core.impl.ActionNodeImpl;
+import org.drools.ruleflow.core.impl.ReturnValueConstraintEvaluator;
+import org.drools.spi.ReturnValueEvaluator;
+import org.mvel.Macro;
+import org.mvel.MacroProcessor;
+
+public class MVELReturnValueEvaluatorBuilder
+ implements
+ ReturnValueEvaluatorBuilder {
+
+ public MVELReturnValueEvaluatorBuilder() {
+
+ }
+
+ public void build(final PackageBuildContext context,
+ final ReturnValueConstraintEvaluator constraintNode,
+ final ReturnValueDescr descr) {
+
+ String text = descr.getText();
+
+ try {
+ MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+ Dialect.AnalysisResult analysis = dialect.analyzeBlock( context,
+ descr,
+ dialect.getInterceptors(),
+ text,
+ new Set[]{Collections.EMPTY_SET, context.getPkg().getGlobals().keySet()},
+ null );
+
+ final Serializable expr = dialect.compile( text,
+ analysis,
+ dialect.getInterceptors(),
+ null,
+ context );
+
+ final DroolsMVELFactory factory = new DroolsMVELFactory( null,
+ null,
+ context.getPkg().getGlobals(),
+ analysis.getBoundIdentifiers() );
+
+ constraintNode.setEvaluator( new MVELReturnValueEvaluator( expr, factory ) );
+ } catch ( final Exception e ) {
+ context.getErrors().add( new DescrBuildError( context.getParentDescr(),
+ descr,
+ null,
+ "Unable to build expression for 'returnValuEvaluator' '" + descr.getText() + "'" ) );
+ }
+ }
+
+ /**
+ * Allows newlines to demarcate expressions, as per MVEL command line.
+ * If expression spans multiple lines (ie inside an unbalanced bracket) then
+ * it is left alone.
+ * Uses character based iteration which is at least an order of magnitude faster then a single
+ * simple regex.
+ */
+ public static String delimitExpressions(String s) {
+
+ StringBuffer result = new StringBuffer();
+ char[] cs = s.toCharArray();
+ int brace = 0;
+ int sqre = 0;
+ int crly = 0;
+ char lastNonWhite = ';';
+ for ( int i = 0; i < cs.length; i++ ) {
+ char c = cs[i];
+ switch ( c ) {
+ case '(' :
+ brace++;
+ break;
+ case '{' :
+ crly++;
+ break;
+ case '[' :
+ sqre++;
+ break;
+ case ')' :
+ brace--;
+ break;
+ case '}' :
+ crly--;
+ break;
+ case ']' :
+ sqre--;
+ break;
+ default :
+ break;
+ }
+ if ( (brace == 0 && sqre == 0 && crly == 0) && (c == '\n' || c == '\r') ) {
+ if ( lastNonWhite != ';' ) {
+ result.append( ';' );
+ lastNonWhite = ';';
+ }
+ } else if ( !Character.isWhitespace( c ) ) {
+ lastNonWhite = c;
+ }
+ result.append( c );
+
+ }
+ return result.toString();
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaInvokers.mvel 2007-12-05 23:59:31 UTC (rev 17050)
@@ -345,4 +345,23 @@
@end{","} );
}
}
+>>=::
+
+returnValueEvaluatorInvoker() ::=<<
+package @{package};
+
+public class @{invokerClassName} implements org.drools.spi.ReturnValueEvaluator
+{
+ private static final long serialVersionUID = 400L;
+
+ public Object evaluate(org.drools.WorkingMemory workingMemory) throws Exception {
+
+ @foreach{globalTypes, globals as type, identifier} @{type} @{identifier} = ( @{type} ) workingMemory.getGlobal( "@{identifier}" );
+ @end{}
+
+ return @{processClassName}.@{methodName} (
+ @foreach{globals as identifier} @{identifier}
+ @end{","} );
+ }
+}
>>=::
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/org/drools/rule/builder/dialect/java/javaRule.mvel 2007-12-05 23:59:31 UTC (rev 17050)
@@ -78,4 +78,10 @@
public static void @{methodName}(@foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","} ) throws Exception {
@{text}
}
+>>=::
+
+returnValueEvaluatorMethod() ::=<<
+public static Object @{methodName}(@foreach{globalTypes, globals as type, identifier} @{type} @{identifier} @end{","} ) throws Exception {
+ @{text}
+}
>>=::
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderConfigurationTest.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -35,6 +35,7 @@
import org.drools.rule.builder.ProcessClassBuilder;
import org.drools.rule.builder.QueryBuilder;
import org.drools.rule.builder.ReturnValueBuilder;
+import org.drools.rule.builder.ReturnValueEvaluatorBuilder;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.RuleClassBuilder;
import org.drools.rule.builder.RuleConditionBuilder;
@@ -303,7 +304,7 @@
this.rule = context.getRule();
}
- public void addAction(final ProcessBuildContext context) {
+ public void addProcess(final ProcessBuildContext context) {
}
@@ -417,6 +418,11 @@
public String getId() {
return "mock";
}
+
+ public ReturnValueEvaluatorBuilder getReturnValueEvaluatorBuilder() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
public static class MockEvalBuilder
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ExecutionFlowControlTest.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -750,6 +750,70 @@
assertEquals( "mvel was here", list.get( 0 ) );
assertEquals( "java was here", list.get( 1 ) );
}
+
+ public void testRuleFlowConstraintDialects() throws Exception {
+ final PackageBuilder builder = new PackageBuilder();
+ builder.addRuleFlow( new InputStreamReader( getClass().getResourceAsStream( "test_ConstraintDialects.rfm" ) ) );
+
+ System.err.print( builder.getErrors() );
+
+ assertEquals( 0, builder.getErrors().getErrors().length );
+
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage( builder.getPackage() );
+
+ StatefulSession session = ruleBase.newStatefulSession();
+ List inList = new ArrayList();
+ List outList = new ArrayList();
+ session.setGlobal( "inList", inList );
+ session.setGlobal( "outList", outList );
+
+ inList.add( 1 );
+ inList.add( 3 );
+ inList.add( 6 );
+ inList.add( 25 );
+
+ FactHandle handle = session.insert( inList );
+ session.startProcess( "ConstraintDialects" );
+ assertEquals( 4, outList.size() );
+ assertEquals( "MVELCodeConstraint was here", outList.get( 0 ));
+ assertEquals( "JavaCodeConstraint was here", outList.get( 1 ));
+ assertEquals( "MVELRuleConstraint was here", outList.get( 2 ));
+ assertEquals( "JavaRuleConstraint was here", outList.get( 3 ));
+
+ outList.clear();
+ inList.remove( new Integer( 1 ) );
+ session.update( handle, inList );
+ session.startProcess( "ConstraintDialects" );
+ assertEquals( 3, outList.size() );
+ assertEquals( "JavaCodeConstraint was here", outList.get( 0 ));
+ assertEquals( "MVELRuleConstraint was here", outList.get( 1 ));
+ assertEquals( "JavaRuleConstraint was here", outList.get( 2 ));
+
+ outList.clear();
+ inList.remove( new Integer( 6 ) );
+ session.update( handle, inList );
+ session.startProcess( "ConstraintDialects" );
+ assertEquals( 2, outList.size() );
+ assertEquals( "JavaCodeConstraint was here", outList.get( 0 ));
+ assertEquals( "JavaRuleConstraint was here", outList.get( 1 ));
+
+ outList.clear();
+ inList.remove( new Integer( 3 ) );
+ session.update( handle, inList );
+ session.startProcess( "ConstraintDialects" );
+ assertEquals( 1, outList.size() );
+ assertEquals( "JavaRuleConstraint was here", outList.get( 0 ));
+
+ outList.clear();
+ inList.remove( new Integer( 25 ) );
+ session.update( handle, inList );
+ try {
+ session.startProcess( "ConstraintDialects" );
+ fail("This should have thrown an exception" );
+ } catch ( Exception e ) {
+ }
+ }
public void testLoadingRuleFlowInPackage7() throws Exception {
// loading a ruleflow with errors
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java 2007-12-05 23:59:00 UTC (rev 17049)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaActionBuilderTest.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -82,8 +82,9 @@
ActionNodeImpl actionNode = new ActionNodeImpl();
javaDialect.getActionBuilder().build( context, actionNode, actionDescr );
- javaDialect.addAction( context );
- javaDialect.compileAll();
+ javaDialect.addProcess( context );
+ javaDialect.compileAll();
+ assertEquals( 0, javaDialect.getResults().size() );
final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
ruleBase.addPackage( pkgBuilder.getPackage() );
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/java/JavaReturnValueConstraintEvaluatorBuilderTest.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,90 @@
+package org.drools.rule.builder.dialect.java;
+
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.lang.descr.ProcessDescr;
+import org.drools.rule.Package;
+import org.drools.rule.builder.ProcessBuildContext;
+import org.drools.ruleflow.common.core.Process;
+import org.drools.ruleflow.core.impl.ReturnValueConstraintEvaluator;
+import org.drools.ruleflow.core.impl.RuleFlowProcessImpl;
+import org.drools.ruleflow.instance.impl.RuleFlowProcessInstanceImpl;
+import org.drools.ruleflow.instance.impl.RuleFlowSplitInstanceImpl;
+
+public class JavaReturnValueConstraintEvaluatorBuilderTest extends TestCase {
+
+ public void setUp() {
+ }
+
+ public void testSimpleReturnValueConstraintEvaluator() throws Exception {
+ final Package pkg = new Package( "pkg1" );
+
+ ProcessDescr processDescr = new ProcessDescr();
+ processDescr.setClassName( "Process1" );
+ processDescr.setName( "Process1" );
+
+ RuleFlowProcessImpl process = new RuleFlowProcessImpl();
+ process.setName( "Process1" );
+ process.setPackageName( "pkg1" );
+
+ ReturnValueDescr descr = new ReturnValueDescr();
+ descr.setText( "return value;" );
+
+ PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+ final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+ JavaDialect javaDialect = (JavaDialect) pkgBuilder.getDialectRegistry().getDialect( "java" );
+
+ ProcessBuildContext context = new ProcessBuildContext( conf,
+ pkg,
+ process,
+ processDescr,
+ pkgBuilder.getDialectRegistry(),
+ javaDialect );
+
+ pkgBuilder.addPackageFromDrl( new StringReader( "package pkg1;\nglobal Boolean value;" ) );
+
+ ReturnValueConstraintEvaluator node = new ReturnValueConstraintEvaluator();
+
+ final JavaReturnValueEvaluatorBuilder builder = new JavaReturnValueEvaluatorBuilder();
+ builder.build( context,
+ node,
+ descr );
+
+ javaDialect.addProcess( context );
+ javaDialect.compileAll();
+ assertEquals( 0, javaDialect.getResults().size() );
+
+ final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage( pkgBuilder.getPackage() );
+ final InternalWorkingMemory wm = (InternalWorkingMemory) ruleBase.newStatefulSession();
+
+ wm.setGlobal( "value",
+ true );
+
+ RuleFlowProcessInstanceImpl processInstance = new RuleFlowProcessInstanceImpl();
+ processInstance.setWorkingMemory( wm );
+
+ RuleFlowSplitInstanceImpl splitInstance = new RuleFlowSplitInstanceImpl();
+ splitInstance.setProcessInstance( processInstance );
+
+ assertTrue( node.evaluate( splitInstance,
+ null,
+ null ) );
+
+ wm.setGlobal( "value",
+ false );
+
+ assertFalse( node.evaluate( splitInstance,
+ null,
+ null ) );
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELDecisionBuilderTest.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,90 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.InputStreamReader;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.drools.Cheese;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassObjectType;
+import org.drools.base.DefaultKnowledgeHelper;
+import org.drools.base.mvel.MVELConsequence;
+import org.drools.base.mvel.MVELDebugHandler;
+import org.drools.common.AgendaItem;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.PropagationContextImpl;
+import org.drools.compiler.Dialect;
+import org.drools.compiler.DialectConfiguration;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.lang.descr.ActionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.reteoo.ReteTuple;
+import org.drools.rule.Declaration;
+import org.drools.rule.Package;
+import org.drools.rule.Pattern;
+import org.drools.rule.Rule;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.rule.builder.RuleBuildContext;
+import org.drools.rule.builder.RuleBuilder;
+import org.drools.ruleflow.core.impl.ActionNodeImpl;
+import org.drools.spi.Action;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PatternExtractor;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
+
+public class MVELDecisionBuilderTest extends TestCase {
+
+ public void setUp() {
+ }
+
+ public void testSimpleAction() throws Exception {
+ final Package pkg = new Package( "pkg1" );
+
+ ActionDescr actionDescr = new ActionDescr();
+ actionDescr.setText( "list.add( 'hello world' )" );
+
+ PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+ final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+ MVELDialect mvelDialect = ( MVELDialect ) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+ PackageBuildContext context = new PackageBuildContext();
+ context.init( conf, pkg, null, pkgBuilder.getDialectRegistry(), mvelDialect, null);
+
+ pkgBuilder.addPackageFromDrl( new StringReader("package pkg1;\nglobal java.util.List list;\n") );
+
+ ActionNodeImpl actionNode = new ActionNodeImpl();
+
+ final MVELActionBuilder builder = new MVELActionBuilder();
+ builder.build( context,
+ actionNode,
+ actionDescr );
+
+ final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage( pkgBuilder.getPackage() );
+ final WorkingMemory wm = ruleBase.newStatefulSession();
+
+ List list = new ArrayList();
+ wm.setGlobal( "list", list );
+
+ ((Action)actionNode.getAction()).execute( wm );
+
+ assertEquals("hello world", list.get(0) );
+ }
+
+}
+
Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueConstraintEvaluatorBuilderTest.java 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,74 @@
+package org.drools.rule.builder.dialect.mvel;
+
+import java.io.StringReader;
+
+import junit.framework.TestCase;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.compiler.ReturnValueDescr;
+import org.drools.rule.Package;
+import org.drools.rule.builder.PackageBuildContext;
+import org.drools.ruleflow.core.impl.ReturnValueConstraintEvaluator;
+import org.drools.ruleflow.instance.impl.RuleFlowProcessInstanceImpl;
+import org.drools.ruleflow.instance.impl.RuleFlowSplitInstanceImpl;
+
+public class MVELReturnValueConstraintEvaluatorBuilderTest extends TestCase {
+
+ public void setUp() {
+ }
+
+ public void testSimpleReturnValueConstraintEvaluator() throws Exception {
+ final Package pkg = new Package( "pkg1" );
+
+ ReturnValueDescr descr = new ReturnValueDescr();
+ descr.setText( "return value" );
+
+ PackageBuilder pkgBuilder = new PackageBuilder( pkg );
+ final PackageBuilderConfiguration conf = pkgBuilder.getPackageBuilderConfiguration();
+ MVELDialect mvelDialect = (MVELDialect) pkgBuilder.getDialectRegistry().getDialect( "mvel" );
+
+ PackageBuildContext context = new PackageBuildContext();
+ context.init( conf,
+ pkg,
+ null,
+ pkgBuilder.getDialectRegistry(),
+ mvelDialect,
+ null );
+
+ pkgBuilder.addPackageFromDrl( new StringReader( "package pkg1;\nglobal Boolean value;" ) );
+
+ ReturnValueConstraintEvaluator node = new ReturnValueConstraintEvaluator();
+
+ final MVELReturnValueEvaluatorBuilder builder = new MVELReturnValueEvaluatorBuilder();
+ builder.build( context,
+ node,
+ descr );
+
+ final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+ ruleBase.addPackage( pkgBuilder.getPackage() );
+ final InternalWorkingMemory wm = (InternalWorkingMemory) ruleBase.newStatefulSession();
+
+ wm.setGlobal( "value", true );
+
+ RuleFlowProcessInstanceImpl processInstance = new RuleFlowProcessInstanceImpl();
+ processInstance.setWorkingMemory( wm );
+
+ RuleFlowSplitInstanceImpl splitInstance = new RuleFlowSplitInstanceImpl();
+ splitInstance.setProcessInstance( processInstance );
+
+ assertTrue( node.evaluate( splitInstance,
+ null,
+ null ) );
+
+ wm.setGlobal( "value", false );
+
+ assertFalse( node.evaluate( splitInstance,
+ null,
+ null ) );
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rf 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,628 @@
+<org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper id="1" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+ <default>
+ <elements id="2">
+ <entry>
+ <string>5-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.SplitWrapper id="3" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="4">
+ <x>259</x>
+ <y>112</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.SplitImpl" id="5">
+ <type>3</type>
+ <constraints id="6">
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="7">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="8">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="9">
+ <dialect>java</dialect>
+ <consequence>outList.add("JavaCodeConstraint was here");</consequence>
+ </action>
+ <id>7</id>
+ <name>JavaCodeConstraintAction</name>
+ <incomingConnections id="10">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="7"/>
+ </incomingConnections>
+ <outgoingConnections id="11">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="12">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="8"/>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" id="13">
+ <type>1</type>
+ <id>10</id>
+ <name>Join</name>
+ <incomingConnections id="14">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="15">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="16">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="17">
+ <dialect>mvel</dialect>
+ <consequence>outList.add("MVELCodeConstraint was here");</consequence>
+ </action>
+ <id>6</id>
+ <name>MVELCodeConstraintAction</name>
+ <incomingConnections id="18">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="19">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="20">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="12"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="21">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="22">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="23">
+ <dialect>mvel</dialect>
+ <consequence>outList.add("MVELRuleConstraint was here");</consequence>
+ </action>
+ <id>8</id>
+ <name>MVELRuleConstraintAction</name>
+ <incomingConnections id="24">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="25">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="22"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="26">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="21"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="27">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="28">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="29">
+ <dialect>java</dialect>
+ <consequence>outList.add("JavaRuleConstraint was here");</consequence>
+ </action>
+ <id>9</id>
+ <name>JavaRuleConstraintAction</name>
+ <incomingConnections id="30">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="31">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="28"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="32">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="27"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="33">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="34">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+ <to class="org.drools.ruleflow.core.impl.EndNodeImpl" id="35">
+ <id>4</id>
+ <name>End</name>
+ <incomingConnections id="36">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="34"/>
+ </incomingConnections>
+ <outgoingConnections id="37"/>
+ </to>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </outgoingConnections>
+ </to>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </outgoingConnections>
+ </to>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="38">
+ <name>JavaCodeConstraint</name>
+ <constraint>return inList.contains( 3 );</constraint>
+ <priority>3</priority>
+ <dialect>java</dialect>
+ <type>eval</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="31"/>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="39">
+ <name>JavaRuleConstraint</name>
+ <constraint>list : List()
+eval( list.contains( 25 ) )</constraint>
+ <priority>25</priority>
+ <dialect>java</dialect>
+ <type>rule</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="25"/>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="40">
+ <name>MVELRuleConstraint</name>
+ <constraint>list : List()
+eval( list.contains( 6 ) )</constraint>
+ <priority>6</priority>
+ <dialect>mvel</dialect>
+ <type>rule</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="19"/>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="41">
+ <name>MVELCodeConstraint</name>
+ <constraint>return inList.contains( 1 );</constraint>
+ <priority>1</priority>
+ <dialect>mvel</dialect>
+ <type>eval</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ </constraints>
+ <id>5</id>
+ <name>Split</name>
+ <incomingConnections id="42">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="43">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="44">
+ <id>1</id>
+ <name>Start</name>
+ <incomingConnections id="45"/>
+ <outgoingConnections id="46">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="43"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.SplitImpl" reference="5"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="47">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="19"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="7"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="25"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="31"/>
+ </outgoingConnections>
+ </element>
+ <incomingConnections id="48">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="49" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="50"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper" id="51" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="52">
+ <x>259</x>
+ <y>12</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.StartNodeImpl" reference="44"/>
+ <incomingConnections id="53"/>
+ <outgoingConnections id="54">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="49"/>
+ </outgoingConnections>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ </source>
+ <target class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="43"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </incomingConnections>
+ <outgoingConnections id="55">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="56" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="57"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+ <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="58" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="59">
+ <x>11</x>
+ <y>279</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+ <incomingConnections id="60">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="56"/>
+ </incomingConnections>
+ <outgoingConnections id="61">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="62" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="63"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="58"/>
+ <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" id="64" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="65">
+ <x>259</x>
+ <y>451</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.JoinImpl" reference="13"/>
+ <incomingConnections id="66">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="62"/>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="67" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="68"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="69" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="70">
+ <x>193</x>
+ <y>279</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="8"/>
+ <incomingConnections id="71">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="72" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="73"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+ <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="69"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="7"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </incomingConnections>
+ <outgoingConnections id="74">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="67"/>
+ </outgoingConnections>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ <default>
+ <descriptors id="75">
+ <org.eclipse.ui.views.properties.TextPropertyDescriptor id="76">
+ <id class="string">Name</id>
+ <display>Name</display>
+ <incompatible>false</incompatible>
+ </org.eclipse.ui.views.properties.TextPropertyDescriptor>
+ <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="77">
+ <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" id="78">
+ <nodes id="79">
+ <entry>
+ <long>4</long>
+ <org.drools.ruleflow.core.impl.EndNodeImpl reference="35"/>
+ </entry>
+ <entry>
+ <long>8</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="22"/>
+ </entry>
+ <entry>
+ <long>9</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="28"/>
+ </entry>
+ <entry>
+ <long>6</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="16"/>
+ </entry>
+ <entry>
+ <long>1</long>
+ <org.drools.ruleflow.core.impl.StartNodeImpl reference="44"/>
+ </entry>
+ <entry>
+ <long>7</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="8"/>
+ </entry>
+ <entry>
+ <long>10</long>
+ <org.drools.ruleflow.core.impl.JoinImpl reference="13"/>
+ </entry>
+ <entry>
+ <long>5</long>
+ <org.drools.ruleflow.core.impl.SplitImpl reference="5"/>
+ </entry>
+ </nodes>
+ <variables id="80"/>
+ <lastNodeId>10</lastNodeId>
+ <imports id="81">
+ <string>java.util.List</string>
+ </imports>
+ <globals id="82">
+ <entry>
+ <string>inList</string>
+ <string>List</string>
+ </entry>
+ <entry>
+ <string>outList</string>
+ <string>List</string>
+ </entry>
+ </globals>
+ <id>ConstraintDialects</id>
+ <name>ConstraintDialects</name>
+ <type>RuleFlow</type>
+ <packageName>org.drools.test</packageName>
+ </process>
+ <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="8"/>
+ <id class="string">Action</id>
+ <display>Action</display>
+ <incompatible>false</incompatible>
+ </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+ </descriptors>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ </source>
+ <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="12"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="83" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="84"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="85" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="86">
+ <x>327</x>
+ <y>279</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="22"/>
+ <incomingConnections id="87">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="88" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="89"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+ <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="85"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="25"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </incomingConnections>
+ <outgoingConnections id="90">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="83"/>
+ </outgoingConnections>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ <default>
+ <descriptors id="91">
+ <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="76"/>
+ <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="92">
+ <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+ <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="22"/>
+ <id class="string">Action</id>
+ <display>Action</display>
+ <incompatible>false</incompatible>
+ </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+ </descriptors>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ </source>
+ <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="21"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="93" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="94"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" id="95" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="96">
+ <x>505</x>
+ <y>279</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="28"/>
+ <incomingConnections id="97">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="98" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="99"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.SplitWrapper" reference="3"/>
+ <target class="org.drools.eclipse.flow.ruleflow.core.ActionWrapper" reference="95"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="31"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </incomingConnections>
+ <outgoingConnections id="100">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="93"/>
+ </outgoingConnections>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ <default>
+ <descriptors id="101">
+ <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="76"/>
+ <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="102">
+ <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+ <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="28"/>
+ <id class="string">Action</id>
+ <display>Action</display>
+ <incompatible>false</incompatible>
+ </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+ </descriptors>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ </source>
+ <target class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="27"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </incomingConnections>
+ <outgoingConnections id="103">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper id="104" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <default>
+ <type>1</type>
+ <bendpoints id="105"/>
+ <source class="org.drools.eclipse.flow.ruleflow.core.JoinWrapper" reference="64"/>
+ <target class="org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper" id="106" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="107">
+ <x>259</x>
+ <y>556</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="35"/>
+ <incomingConnections id="108">
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="104"/>
+ </incomingConnections>
+ <outgoingConnections id="109"/>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ </target>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="34"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </outgoingConnections>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ </target>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="15"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </outgoingConnections>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ <default>
+ <descriptors id="110">
+ <org.eclipse.ui.views.properties.TextPropertyDescriptor reference="76"/>
+ <org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor id="111">
+ <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+ <actionNode class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+ <id class="string">Action</id>
+ <display>Action</display>
+ <incompatible>false</incompatible>
+ </org.drools.eclipse.flow.ruleflow.view.property.action.ActionPropertyDescriptor>
+ </descriptors>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ActionWrapper>
+ </target>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ElementConnection>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <default>
+ <connection class="org.drools.ruleflow.core.impl.ConnectionImpl" reference="19"/>
+ </default>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="72"/>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="88"/>
+ <org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper reference="98"/>
+ </outgoingConnections>
+ <parent class="org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper" reference="1"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+ <default/>
+ </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.SplitWrapper>
+ </entry>
+ <entry>
+ <string>9-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="95"/>
+ </entry>
+ <entry>
+ <string>7-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="69"/>
+ </entry>
+ <entry>
+ <string>4-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper reference="106"/>
+ </entry>
+ <entry>
+ <string>6-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="58"/>
+ </entry>
+ <entry>
+ <string>10-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.JoinWrapper reference="64"/>
+ </entry>
+ <entry>
+ <string>1-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper reference="51"/>
+ </entry>
+ <entry>
+ <string>8-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.ActionWrapper reference="85"/>
+ </entry>
+ </elements>
+ <process class="org.drools.ruleflow.core.impl.RuleFlowProcessImpl" reference="78"/>
+ <routerLayout>2</routerLayout>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper>
\ No newline at end of file
Added: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm 2007-12-05 23:59:31 UTC (rev 17050)
@@ -0,0 +1,231 @@
+<org.drools.ruleflow.core.impl.RuleFlowProcessImpl id="1">
+ <nodes id="2">
+ <entry>
+ <long>4</long>
+ <org.drools.ruleflow.core.impl.EndNodeImpl id="3">
+ <id>4</id>
+ <name>End</name>
+ <incomingConnections id="4">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="5">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.JoinImpl" id="6">
+ <type>1</type>
+ <id>10</id>
+ <name>Join</name>
+ <incomingConnections id="7">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="8">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="9">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="10">
+ <dialect>mvel</dialect>
+ <consequence>outList.add("MVELCodeConstraint was here");</consequence>
+ </action>
+ <id>6</id>
+ <name>MVELCodeConstraintAction</name>
+ <incomingConnections id="11">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="12">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" id="13">
+ <type>3</type>
+ <constraints id="14">
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="15">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="16">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="17">
+ <dialect>java</dialect>
+ <consequence>outList.add("JavaCodeConstraint was here");</consequence>
+ </action>
+ <id>7</id>
+ <name>JavaCodeConstraintAction</name>
+ <incomingConnections id="18">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+ </incomingConnections>
+ <outgoingConnections id="19">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="20">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="16"/>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </outgoingConnections>
+ </to>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="21">
+ <name>JavaCodeConstraint</name>
+ <constraint>return inList.contains( 3 );</constraint>
+ <priority>3</priority>
+ <dialect>java</dialect>
+ <type>eval</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="22">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="23">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="24">
+ <dialect>java</dialect>
+ <consequence>outList.add("JavaRuleConstraint was here");</consequence>
+ </action>
+ <id>9</id>
+ <name>JavaRuleConstraintAction</name>
+ <incomingConnections id="25">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="22"/>
+ </incomingConnections>
+ <outgoingConnections id="26">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="27">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="23"/>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </outgoingConnections>
+ </to>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="28">
+ <name>JavaRuleConstraint</name>
+ <constraint>list : List()
+eval( list.contains( 25 ) )</constraint>
+ <priority>25</priority>
+ <dialect>java</dialect>
+ <type>rule</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="29">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" id="30">
+ <action class="org.drools.ruleflow.core.impl.DroolsConsequenceAction" id="31">
+ <dialect>mvel</dialect>
+ <consequence>outList.add("MVELRuleConstraint was here");</consequence>
+ </action>
+ <id>8</id>
+ <name>MVELRuleConstraintAction</name>
+ <incomingConnections id="32">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="29"/>
+ </incomingConnections>
+ <outgoingConnections id="33">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="34">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="30"/>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </outgoingConnections>
+ </to>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="35">
+ <name>MVELRuleConstraint</name>
+ <constraint>list : List()
+eval( list.contains( 6 ) )</constraint>
+ <priority>6</priority>
+ <dialect>mvel</dialect>
+ <type>rule</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ <entry>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="12"/>
+ <org.drools.ruleflow.core.impl.ConstraintImpl id="36">
+ <name>MVELCodeConstraint</name>
+ <constraint>return inList.contains( 1 );</constraint>
+ <priority>1</priority>
+ <dialect>mvel</dialect>
+ <type>eval</type>
+ </org.drools.ruleflow.core.impl.ConstraintImpl>
+ </entry>
+ </constraints>
+ <id>5</id>
+ <name>Split</name>
+ <incomingConnections id="37">
+ <org.drools.ruleflow.core.impl.ConnectionImpl id="38">
+ <type>1</type>
+ <from class="org.drools.ruleflow.core.impl.StartNodeImpl" id="39">
+ <id>1</id>
+ <name>Start</name>
+ <incomingConnections id="40"/>
+ <outgoingConnections id="41">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="38"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.SplitImpl" reference="13"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="42">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="12"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="15"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="29"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="22"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.ActionNodeImpl" reference="9"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="43">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="8"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.JoinImpl" reference="6"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="20"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="34"/>
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="27"/>
+ </incomingConnections>
+ <outgoingConnections id="44">
+ <org.drools.ruleflow.core.impl.ConnectionImpl reference="5"/>
+ </outgoingConnections>
+ </from>
+ <to class="org.drools.ruleflow.core.impl.EndNodeImpl" reference="3"/>
+ </org.drools.ruleflow.core.impl.ConnectionImpl>
+ </incomingConnections>
+ <outgoingConnections id="45"/>
+ </org.drools.ruleflow.core.impl.EndNodeImpl>
+ </entry>
+ <entry>
+ <long>8</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="30"/>
+ </entry>
+ <entry>
+ <long>9</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="23"/>
+ </entry>
+ <entry>
+ <long>6</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="9"/>
+ </entry>
+ <entry>
+ <long>1</long>
+ <org.drools.ruleflow.core.impl.StartNodeImpl reference="39"/>
+ </entry>
+ <entry>
+ <long>7</long>
+ <org.drools.ruleflow.core.impl.ActionNodeImpl reference="16"/>
+ </entry>
+ <entry>
+ <long>10</long>
+ <org.drools.ruleflow.core.impl.JoinImpl reference="6"/>
+ </entry>
+ <entry>
+ <long>5</long>
+ <org.drools.ruleflow.core.impl.SplitImpl reference="13"/>
+ </entry>
+ </nodes>
+ <variables id="46"/>
+ <lastNodeId>10</lastNodeId>
+ <imports id="47">
+ <string>java.util.List</string>
+ </imports>
+ <globals id="48">
+ <entry>
+ <string>inList</string>
+ <string>List</string>
+ </entry>
+ <entry>
+ <string>outList</string>
+ <string>List</string>
+ </entry>
+ </globals>
+ <id>ConstraintDialects</id>
+ <name>ConstraintDialects</name>
+ <type>RuleFlow</type>
+ <packageName>org.drools.test</packageName>
+</org.drools.ruleflow.core.impl.RuleFlowProcessImpl>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list