[jboss-svn-commits] JBL Code SVN: r31131 - in labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban: drools-compiler/src/main/java/org/drools/guvnor/server/rules and 8 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jan 19 07:17:50 EST 2010


Author: eaa
Date: 2010-01-19 07:17:50 -0500 (Tue, 19 Jan 2010)
New Revision: 31131

Added:
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/ModelField.java
Modified:
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngine.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/util/SuggestionCompletionEngineBuilder.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngineTest.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/modeldriven/dt/GuidedDecisionTableTest.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/server/rules/SuggestionCompletionLoaderTest.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/SuggestionCompletionCache.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/DataInputWidget.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/ScenarioWidget.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/VerifyFactWidget.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/FactTypeBrowser.java
   labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/test/java/org/drools/guvnor/server/PopulateDataTest.java
Log:
SuggestionCompletionEngine refactor:
	factTypes, fieldTypes and FieldForTypes attributes were replaced by a Map<String,ModelField[]>. This new class (ModelField) contains the name, class and type (a typification of class) of a field.

Added: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/ModelField.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/ModelField.java	                        (rev 0)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/ModelField.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -0,0 +1,36 @@
+package org.drools.guvnor.client.modeldriven;
+
+import org.drools.guvnor.client.modeldriven.brl.PortableObject;
+
+public class ModelField implements PortableObject {
+
+    private String name;
+    private String className;
+    /**
+     * parametrized type of clazz
+     */
+    private String type;
+
+    public ModelField() {
+    }
+
+    
+
+    public ModelField(String name, Class clazz, String type) {
+        this.name = name;
+        this.className = clazz.getName();
+        this.type = type;
+    }
+
+    public String getClassName() {
+        return this.className;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getType() {
+        return type;
+    }
+}

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngine.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngine.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngine.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -50,26 +50,8 @@
     /** The top level conditional elements (first order logic) */
     private static final String[]         CONDITIONAL_ELEMENTS   = new String[]{"not", "exists", "or"};
 
+   
     /**
-     * A list of fact types (never fully qualified).
-     */
-    private String[]                     factTypes;
-
-    /**
-     * A map of types to the fields. key is type, value is (String[] of fields)
-     * 
-     */
-    private Map<String, String[]>          fieldsForType;
-
-    /**
-     * A map of the Fields to their types, needed for operator completions, as
-     * well as other things like rendering strings, dates etc. This is in the
-     * format of: { 'Type.field' => 'typename' }. Should not be the exact type,
-     * perhaps just a high level interface, eg "Comparable".
-     * 
-     */
-    private Map<String, String>            fieldTypes;
-    /**
     * A map of the field that containts the parametrized type of a collection
     * List<String> name
     * key = "name"
@@ -169,6 +151,11 @@
 
     private Map<String, List<MethodInfo>> methodInfos            = new HashMap<String, List<MethodInfo>>();
 
+
+    private Map<String,ModelField[]> modelFields = new HashMap<String, ModelField[]>();
+
+
+
     public SuggestionCompletionEngine() {
 
     }
@@ -205,13 +192,13 @@
     
 
     public String[] getFieldCompletions(final String factType) {
-        return  this.getFieldsForType( factType );
+        return  this.getModelFields( factType );
 
     }
 
     public String[] getOperatorCompletions(final String factType,
                                            final String fieldName) {
-        final String type = (String) this.getFieldType( factType + "." + fieldName );
+        final String type = this.getFieldType( factType, fieldName );
         if ( type == null ) {
             return STANDARD_OPERATORS;
         } else if ( type.equals( TYPE_STRING ) ) {
@@ -231,7 +218,7 @@
 
     public String[] getFieldCompletionsForGlobalVariable(final String varName) {
         final String type = (String) this.getGlobalVariable( varName );
-        return (String[]) this.getFieldsForType( type );
+        return (String[]) this.getModelFields(type);
     }
 
     public List<MethodInfo> getMethodInfosForGlobalVariable(final String varName) {
@@ -517,56 +504,7 @@
 
         return methodList;
     }
-
-
     
-
-    /**
-     * A map of the Fields to their types, needed for operator completions, as
-     * well as other things like rendering strings, dates etc. This is in the
-     * format of: { 'Type.field' => 'typename' }. Should not be the exact type,
-     * perhaps just a high level interface, eg "Comparable", "Numeric",
-     * "String".
-     *
-     */
-    public String getFieldType(final String factType,
-                               final String fieldName) {
-        return this.getFieldType( factType + "." + fieldName );
-    }
-
-    public String getFieldType(String fieldName){
-        return this.fieldTypes.get(fieldName);
-    }
-
-    public void setFieldTypes(Map<String,String> fieldTypes){
-        this.fieldTypes = fieldTypes;
-    }
-
-    public void putFieldType(String fieldName, String type){
-        this.fieldTypes.put(fieldName, type);
-    }
-
-
-
-    public void setFactTypes(String[] factTypes) {
-        this.factTypes = factTypes;
-    }
-
-    public String[] getFactTypes() {
-        return this.factTypes;
-    }
-
-
-
-    public String[] getFieldsForType(String type){
-        return this.fieldsForType.get(type);
-    }
-
-    public void setFieldsForType(Map<String,String[]> fieldsForType){
-        this.fieldsForType = fieldsForType;
-    }
-
-
     /*
      * returns the type of parametric class
      * List<String> a in a class called Toto
@@ -651,4 +589,87 @@
         return this.dataEnumLists != null && this.dataEnumLists.size() > 0;
     }
 
+
+    ////
+
+    public void setFactTypes(String[] factTypes) {
+        for (String factType : factTypes) {
+            //adds the fact type with no fields.
+            this.modelFields.put(factType, new ModelField[0]);
+        }
+    }
+
+    public void setFieldsForTypes(Map<String,ModelField[]> fieldsForType){
+        this.modelFields = fieldsForType;
+    }
+
+    /**
+     * Returns all the fact types.
+     * @return
+     */
+    public String[] getFactTypes() {
+        Set<String> keys = this.modelFields.keySet();
+        return keys.toArray(new String[0]);
+    }
+
+    private ModelField getField(String modelClassName, String fieldName){
+        ModelField[] fields = this.modelFields.get(modelClassName);
+
+        if (fields == null){
+            return null;
+        }
+
+        for (ModelField modelField : fields) {
+            if (modelField.getName().equals(fieldName)){
+                return modelField;
+            }
+        }
+
+        return null;
+    }
+
+
+    public String[] getModelFields(String modelClassName){
+        ModelField[] fields = this.modelFields.get(modelClassName);
+        String[] fieldNames = new String[fields.length];
+
+        for (int i=0;i<fields.length; i++) {
+            fieldNames[i] = fields[i].getName();
+        }
+
+        return fieldNames;
+    }
+
+    /**
+     *
+     * @param propertyName of the type class.field
+     * @return
+     */
+    public String getFieldClassName(String propertyName){
+        String[] split = propertyName.split("\\.");
+        if (split.length!=2){
+            throw new IllegalArgumentException("Invalid format '"+propertyName+"'. It must be of type className.propertyName");
+        }
+        return this.getFieldClassName(split[0], split[1]);
+    }
+
+    public String getFieldClassName(String modelClassName, String fieldName){
+        ModelField field = this.getField(modelClassName, fieldName);
+        return field==null?null:field.getClassName();
+    }
+
+    public String getFieldType(String propertyName){
+        String[] split = propertyName.split("\\.");
+        if (split.length!=2){
+            throw new IllegalArgumentException("Invalid format '"+propertyName+"'. It must be of type className.propertyName");
+        }
+        return this.getFieldType(split[0], split[1]);
+    }
+
+    public String getFieldType(String modelClassName, String fieldName){
+        ModelField field = this.getField(modelClassName, fieldName);
+        return field==null?null:field.getType();
+    }
+
+
 }

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -3,13 +3,13 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Method;
-import java.lang.reflect.Type;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -303,7 +303,7 @@
         }
 
         /** now we do the dynamic facts - the declared types */
