return c.valueList.split(","); } else { String[] r = sce.getEnumValues(c.factType, c.factField); return (r != null) ? r : new String[0]; return c.valueList.split(","); } else { String[] r = sce.getEnumValues(getBoundFactType(c.boundName), c.factField); return (r != null) ? r : new String[0]; return c.valueList.split(","); } else { String[] r = sce.getEnumValues(c.factType, c.factField); return (r != null) ? r : new String[0];
return c.valueList.split(","); } else { String[] r = sce.getEnumValues(c.factType, c.factField); return (r != null) ? r : new String[0]; return c.valueList.split(","); } else { String[] r = sce.getEnumValues(getBoundFactType(c.boundName), c.factField); return (r != null) ? r : new String[0]; return c.valueList.split(","); } else { String[] r = sce.getEnumValues(c.factType, c.factField); return (r != null) ? r : new String[0];
return DropDownData.create( getEnumValues( type, field ) );
return DropDownData.create( getEnumValues( type, field ) );
@Test public void testSimpleEnums() { final SuggestionCompletionEngine sce = new SuggestionCompletionEngine(); sce.setDataEnumLists( new HashMap<String, String[]>() ); sce.putDataEnumList( "Fact.type", new String[]{"sex", "colour"} ); assertEquals( 2, sce.getEnumValues( "Fact", "type" ).length ); assertEquals( "sex", sce.getEnumValues( "Fact", "type" )[0] ); assertEquals( "colour", sce.getEnumValues( "Fact", "type" )[1] ); }
@Test public void testNestedEnumsFieldLookup() { String pkg = "package org.test\n import org.drools.ide.common.client.modeldriven.SuggestionCompletionEngineTest.NestedEnum"; SuggestionCompletionLoader loader = new SuggestionCompletionLoader(); SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg, new ArrayList<JarInputStream>(), new ArrayList<DSLTokenizedMappingFile>(), new ArrayList<String>() ); assertEquals( "Comparable", engine.getFieldType( "NestedEnum", "myEnum" ) ); String[] data = engine.getEnumValues( "NestedEnum", "myEnum" ); assertNotNull( data ); assertEquals( 2, data.length ); assertEquals( "MyEnum.VALUE1=MyEnum.VALUE1", data[0] ); assertEquals( "MyEnum.VALUE2=MyEnum.VALUE2", data[1] ); }