public boolean hasEnums(String factType, String field) { return this.hasEnums( factType + "." + field ); }
public boolean hasEnums(String factType, String field) { return this.hasEnums( factType + "." + field ); }
private String getTypeFromSCE(String factType, String fieldName, SuggestionCompletionEngine sce) { // Columns with enumerations are always Text (for now) if ( sce.hasEnums( factType, fieldName ) ) { return SuggestionCompletionEngine.TYPE_STRING; } //Otherwise lookup from SuggestionCompletionEngine String type = sce.getFieldType( factType, fieldName ); return type; }
private String getTypeFromSCE(String factType, String fieldName, SuggestionCompletionEngine sce) { // Columns with enumerations are always Text (for now) if ( sce.hasEnums( factType, fieldName ) ) { return SuggestionCompletionEngine.TYPE_STRING; } //Otherwise lookup from SuggestionCompletionEngine String type = sce.getFieldType( factType, fieldName ); return type; }
@Test public void testDataHasEnums() { String pkg = "package org.test\n import org.drools.ide.common.client.modeldriven.SuggestionCompletionEngineTest.Fact"; SuggestionCompletionLoader loader = new SuggestionCompletionLoader(); List<String> enums = new ArrayList<String>(); enums.add( "'Fact.field1' : ['val1', 'val2'], 'Fact.field2[field1=val1]' : ['f1val1a', 'f1val1b'], 'Fact.field2[field1=val2]' : ['f1val2a', 'f1val2b']" ); SuggestionCompletionEngine engine = loader.getSuggestionEngine( pkg, new ArrayList<JarInputStream>(), new ArrayList<DSLTokenizedMappingFile>(), enums ); //Fact.field1 has explicit enumerations assertTrue( engine.hasEnums( "Fact.field1" ) ); assertTrue( engine.hasEnums( "Fact", "field1" ) ); //Fact.field2 has explicit enumerations dependent upon Fact.field1 assertTrue( engine.hasEnums( "Fact.field2" ) ); assertTrue( engine.hasEnums( "Fact", "field2" ) ); }
assertTrue( engine.hasEnums( "Fact.field1" ) ); assertTrue( engine.hasEnums( "Fact", "field1" ) ); assertTrue( engine.hasEnums( "Fact.field2" ) ); assertTrue( engine.hasEnums( "Fact", "field2" ) ); assertFalse( engine.hasEnums( "Fact.field2suffixed" ) ); assertFalse( engine.hasEnums( "Fact", "field2suffixed" ) );
assertTrue( sce.hasEnums( p1.getFactType(), c1.getFactField() ) ); assertFalse( dt.hasValueList( c1 ) ); assertTrue( sce.hasEnums( p1_.getFactType(), c1_.getFactField() ) ); assertFalse( dt.hasValueList( c1_ ) ); assertFalse( sce.hasEnums( p1_.getFactType(), c1__.getFactField() ) ); assertTrue( dt.hasValueList( c1__ ) ); assertTrue( sce.hasEnums( p1__.getFactType(), c1___.getFactField() ) ); assertTrue( dt.hasValueList( c1___ ) ); assertTrue( sce.hasEnums( p1.getFactType(), asf.getFactField() ) ); assertFalse( dt.hasValueList( asf ) ); assertTrue( sce.hasEnums( ins.getFactType(), ins.getFactField() ) ); assertFalse( dt.hasValueList( ins ) ); assertTrue( sce.hasEnums( ins_.getFactType(), ins_.getFactField() ) ); assertTrue( dt.hasValueList( ins_ ) ); assertFalse( sce.hasEnums( p1.getFactType(),