Package org.drools.ide.common.client.modeldriven

Examples of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine


        c2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c2.setValueList( "a,b,c" );
        p2.getChildColumns().add( c2 );
        dt.getConditions().add( p1 );

        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();
        sce.putDataEnumList( "Driver.name",
                             new String[]{"bob", "michael"} );

        assertEquals( 0,
                      dt.getValueList( c1,
                                       sce ).length );
View Full Code Here


        p6.setFactType( "Driver" );
        c6.setConstraintValueType( BaseSingleFieldConstraint.TYPE_RET_VALUE );
        p6.getChildColumns().add( c6 );
        dt.getConditions().add( p6 );

        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();

        sce.setFieldsForTypes( new HashMap<String, ModelField[]>() {
            {
                put( "Driver",
                        new ModelField[]{
                                new ModelField( "age",
                                                Integer.class.getName(),
View Full Code Here

        c1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        c1.setValueList( "age>10,age>20,age>30" );
        p1.getChildColumns().add( c1 );
        dt.getConditions().add( p1 );

        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();

        sce.setFieldsForTypes( new HashMap<String, ModelField[]>() {
            {
                put( "Driver",
                        new ModelField[]{
                                new ModelField( "age",
                                                Integer.class.getName(),
View Full Code Here

        c1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        c1.setValueList( "getAge()>10,getAge()>20,getAge()>30" );
        p1.getChildColumns().add( c1 );
        dt.getConditions().add( p1 );

        SuggestionCompletionEngine sce = new SuggestionCompletionEngine();

        sce.setFieldsForTypes( new HashMap<String, ModelField[]>() {
            {
                put( "Driver",
                        new ModelField[]{
                                new ModelField( "age",
                                                Integer.class.getName(),
View Full Code Here

        PackageItem pkg = repo.loadPackage( "com.billasurf.manufacturing.plant" );
        ServiceImplementation.updateDroolsHeader( "import com.billasurf.Board\nimport com.billasurf.Person" +
                "\n\nglobal com.billasurf.Person prs", pkg );
        pkg.checkin( "added imports" );

        SuggestionCompletionEngine eng = serv.loadSuggestionCompletionEngine( "com.billasurf.manufacturing.plant" );
        assertNotNull(eng);

        //The loader could define extra imports
        assertTrue( eng.getFactTypes().length >= 2);
        String[] fields = (String[]) eng.getModelFields( "Board" );
        assertTrue(fields.length >= 3);

        String[] globalVars = eng.getGlobalVariables();
        assertEquals(1, globalVars.length);
        assertEquals("prs", globalVars[0]);
        assertTrue(eng.getFieldCompletionsForGlobalVariable( "prs" ).length >= 2);

        fields = (String[]) eng.getModelFields( "Person" );

        assertTrue(fields.length >= 2);


View Full Code Here

            public void execute() {
            }
        });
        assertTrue (loaded);

        SuggestionCompletionEngine eng = new SuggestionCompletionEngine();
        cache.cache.put( "foo",  eng);

        cache.doAction( "foo", new Command() {

            public void execute() {
View Full Code Here

        asset.updateContent( enumeration );
        asset.checkin( "ok" );

        item = repo.loadPackage( "testLoadEnums" );
        BRMSSuggestionCompletionLoader loader = new BRMSSuggestionCompletionLoader();
        SuggestionCompletionEngine sce = loader.getSuggestionEngine( item );

        assertFalse(loader.hasErrors());
        assertEquals(1, sce.getDataEnumListsSize());


        asset.updateContent( "goober boy" );
        asset.checkin( "yeah" );
        item = repo.loadPackage( "testLoadEnums" );
View Full Code Here

        BRMSSuggestionCompletionLoader  loader = new BRMSSuggestionCompletionLoader();
        String header = ServiceImplementation.getDroolsHeader(item);


        SuggestionCompletionEngine engine = loader.getSuggestionEngine( item );
        assertNotNull(engine);

    }
View Full Code Here

        BRMSSuggestionCompletionLoader  loader = new BRMSSuggestionCompletionLoader();
        String header = ServiceImplementation.getDroolsHeader(item);


        SuggestionCompletionEngine engine = loader.getSuggestionEngine( item );
        assertNotNull(engine);

        String[] modelFields = engine.getModelFields("Agent");
        System.out.println("modelFields: "+Arrays.asList(modelFields));
        assertNotNull(modelFields);
        assertEquals(9, modelFields.length );

        modelFields = engine.getModelFields(FieldAccessorsAndMutators.BOTH, "Agent");
        assertNotNull(modelFields);
        System.out.println("modelFields: "+Arrays.asList(modelFields));
        assertEquals(10, modelFields.length );
       
        modelFields = engine.getModelFields(FieldAccessorsAndMutators.ACCESSOR, "Agent");
        assertNotNull(modelFields);
        System.out.println("modelFields: "+Arrays.asList(modelFields));
        assertEquals(9, modelFields.length );

        modelFields = engine.getModelFields(FieldAccessorsAndMutators.MUTATOR, "Agent");
        assertNotNull(modelFields);
        System.out.println("modelFields: "+Arrays.asList(modelFields));
        assertEquals(9, modelFields.length );

    }
View Full Code Here

        ServiceImplementation.updateDroolsHeader("import java.util.Date\ntemplate Person\njava.lang.String name\nDate birthDate\nend", item );
        repo.save();

        BRMSSuggestionCompletionLoader loader = new BRMSSuggestionCompletionLoader();

        SuggestionCompletionEngine engine = loader.getSuggestionEngine( item );
        assertNotNull(engine);

        List<String> factTypes = Arrays.asList(engine.getFactTypes());

        assertEquals( 2 + loader.getExternalImportDescrs().size(), factTypes.size() );
        assertTrue(factTypes.contains("Date"));
        assertTrue(factTypes.contains("Person"));

        String[] fieldsForType = engine.getFieldCompletions( "Person" );
        assertEquals( 2, fieldsForType.length );
        assertEquals("birthDate", fieldsForType[0]);
        assertEquals("name", fieldsForType[1]);

        String fieldType = engine.getFieldType( "Person", "name" );
        assertEquals( SuggestionCompletionEngine.TYPE_STRING, fieldType );
        fieldType = engine.getFieldType( "Person", "birthDate" );
        assertEquals( SuggestionCompletionEngine.TYPE_DATE, fieldType );
    }
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.