[jboss-svn-commits] JBL Code SVN: r32555 - labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/guvnor/server/rules.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Apr 13 11:43:15 EDT 2010
Author: baunax
Date: 2010-04-13 11:43:14 -0400 (Tue, 13 Apr 2010)
New Revision: 32555
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java
Log:
GUVNOR-527 Add the ability of creating Business Rules Templates using drools-templates
- Added collections classes to appear as facts so they can be used on From, From Accumulate and From Collect
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java 2010-04-13 15:42:41 UTC (rev 32554)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/guvnor/server/rules/SuggestionCompletionLoader.java 2010-04-13 15:43:14 UTC (rev 32555)
@@ -147,12 +147,11 @@
SuggestionCompletionEngine sce = this.builder.getInstance();
- populateDateEnums( dataEnums,
- sce );
+ populateDateEnums( dataEnums, sce );
return sce;
}
-
+
private void populateDateEnums(List<String> dataEnums,
SuggestionCompletionEngine sce) {
for ( Iterator<String> iter = dataEnums.iterator(); iter.hasNext(); ) {
@@ -287,8 +286,13 @@
*/
private void populateModelInfo(final PackageDescr pkgDescr,
final List jars) {
- for ( final Iterator it = pkgDescr.getImports().iterator(); it.hasNext(); ) {
- final ImportDescr imp = (ImportDescr) it.next();
+ List<ImportDescr> imports = new ArrayList<ImportDescr>(pkgDescr.getImports());
+ imports.add(new ImportDescr("java.util.Set"));
+ imports.add(new ImportDescr("java.util.List"));
+ imports.add(new ImportDescr("java.util.Collection"));
+ imports.add(new ImportDescr("java.lang.Number"));
+
+ for (ImportDescr imp : imports) {
final String className = imp.getTarget();
if ( className.endsWith( "*" ) ) {
this.errors.add( "Unable to introspect model for wild card imports (" + className + "). Please explicitly import each fact type you require." );
@@ -306,8 +310,9 @@
} catch ( final IOException e ) {
this.errors.add( "Error while inspecting the class: " + className + ". The error was: " + e.getMessage() );
} catch ( NoClassDefFoundError e ) {
- this.errors.add( "Unable to find the class: " + e.getMessage().replace( '/',
- '.' ) + " which is required by: " + className + ". You may need to add more classes to the model." );
+ this.errors.add("Unable to find the class: " + e.getMessage().replace('/', '.')
+ + " which is required by: " + className
+ + ". You may need to add more classes to the model.");
}
}
}
@@ -442,7 +447,7 @@
Set<String> fieldSet = new TreeSet<String>();
fieldSet.addAll( inspector.getFieldNames().keySet() );
// add the "this" field. This won't come out from the inspector
- fieldSet.add( "this" );
+ fieldSet.add("this");
this.builder.addFieldsForType( shortTypeName,
removeIrrelevantFields( fieldSet ) );
@@ -526,7 +531,7 @@
this.builder.getInstance().addMethodInfo( shortTypeName,
methodInfos );
}
-
+
String getShortNameOfClass(final String clazz) {
return clazz.substring( clazz.lastIndexOf( '.' ) + 1 );
}
More information about the jboss-svn-commits
mailing list