-        Set<String> declaredTypes = new HashSet<String>();
+        Map<String,Class> declaredTypes = new HashMap<String,Class>();
 
         for (final Iterator<TypeDeclarationDescr> it = pkgDescr.getTypeDeclarations().iterator(); it.hasNext();) {
             TypeDeclarationDescr td = it.next();
@@ -311,7 +311,17 @@
             if (td.getFields().size() > 0) {
                 //add the type to the map
                 String declaredType = td.getTypeName();
-                declaredTypes.add(declaredType);
+                Class clz;
+                try {
+                    clz = resolver.resolveType(declaredType);
+                } catch (ClassNotFoundException ex) {
+                    this.errors.add("Class not found: " + declaredType);
+                    continue;
+                }
+                
+                declaredTypes.put(declaredType,clz);
+
+
                 this.builder.addFactType(declaredType);
                 List<String> fieldNames = new ArrayList<String>();
                 for (Map.Entry<String, TypeFieldDescr> f : td.getFields().entrySet()) {
@@ -320,12 +330,14 @@
                     String fieldClass = f.getValue().getPattern().getObjectType();
 
 
-                    if (declaredTypes.contains(fieldClass)) {
-                        this.builder.addFieldType(declaredType + "." + fieldName, fieldClass);//SuggestionCompletionEngine.TYPE_OBJECT );
+                    if (declaredTypes.containsKey(fieldClass)) {
+                        this.builder.addFieldType(declaredType + "." + fieldName, fieldClass,declaredTypes.get(fieldClass));//SuggestionCompletionEngine.TYPE_OBJECT );
                     } else {
                         try {
-                            Class clz = resolver.resolveType(fieldClass);
-                            this.builder.addFieldType(declaredType + "." + fieldName, getFieldType(clz));
+                            clz = resolver.resolveType(fieldClass);
+                            this.builder.addFieldType(declaredType + "." + fieldName, getFieldType(clz),clz);
+                            
+                            declaredTypes.put(declaredType,clz);
                         } catch (ClassNotFoundException e) {
                             this.errors.add("Class of field not found: " + fieldClass);
                         }
@@ -371,7 +383,7 @@
                     this.errors.add("Fact template field type not found: " + fieldType);
                 }
                 this.builder.addFieldType(factType + "." + fieldDescr.getName(),
-                        getFieldType(fieldTypeClass));
+                        getFieldType(fieldTypeClass),fieldTypeClass);
             }
 
             Arrays.sort(fields);
@@ -441,12 +453,12 @@
 
         // remove this back out because there is no type for it. We add it explicity
         fieldSet.remove("this");
-        this.builder.addFieldType(shortTypeName + ".this", SuggestionCompletionEngine.TYPE_OBJECT);
+        this.builder.addFieldType(shortTypeName + ".this", SuggestionCompletionEngine.TYPE_OBJECT,clazz);
 
         for (String field : fieldSet) {
             final Class type = inspector.getFieldTypes().get(field);
             final String fieldType = getFieldType(type);
-            this.builder.addFieldType(shortTypeName + "." + field, fieldType);
+            this.builder.addFieldType(shortTypeName + "." + field, fieldType,type);
             Field f = inspector.getFieldTypesField().get(field);
             this.builder.addFieldTypeField(shortTypeName + "." + field,f);
         }

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/util/SuggestionCompletionEngineBuilder.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/util/SuggestionCompletionEngineBuilder.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/main/java/org/drools/guvnor/server/util/SuggestionCompletionEngineBuilder.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -13,17 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.drools.guvnor.server.util;
 
 import java.util.*;
 import java.lang.reflect.Field;
 import java.lang.reflect.Type;
 import java.lang.reflect.ParameterizedType;
+import org.drools.guvnor.client.modeldriven.ModelField;
 
 import org.drools.guvnor.client.modeldriven.SuggestionCompletionEngine;
 import org.drools.guvnor.client.modeldriven.brl.DSLSentence;
-import org.drools.lang.dsl.AbstractDSLMappingEntry;
 import org.drools.lang.dsl.DSLMappingEntry;
 
 /**
@@ -33,19 +32,19 @@
  */
 public class SuggestionCompletionEngineBuilder {
 
-    private SuggestionCompletionEngine instance              = new SuggestionCompletionEngine();
-    private List                       factTypes             = new ArrayList();
-    private Map                        fieldsForType         = new HashMap();
-    private Map                        modifiersForType      = new HashMap();
-    private Map                        fieldTypes            = new HashMap();
-    private Map<String,Field>          fieldTypesField       = new HashMap<String,Field>();
-    private Map                        globalTypes           = new HashMap();
-    private List                       actionDSLSentences    = new ArrayList();
-    private List                       conditionDSLSentences = new ArrayList();
-    private List                       keywordDSLItems = new ArrayList();
-    private List                       anyScopeDSLItems = new ArrayList();
-    private List<String>                globalCollections = new ArrayList();
- 
+    private SuggestionCompletionEngine instance = new SuggestionCompletionEngine();
+    private List factTypes = new ArrayList();
+    private Map<String, String[]> fieldsForType = new HashMap<String, String[]>();
+    private Map modifiersForType = new HashMap();
+    private Map<String, String> fieldTypes = new HashMap<String, String>();
+    private Map<String, Class> fieldClasses = new HashMap<String, Class>();
+    private Map<String, Field> fieldTypesField = new HashMap<String, Field>();
+    private Map globalTypes = new HashMap();
+    private List actionDSLSentences = new ArrayList();
+    private List conditionDSLSentences = new ArrayList();
+    private List keywordDSLItems = new ArrayList();
+    private List anyScopeDSLItems = new ArrayList();
+    private List<String> globalCollections = new ArrayList();
 
     public SuggestionCompletionEngineBuilder() {
     }
@@ -56,10 +55,10 @@
     public void newCompletionEngine() {
         this.instance = new SuggestionCompletionEngine();
         this.factTypes = new ArrayList();
-        this.fieldsForType = new HashMap();
+        this.fieldsForType = new HashMap<String, String[]>();
         this.modifiersForType = new HashMap();
-        this.fieldTypes = new HashMap();
-        this.fieldTypesField = new HashMap();
+        this.fieldTypes = new HashMap<String, String>();
+        this.fieldTypesField = new HashMap<String, Field>();
         this.globalTypes = new HashMap();
         this.actionDSLSentences = new ArrayList();
         this.conditionDSLSentences = new ArrayList();
@@ -74,7 +73,7 @@
      * @param factType
      */
     public void addFactType(final String factType) {
-        this.factTypes.add( factType );
+        this.factTypes.add(factType);
     }
 
     /**
@@ -84,9 +83,9 @@
      * @param fields
      */
     public void addFieldsForType(final String type,
-                                 final String[] fields) {
-        this.fieldsForType.put( type,
-                                fields );
+            final String[] fields) {
+        this.fieldsForType.put(type,
+                fields);
     }
 
     /**
@@ -96,40 +95,45 @@
      * @param fields
      */
     public void addModifiersForType(final String type,
-                                 final String[] fields) {
-        this.modifiersForType.put( type,
-                                fields );
+            final String[] fields) {
+        this.modifiersForType.put(type,
+                fields);
     }
 
     /**
      * @return true if this has the type already registered (field information).
      */
     public boolean hasFieldsForType(final String type) {
-        return this.fieldsForType.containsKey( type );
+        return this.fieldsForType.containsKey(type);
     }
 
     /**
      * Adds a type declaration for a field
      *
-     * @param field
-     * @param type
+     * @param field format: class.field
+     * @param type parametrized type of clazz
+     * @param clazz the class of field
      */
     public void addFieldType(final String field,
-                             final String type) {
-        this.fieldTypes.put( field,
-                             type );
+            final String type,
+            final Class clazz) {
+        this.fieldTypes.put(field,
+                type);
+        this.fieldClasses.put(field, clazz);
     }
-      /**
+
+    /**
      * Adds a type declaration for a field
      *
-     * @param field
+     * @param field format: class.field
      * @param type
      */
     public void addFieldTypeField(final String field,
-                             final Field type) {
-        this.fieldTypesField.put( field,
-                             type );
+            final Field type) {
+        this.fieldTypesField.put(field,
+                type);
     }
+
     /**
      * Adds a global and its corresponding type to the engine
      *
@@ -137,9 +141,9 @@
      * @param type
      */
     public void addGlobalType(final String global,
-                              final String type) {
-        this.globalTypes.put( global,
-                              type );
+            final String type) {
+        this.globalTypes.put(global,
+                type);
     }
 
     public void addGlobalCollection(String global) {
@@ -152,7 +156,7 @@
     public void addDSLActionSentence(final String sentence) {
         final DSLSentence sen = new DSLSentence();
         sen.sentence = sentence;
-        this.actionDSLSentences.add( sen );
+        this.actionDSLSentences.add(sen);
     }
 
     /**
@@ -161,7 +165,7 @@
     public void addDSLConditionSentence(final String sentence) {
         final DSLSentence sen = new DSLSentence();
         sen.sentence = sentence;
-        this.conditionDSLSentences.add( sen );
+        this.conditionDSLSentences.add(sen);
     }
 
     /**
@@ -171,13 +175,32 @@
      * @return
      */
     public SuggestionCompletionEngine getInstance() {
-        this.instance.setFactTypes((String[]) this.factTypes.toArray( new String[this.factTypes.size()] ));
-        this.instance.setFieldsForType(this.fieldsForType);
+        this.instance.setFactTypes((String[]) this.factTypes.toArray(new String[this.factTypes.size()]));
         this.instance.setModifiers(this.modifiersForType);
-        this.instance.setFieldTypes(this.fieldTypes);
-        for (String fieldName  : this.fieldTypesField.keySet()){
-            Field field =  (Field) this.fieldTypesField.get(fieldName);
-            if (field != null){
+
+
+        //convert this.fieldsForType, this.fieldClasses and this.fieldTypes into Map<String,ModelField[]>.
+        Map<String, ModelField[]> modelMap = new HashMap<String, ModelField[]>();
+        for (Map.Entry<String, String[]> typeEntry : this.fieldsForType.entrySet()) {
+            
+            List<ModelField> fields = new ArrayList<ModelField>();
+            for (String field : typeEntry.getValue()) {
+                String fieldName = field;
+                String fieldType = this.fieldTypes.get(typeEntry.getKey() + "." + field);
+                Class fieldClazz = this.fieldClasses.get(typeEntry.getKey() + "." + field);
+
+                fields.add(new ModelField(
+                        fieldName, fieldClazz, fieldType));
+            }
+
+            modelMap.put(typeEntry.getKey(), fields.toArray(new ModelField[0]));
+        }
+
+        this.instance.setFieldsForTypes(modelMap);
+
+        for (String fieldName : this.fieldTypesField.keySet()) {
+            Field field = (Field) this.fieldTypesField.get(fieldName);
+            if (field != null) {
                 Type type = field.getGenericType();
                 if (type instanceof ParameterizedType) {
                     ParameterizedType pt = (ParameterizedType) type;
@@ -192,13 +215,13 @@
                 }
 
                 Class<?> fieldClass = field.getType();
-                if(fieldClass.isEnum()) {
+                if (fieldClass.isEnum()) {
                     Field[] flds = fieldClass.getDeclaredFields();
                     List<String> listEnum = new ArrayList<String>();
-                    int i=0;
+                    int i = 0;
                     for (Field f : flds) {
-                        if(f.isEnumConstant()) {
-                            listEnum.add(i+ "="+f.getName());
+                        if (f.isEnumConstant()) {
+                            listEnum.add(i + "=" + f.getName());
                             i++;
                         }
                     }
@@ -222,25 +245,22 @@
         return this.instance;
     }
 
-	private DSLSentence[] makeArray(List ls) {
-        return (DSLSentence[]) ls.toArray( new DSLSentence[ls.size()] );
+    private DSLSentence[] makeArray(List ls) {
+        return (DSLSentence[]) ls.toArray(new DSLSentence[ls.size()]);
     }
 
-	public void addDSLMapping(DSLMappingEntry entry) {
-		DSLSentence sen = new DSLSentence();
-		sen.sentence = entry.getMappingKey();
-		if (entry.getSection() == DSLMappingEntry.CONDITION) {
-			this.conditionDSLSentences.add(sen);
-		} else if (entry.getSection() == DSLMappingEntry.CONSEQUENCE) {
-			this.actionDSLSentences.add(sen);
-		} else if (entry.getSection() == DSLMappingEntry.KEYWORD) {
-			this.keywordDSLItems.add(sen);
-		} else if (entry.getSection() == DSLMappingEntry.ANY) {
-			this.anyScopeDSLItems.add(sen);
-		}
+    public void addDSLMapping(DSLMappingEntry entry) {
+        DSLSentence sen = new DSLSentence();
+        sen.sentence = entry.getMappingKey();
+        if (entry.getSection() == DSLMappingEntry.CONDITION) {
+            this.conditionDSLSentences.add(sen);
+        } else if (entry.getSection() == DSLMappingEntry.CONSEQUENCE) {
+            this.actionDSLSentences.add(sen);
+        } else if (entry.getSection() == DSLMappingEntry.KEYWORD) {
+            this.keywordDSLItems.add(sen);
+        } else if (entry.getSection() == DSLMappingEntry.ANY) {
+            this.anyScopeDSLItems.add(sen);
+        }
 
-	}
-
-
-
+    }
 }

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngineTest.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngineTest.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/client/modeldriven/SuggestionCompletionEngineTest.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -154,28 +154,24 @@
         final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
 
         com.setFactTypes(new String[]{"Person", "Vehicle"});
-        com.setFieldsForType(new HashMap() {
+        
+        com.setFieldsForTypes(new HashMap<String,ModelField[]>() {
             {
                 put( "Person",
-                     new String[]{"age", "name", "rank"} );
+                     new ModelField[]{
+                        new ModelField("age", Integer.class, "Numeric"),
+                        new ModelField("rank", Integer.class, "Comparable"),
+                        new ModelField("name", String.class, "String")
+                } );
+
                 put( "Vehicle",
-                     new String[]{"type", "make"} );
+                     new ModelField[]{
+                        new ModelField("make", String.class, "String"),
+                        new ModelField("type", String.class, "String")
+                } );
             }
         });
-        com.setFieldTypes(new HashMap() {
-            {
-                put( "Person.age",
-                     "Numeric" );
-                put( "Person.rank",
-                     "Comparable" );
-                put( "Person.name",
-                     "String" );
-                put( "Vehicle.make",
-                     "String" );
-                put( "Vehicle.type",
-                     "String" );
-            }
-        });
+
         com.setGlobalVariables(new HashMap() {
             {
                 put( "bar",
@@ -204,14 +200,16 @@
         c = com.getFieldCompletions( "Person" );
         assertEquals( "age",
                       c[0] );
+        assertEquals( "rank",
+                      c[1] );
         assertEquals( "name",
-                      c[1] );
+                      c[2] );
 
         c = com.getFieldCompletions( "Vehicle" );
         assertEquals( "type",
+                      c[1] );
+        assertEquals( "make",
                       c[0] );
-        assertEquals( "make",
-                      c[1] );
 
         c = com.getOperatorCompletions( "Person",
                                         "name" );
@@ -270,15 +268,17 @@
                       c.length );
         assertEquals( "age",
                       c[0] );
+        assertEquals( "rank",
+                      c[1] );
         assertEquals( "name",
-                      c[1] );
+                      c[2] );
 
         c = com.getFieldCompletionsForGlobalVariable( "baz" );
         assertEquals( 2,
                       c.length );
+        assertEquals( "make",
+                      c[0] );
         assertEquals( "type",
-                      c[0] );
-        assertEquals( "make",
                       c[1] );
 
         //check that it has default operators for general objects
@@ -296,10 +296,12 @@
     public void testAdd() {
         final SuggestionCompletionEngine com = new SuggestionCompletionEngine();
         com.setFactTypes(new String[]{"Foo"});
-        com.setFieldsForType(new HashMap() {
+        com.setFieldsForTypes(new HashMap<String,ModelField[]>() {
             {
                 put( "Foo",
-                     new String[]{"a"} );
+                     new ModelField[]{
+                        new ModelField("a", String.class, "String")
+                });
             }
         });
 
@@ -662,10 +664,12 @@
             }
         });
 
-        com.setFieldsForType(new HashMap() {
+        com.setFieldsForTypes(new HashMap<String,ModelField[]>() {
             {
                 put( "Foo",
-                     new String[]{"a"} );
+                     new ModelField[]{
+                        new ModelField("a", String.class, "String")
+                });
             }
         });
 

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/modeldriven/dt/GuidedDecisionTableTest.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/modeldriven/dt/GuidedDecisionTableTest.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/modeldriven/dt/GuidedDecisionTableTest.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -3,6 +3,7 @@
 import java.util.HashMap;
 
 import junit.framework.TestCase;
+import org.drools.guvnor.client.modeldriven.ModelField;
 
 import org.drools.guvnor.client.modeldriven.SuggestionCompletionEngine;
 import org.drools.guvnor.client.modeldriven.brl.ISingleFieldConstraint;
@@ -71,257 +72,267 @@
 //
 //
 //	}
+    public void testValueLists() {
+        GuidedDecisionTable dt = new GuidedDecisionTable();
 
-	public void testValueLists() {
-		GuidedDecisionTable dt = new GuidedDecisionTable();
+        //add cols for LHS
+        ConditionCol c1 = new ConditionCol();
+        c1.boundName = "c1";
+        c1.factType = "Driver";
+        c1.factField = "name";
+        c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c1);
 
-		//add cols for LHS
-		ConditionCol c1 = new ConditionCol();
-		c1.boundName = "c1";
-		c1.factType = "Driver";
-		c1.factField = "name";
-		c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c1);
+        ConditionCol c1_ = new ConditionCol();
+        c1_.boundName = "c1";
+        c1_.factType = "Driver";
+        c1_.factField = "name";
+        c1_.constraintValueType = ISingleFieldConstraint.TYPE_RET_VALUE;
 
-		ConditionCol c1_ = new ConditionCol();
-		c1_.boundName = "c1";
-		c1_.factType = "Driver";
-		c1_.factField = "name";
-		c1_.constraintValueType = ISingleFieldConstraint.TYPE_RET_VALUE;
+        dt.conditionCols.add(c1_);
 
-		dt.conditionCols.add(c1_);
+        ConditionCol c1__ = new ConditionCol();
+        c1__.boundName = "c1";
+        c1__.factType = "Driver";
+        c1__.factField = "name";
+        c1__.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        c1__.valueList = "one,two,three";
+        dt.conditionCols.add(c1__);
 
-		ConditionCol c1__ = new ConditionCol();
-		c1__.boundName = "c1";
-		c1__.factType = "Driver";
-		c1__.factField = "name";
-		c1__.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		c1__.valueList = "one,two,three";
-		dt.conditionCols.add(c1__);
+        ConditionCol c2 = new ConditionCol();
+        c2.boundName = "c2";
+        c2.factType = "Driver";
+        c2.factField = "nothing";
+        c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c2);
 
-		ConditionCol c2 = new ConditionCol();
-		c2.boundName = "c2";
-		c2.factType = "Driver";
-		c2.factField = "nothing";
-		c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c2);
 
+        ActionSetFieldCol asf = new ActionSetFieldCol();
+        asf.boundName = "c1";
+        asf.factField = "name";
+        dt.actionCols.add(asf);
 
-		ActionSetFieldCol asf = new ActionSetFieldCol();
-		asf.boundName = "c1";
-		asf.factField = "name";
-		dt.actionCols.add(asf);
+        ActionInsertFactCol ins = new ActionInsertFactCol();
+        ins.boundName = "x";
+        ins.factField = "rating";
+        ins.factType = "Person";
+        dt.actionCols.add(ins);
 
-		ActionInsertFactCol ins = new ActionInsertFactCol();
-		ins.boundName = "x";
-		ins.factField = "rating";
-		ins.factType = "Person";
-		dt.actionCols.add(ins);
+        ActionInsertFactCol ins_ = new ActionInsertFactCol();
+        ins_.boundName = "x";
+        ins_.factField = "rating";
+        ins_.factType = "Person";
+        ins_.valueList = "one,two,three";
+        dt.actionCols.add(ins_);
 
-		ActionInsertFactCol ins_ = new ActionInsertFactCol();
-		ins_.boundName = "x";
-		ins_.factField = "rating";
-		ins_.factType = "Person";
-		ins_.valueList = "one,two,three";
-		dt.actionCols.add(ins_);
+        ActionSetFieldCol asf_ = new ActionSetFieldCol();
+        asf_.boundName = "c1";
+        asf_.factField = "goo";
+        dt.actionCols.add(asf_);
 
-		ActionSetFieldCol asf_ = new ActionSetFieldCol();
-		asf_.boundName = "c1";
-		asf_.factField = "goo";
-		dt.actionCols.add(asf_);
+        ActionSetFieldCol asf__ = new ActionSetFieldCol();
+        asf__.boundName = "c1";
+        asf__.factField = "goo";
+        asf__.valueList = "one,two,three";
+        dt.actionCols.add(asf__);
 
-		ActionSetFieldCol asf__ = new ActionSetFieldCol();
-		asf__.boundName = "c1";
-		asf__.factField = "goo";
-		asf__.valueList = "one,two,three";
-		dt.actionCols.add(asf__);
 
+        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
+        sce.putDataEnumList("Driver.name", new String[]{"bob", "michael"});
+        sce.putDataEnumList("Person.rating", new String[]{"1", "2"});
 
-		SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
-		sce.putDataEnumList("Driver.name", new String[] {"bob", "michael"});
-		sce.putDataEnumList("Person.rating", new String[] {"1", "2"});
 
 
 
+        String[] r = dt.getValueList(c1, sce);
+        assertEquals(2, r.length);
+        assertEquals("bob", r[0]);
+        assertEquals("michael", r[1]);
 
-		String[] r = dt.getValueList(c1, sce);
-		assertEquals(2, r.length);
-		assertEquals("bob", r[0]);
-		assertEquals("michael", r[1]);
+        assertEquals(0, dt.getValueList(c1_, sce).length);
 
-		assertEquals(0, dt.getValueList(c1_, sce).length);
+        r = dt.getValueList(c1__, sce);
+        assertEquals(3, r.length);
+        assertEquals("one", r[0]);
+        assertEquals("two", r[1]);
+        assertEquals("three", r[2]);
 
-		r = dt.getValueList(c1__, sce);
-		assertEquals(3, r.length);
-		assertEquals("one", r[0]);
-		assertEquals("two", r[1]);
-		assertEquals("three", r[2]);
+        assertEquals(0, dt.getValueList(c2, sce).length);
 
-		assertEquals(0, dt.getValueList(c2, sce).length);
+        r = dt.getValueList(asf, sce);
+        assertEquals(2, r.length);
+        assertEquals("bob", r[0]);
+        assertEquals("michael", r[1]);
 
-		r = dt.getValueList(asf, sce);
-		assertEquals(2, r.length);
-		assertEquals("bob", r[0]);
-		assertEquals("michael", r[1]);
+        r = dt.getValueList(ins, sce);
+        assertEquals(2, r.length);
+        assertEquals("1", r[0]);
+        assertEquals("2", r[1]);
 
-		r = dt.getValueList(ins, sce);
-		assertEquals(2, r.length);
-		assertEquals("1", r[0]);
-		assertEquals("2", r[1]);
+        r = dt.getValueList(ins_, sce);
+        assertEquals(3, r.length);
+        assertEquals("one", r[0]);
+        assertEquals("two", r[1]);
+        assertEquals("three", r[2]);
 
-		r = dt.getValueList(ins_, sce);
-		assertEquals(3, r.length);
-		assertEquals("one", r[0]);
-		assertEquals("two", r[1]);
-		assertEquals("three", r[2]);
+        assertEquals(0, dt.getValueList(asf_, sce).length);
 
-		assertEquals(0, dt.getValueList(asf_, sce).length);
 
+        r = dt.getValueList(asf__, sce);
+        assertEquals(3, r.length);
+        assertEquals("one", r[0]);
+        assertEquals("two", r[1]);
+        assertEquals("three", r[2]);
 
-		r = dt.getValueList(asf__, sce);
-		assertEquals(3, r.length);
-		assertEquals("one", r[0]);
-		assertEquals("two", r[1]);
-		assertEquals("three", r[2]);
+        AttributeCol at = new AttributeCol();
+        at.attr = "no-loop";
+        dt.attributeCols.add(at);
 
-		AttributeCol at = new AttributeCol();
-		at.attr = "no-loop";
-		dt.attributeCols.add(at);
+        r = dt.getValueList(at, sce);
+        assertEquals(2, r.length);
+        assertEquals("true", r[0]);
+        assertEquals("false", r[1]);
 
-		r = dt.getValueList(at, sce);
-		assertEquals(2, r.length);
-		assertEquals("true", r[0]);
-		assertEquals("false", r[1]);
+        at.attr = "enabled";
+        assertEquals(2, dt.getValueList(at, sce).length);
 
-		at.attr = "enabled";
-		assertEquals(2, dt.getValueList(at, sce).length);
+        at.attr = "salience";
+        assertEquals(0, dt.getValueList(at, sce).length);
 
-		at.attr = "salience";
-		assertEquals(0, dt.getValueList(at, sce).length);
+    }
 
-	}
+    public void testNumeric() {
+        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
 
+        sce.setFieldsForTypes(new HashMap<String, ModelField[]>() {
+            {
+                put("Driver",
+                        new ModelField[]{
+                            new ModelField("age", Integer.class, SuggestionCompletionEngine.TYPE_NUMERIC),
+                            new ModelField("name", String.class, SuggestionCompletionEngine.TYPE_STRING)
+                        });
+            }
+        });
 
-	public void testNumeric() {
-		SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
-                sce.setFieldTypes(new HashMap());
-		sce.putFieldType("Driver.age", SuggestionCompletionEngine.TYPE_NUMERIC);
-		sce.putFieldType("Driver.name", SuggestionCompletionEngine.TYPE_STRING);
+        GuidedDecisionTable dt = new GuidedDecisionTable();
 
-		GuidedDecisionTable dt = new GuidedDecisionTable();
+        AttributeCol at = new AttributeCol();
+        at.attr = "salience";
+        AttributeCol at_ = new AttributeCol();
+        at_.attr = "enabled";
 
-		AttributeCol at = new AttributeCol();
-		at.attr = "salience";
-		AttributeCol at_ = new AttributeCol();
-		at_.attr = "enabled";
+        dt.attributeCols.add(at);
+        dt.attributeCols.add(at_);
 
-		dt.attributeCols.add(at);
-		dt.attributeCols.add(at_);
+        ConditionCol c1 = new ConditionCol();
+        c1.boundName = "c1";
+        c1.factType = "Driver";
+        c1.factField = "name";
+        c1.operator = "==";
+        c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c1);
 
-		ConditionCol c1 = new ConditionCol();
-		c1.boundName = "c1";
-		c1.factType = "Driver";
-		c1.factField = "name";
-		c1.operator = "==";
-		c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c1);
+        ConditionCol c1_ = new ConditionCol();
+        c1_.boundName = "c1";
+        c1_.factType = "Driver";
+        c1_.factField = "age";
+        c1_.operator = "==";
+        c1_.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c1_);
 
-		ConditionCol c1_ = new ConditionCol();
-		c1_.boundName = "c1";
-		c1_.factType = "Driver";
-		c1_.factField = "age";
-		c1_.operator = "==";
-		c1_.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c1_);
+        ConditionCol c2 = new ConditionCol();
+        c2.boundName = "c1";
+        c2.factType = "Driver";
+        c2.factField = "age";
+        c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c2);
 
-		ConditionCol c2 = new ConditionCol();
-		c2.boundName = "c1";
-		c2.factType = "Driver";
-		c2.factField = "age";
-		c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c2);
+        ActionSetFieldCol a = new ActionSetFieldCol();
+        a.boundName = "c1";
+        a.factField = "name";
+        dt.actionCols.add(a);
 
-		ActionSetFieldCol a = new ActionSetFieldCol();
-		a.boundName = "c1";
-		a.factField = "name";
-		dt.actionCols.add(a);
+        ActionSetFieldCol a2 = new ActionSetFieldCol();
+        a2.boundName = "c1";
+        a2.factField = "age";
+        dt.actionCols.add(a2);
 
-		ActionSetFieldCol a2 = new ActionSetFieldCol();
-		a2.boundName = "c1";
-		a2.factField = "age";
-		dt.actionCols.add(a2);
+        ActionInsertFactCol ins = new ActionInsertFactCol();
+        ins.boundName = "x";
+        ins.factType = "Driver";
+        ins.factField = "name";
+        dt.actionCols.add(ins);
 
-		ActionInsertFactCol ins = new ActionInsertFactCol();
-		ins.boundName = "x";
-		ins.factType = "Driver";
-		ins.factField = "name";
-		dt.actionCols.add(ins);
+        ActionInsertFactCol ins_ = new ActionInsertFactCol();
+        ins_.boundName = "x";
+        ins_.factType = "Driver";
+        ins_.factField = "age";
+        dt.actionCols.add(ins_);
 
-		ActionInsertFactCol ins_ = new ActionInsertFactCol();
-		ins_.boundName = "x";
-		ins_.factType = "Driver";
-		ins_.factField = "age";
-		dt.actionCols.add(ins_);
+        assertTrue(dt.isNumeric(at, sce));
+        assertFalse(dt.isNumeric(at_, sce));
+        assertFalse(dt.isNumeric(c1, sce));
+        assertTrue(dt.isNumeric(c1_, sce));
+        assertFalse(dt.isNumeric(a, sce));
+        assertTrue(dt.isNumeric(a2, sce));
+        assertFalse(dt.isNumeric(ins, sce));
+        assertTrue(dt.isNumeric(ins_, sce));
+        assertFalse(dt.isNumeric(c2, sce));
 
-		assertTrue(dt.isNumeric(at, sce));
-		assertFalse(dt.isNumeric(at_, sce));
-		assertFalse(dt.isNumeric(c1, sce));
-		assertTrue(dt.isNumeric(c1_, sce));
-		assertFalse(dt.isNumeric(a, sce));
-		assertTrue(dt.isNumeric(a2, sce));
-		assertFalse(dt.isNumeric(ins, sce));
-		assertTrue(dt.isNumeric(ins_, sce));
-		assertFalse(dt.isNumeric(c2, sce));
 
 
+    }
 
-	}
+    public void testNoConstraintLists() {
+        GuidedDecisionTable dt = new GuidedDecisionTable();
 
-	public void testNoConstraintLists() {
-		GuidedDecisionTable dt = new GuidedDecisionTable();
+        //add cols for LHS
+        ConditionCol c1 = new ConditionCol();
+        c1.boundName = "c1";
+        c1.factType = "Driver";
+        c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c1);
 
-		//add cols for LHS
-		ConditionCol c1 = new ConditionCol();
-		c1.boundName = "c1";
-		c1.factType = "Driver";
-		c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c1);
+        ConditionCol c2 = new ConditionCol();
+        c2.boundName = "c2";
+        c2.factType = "Driver";
+        c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        c2.valueList = "a,b,c";
+        dt.conditionCols.add(c2);
 
-		ConditionCol c2 = new ConditionCol();
-		c2.boundName = "c2";
-		c2.factType = "Driver";
-		c2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		c2.valueList = "a,b,c";
-		dt.conditionCols.add(c2);
 
+        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
+        sce.putDataEnumList("Driver.name", new String[]{"bob", "michael"});
 
-		SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
-		sce.putDataEnumList("Driver.name", new String[] {"bob", "michael"});
+        assertEquals(0, dt.getValueList(c1, sce).length);
+        assertEquals(3, dt.getValueList(c2, sce).length);
 
-		assertEquals(0, dt.getValueList(c1, sce).length);
-		assertEquals(3, dt.getValueList(c2, sce).length);
 
+    }
 
-	}
+    public void testNoConstraintsNumeric() {
+        GuidedDecisionTable dt = new GuidedDecisionTable();
 
-	public void testNoConstraintsNumeric() {
-		GuidedDecisionTable dt = new GuidedDecisionTable();
+        //add cols for LHS
+        ConditionCol c1 = new ConditionCol();
+        c1.boundName = "c1";
+        c1.factType = "Driver";
+        c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+        dt.conditionCols.add(c1);
 
-		//add cols for LHS
-		ConditionCol c1 = new ConditionCol();
-		c1.boundName = "c1";
-		c1.factType = "Driver";
-		c1.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
-		dt.conditionCols.add(c1);
+        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
 
-		SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
-		sce.setFieldTypes(new HashMap());
-		sce.putFieldType("Driver.age", SuggestionCompletionEngine.TYPE_NUMERIC);
-		sce.putFieldType("Driver.name", SuggestionCompletionEngine.TYPE_STRING);
+        sce.setFieldsForTypes(new HashMap<String, ModelField[]>() {
+            {
+                put("Driver",
+                        new ModelField[]{
+                            new ModelField("age", Integer.class, SuggestionCompletionEngine.TYPE_NUMERIC),
+                            new ModelField("name", String.class, SuggestionCompletionEngine.TYPE_STRING)
+                        });
+            }
+        });
 
-		assertFalse(dt.isNumeric(c1, sce));
+        assertFalse(dt.isNumeric(c1, sce));
 
-	}
-
-
+    }
 }

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/server/rules/SuggestionCompletionLoaderTest.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/server/rules/SuggestionCompletionLoaderTest.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-compiler/src/test/java/org/drools/guvnor/server/rules/SuggestionCompletionLoaderTest.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -76,7 +76,7 @@
         assertEquals(1, eng.getGlobalVariables().length);
         assertEquals("p", eng.getGlobalVariables()[0]);
         assertEquals("Person", eng.getGlobalVariable("p"));
