Package org.drools.guvnor.client.factmodel

Examples of org.drools.guvnor.client.factmodel.FieldMetaModel


            AnnotationMetaModel a = (AnnotationMetaModel) mm.getAnnotations().get( i );
            sb.append( "\n\t" );
            sb.append( buildAnnotationDRL( a ) );
        }
        for ( int i = 0; i < mm.getFields().size(); i++ ) {
            FieldMetaModel f = (FieldMetaModel) mm.getFields().get( i );
            sb.append( "\n\t" );
            sb.append( f.name ).append( ": " ).append( f.type );
        }
        sb.append( "\nend" );
        return sb.toString();
View Full Code Here


            Map<String, TypeFieldDescr> fields = td.getFields();
            for ( Map.Entry<String, TypeFieldDescr> en : fields.entrySet() ) {
                String fieldName = en.getKey();
                TypeFieldDescr descr = en.getValue();
                FieldMetaModel fm = new FieldMetaModel( fieldName,
                                                        descr.getPattern().getObjectType() );

                mm.getFields().add( fm );
            }
View Full Code Here

    @Test
    public void testToDrl() {

        List<FieldMetaModel> fields = new ArrayList<FieldMetaModel>();
        fields.add( new FieldMetaModel( "f1",
                                        "int" ) );
        fields.add( new FieldMetaModel( "f2",
                                        "String" ) );

        FactMetaModel mm = new FactMetaModel( "FooBar",
                                              fields );
View Full Code Here

        assertEquals( "FooBar",
                      mm.getName() );
        assertEquals( 2,
                      mm.getFields().size() );
        for ( int i = 0; i < mm.getFields().size(); i++ ) {
            FieldMetaModel fm = (FieldMetaModel) mm.getFields().get( 1 );
            if ( fm.name.equals( "f1" ) ) {
                assertEquals( "f1",
                              fm.name );
                assertEquals( "int",
                              fm.type );
View Full Code Here

        assertEquals( 1,
                      mm.getFields().size() );
        assertEquals( "Foo",
                      mm.getName() );

        FieldMetaModel fmm = (FieldMetaModel) mm.getFields().get( 0 );
        assertEquals( "name",
                      fmm.name );

        mm.getFields().add( new FieldMetaModel( "age",
                                                "int" ) );

        ch.storeAssetContent( ass,
                              asset );
View Full Code Here

public class FactModelContentHandlerTest extends TestCase {

    public void testToDrl() {

        List<FieldMetaModel> fields = new ArrayList<FieldMetaModel>();
        fields.add(new FieldMetaModel("f1", "int"));
        fields.add(new FieldMetaModel("f2", "String"));

        FactMetaModel mm = new FactMetaModel("FooBar", fields);

        FactModelContentHandler ch = new FactModelContentHandler();
        String drl = ch.toDRL(mm);
View Full Code Here

      assertEquals(1, list.size());
      FactMetaModel mm = list.get(0);
      assertEquals("FooBar", mm.name);
      assertEquals(2, mm.fields.size());
      for (int i = 0; i < mm.fields.size(); i++) {
          FieldMetaModel fm = (FieldMetaModel) mm.fields.get(1);
          if (fm.name.equals("f1")) {
            assertEquals("f1", fm.name);
            assertEquals("int", fm.type);
          } else {
              assertEquals("f2", fm.name);
View Full Code Here

      assertEquals(1, fm.models.size());
      FactMetaModel mm = (FactMetaModel) fm.models.get(0);
      assertEquals(1, mm.fields.size());
      assertEquals("Foo", mm.name);

      FieldMetaModel fmm = (FieldMetaModel) mm.fields.get(0);
      assertEquals("name", fmm.name);

      mm.fields.add(new FieldMetaModel("age", "int"));

      ch.storeAssetContent(ass, asset);

      assertTrue(asset.getContent().indexOf("age: int") > -1);
View Full Code Here

    @Test
    public void testToDrl() {

        List<FieldMetaModel> fields = new ArrayList<FieldMetaModel>();
        fields.add( new FieldMetaModel( "f1",
                                        "int" ) );
        fields.add( new FieldMetaModel( "f2",
                                        "String" ) );

        FactMetaModel mm = new FactMetaModel( "FooBar",
                                              fields );
View Full Code Here

        assertEquals( "FooBar",
                      mm.name );
        assertEquals( 2,
                      mm.fields.size() );
        for ( int i = 0; i < mm.fields.size(); i++ ) {
            FieldMetaModel fm = (FieldMetaModel) mm.fields.get( 1 );
            if ( fm.name.equals( "f1" ) ) {
                assertEquals( "f1",
                              fm.name );
                assertEquals( "int",
                              fm.type );
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.factmodel.FieldMetaModel

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.