-        String[] flds = (String[]) eng.getFieldsForType("Person");
+        String[] flds = (String[]) eng.getModelFields("Person");
         assertNotNull(flds);
 
         assertEquals(0, eng.getGlobalCollections().length);

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/SuggestionCompletionCache.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/SuggestionCompletionCache.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/packages/SuggestionCompletionCache.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -94,6 +94,7 @@
 
 
     public void loadPackage(final String packageName, final Command command) {
+
         LoadingPopup.showMessage(Format.format(constants.InitialisingInfoFor0PleaseWait(), packageName));
         RepositoryServiceFactory.getService().loadSuggestionCompletionEngine( packageName, new GenericCallback<SuggestionCompletionEngine>() {
             public void onSuccess(SuggestionCompletionEngine engine) {

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/DataInputWidget.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/DataInputWidget.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/DataInputWidget.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -104,7 +104,7 @@
 					}
 
 				}
-				String[] fields = (String[]) sce.getFieldsForType(type);
+				String[] fields = (String[]) sce.getModelFields(type);
 				final FormStylePopup pop = new FormStylePopup(); //NON-NLS
                 pop.setTitle(constants.ChooseDotDotDot());
 				final ListBox b = new ListBox();

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/ScenarioWidget.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/ScenarioWidget.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/ScenarioWidget.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -3,26 +3,18 @@
 import java.util.*;
 
 import org.drools.guvnor.client.common.*;
-import org.drools.guvnor.client.modeldriven.DropDownData;
 import org.drools.guvnor.client.modeldriven.SuggestionCompletionEngine;
 import org.drools.guvnor.client.modeldriven.testing.ActivateRuleFlowGroup;
 import org.drools.guvnor.client.modeldriven.testing.ExecutionTrace;
 import org.drools.guvnor.client.modeldriven.testing.FactData;
-import org.drools.guvnor.client.modeldriven.testing.FieldData;
 import org.drools.guvnor.client.modeldriven.testing.Fixture;
 import org.drools.guvnor.client.modeldriven.testing.RetractFact;
 import org.drools.guvnor.client.modeldriven.testing.Scenario;
 import org.drools.guvnor.client.modeldriven.testing.VerifyFact;
-import org.drools.guvnor.client.modeldriven.testing.VerifyField;
 import org.drools.guvnor.client.modeldriven.testing.VerifyRuleFired;
-import org.drools.guvnor.client.modeldriven.ui.ActionValueEditor;
-import org.drools.guvnor.client.modeldriven.ui.ConstraintValueEditor;
 import org.drools.guvnor.client.packages.SuggestionCompletionCache;
-import org.drools.guvnor.client.rpc.BuilderResult;
 import org.drools.guvnor.client.rpc.RepositoryServiceFactory;
 import org.drools.guvnor.client.rpc.RuleAsset;
-import org.drools.guvnor.client.rpc.ScenarioRunResult;
-import org.drools.guvnor.client.rpc.SingleScenarioResult;
 import org.drools.guvnor.client.ruleeditor.RuleViewer;
 import org.drools.guvnor.client.messages.Constants;
 
@@ -34,17 +26,12 @@
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Composite;
 import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.Grid;
 import com.google.gwt.user.client.ui.HTML;
 import com.google.gwt.user.client.ui.HasHorizontalAlignment;
-import com.google.gwt.user.client.ui.HasVerticalAlignment;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.KeyboardListener;
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
 import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/VerifyFactWidget.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/VerifyFactWidget.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/qa/VerifyFactWidget.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -52,7 +52,7 @@
         Image add = new ImageButton("images/add_field_to_fact.gif", constants.AddAFieldToThisExpectation(), new ClickListener() { //NON-NLS
 			public void onClick(Widget w) {
 
-				String[] fields = (String[]) sce.getFieldsForType(type);
+				String[] fields = (String[]) sce.getModelFields(type);
 				final FormStylePopup pop = new FormStylePopup("images/rule_asset.gif", constants.ChooseAFieldToAdd()); //NON-NLS
 				final ListBox b = new ListBox();
 				for (int i = 0; i < fields.length; i++) {

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/FactTypeBrowser.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/FactTypeBrowser.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/FactTypeBrowser.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -35,7 +35,7 @@
 				it.setUserObject(type + "( )");
 				tree.addItem(it);
 
-				String[] fields = (String[]) sce.getFieldsForType(type);
+				String[] fields = (String[]) sce.getModelFields(type);
 				if (fields != null) {
 					for (String field : fields) {
 						TreeItem fi = new TreeItem();

Modified: labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/test/java/org/drools/guvnor/server/PopulateDataTest.java
===================================================================
--- labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/test/java/org/drools/guvnor/server/PopulateDataTest.java	2010-01-19 06:56:51 UTC (rev 31130)
+++ labs/jbossrules/branches/guvnor_expressionEditor2_baunax_esteban/drools-guvnor/src/test/java/org/drools/guvnor/server/PopulateDataTest.java	2010-01-19 12:17:50 UTC (rev 31131)
@@ -110,7 +110,7 @@
         assertNotNull(eng);
 
         assertEquals(2, eng.getFactTypes().length);
-        String[] fields = (String[]) eng.getFieldsForType( "Board" );
+        String[] fields = (String[]) eng.getModelFields( "Board" );
         assertTrue(fields.length >= 3);
 
         String[] globalVars = eng.getGlobalVariables();
@@ -118,7 +118,7 @@
         assertEquals("prs", globalVars[0]);
         assertTrue(eng.getFieldCompletionsForGlobalVariable( "prs" ).length >= 2);
 
-        fields = (String[]) eng.getFieldsForType( "Person" );
+        fields = (String[]) eng.getModelFields( "Person" );
 
         assertTrue(fields.length >= 2);
 



More information about the jboss-svn-commits mailing list