Package org.drools.guvnor.client.factmodel

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


      if (pkg == null) return new ArrayList<FactMetaModel>();
      List<TypeDeclarationDescr> types = pkg.getTypeDeclarations();
      List<FactMetaModel> list = new ArrayList<FactMetaModel>(types.size());
      for (TypeDeclarationDescr td : types) {
        FactMetaModel mm = new FactMetaModel();
      mm.name = td.getTypeName();
      if (td.getMetaAttributes().size() > 0) {
        //can't do this yet
        throw new DroolsParserException("will have to use text for this");
      }
View Full Code Here


        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 );
        assertNotNull( drl );
        System.err.println( drl );
        assertEquals( "declare FooBar\n\tf1: int\n\tf2: String\nend",
                      drl );

        FactMetaModel mm2 = new FactMetaModel( "BooBah",
                                               new ArrayList<FieldMetaModel>() );
        List<FactMetaModel> models = new ArrayList<FactMetaModel>();
        models.add( mm );
        models.add( mm2 );
View Full Code Here

        FactModelContentHandler ch = new FactModelContentHandler();
        List<FactMetaModel> list = ch.toModel( drl );
        assertEquals( 1,
                      list.size() );
        FactMetaModel mm = list.get( 0 );
        assertEquals( "FooBar",
                      mm.getName() );
        assertEquals( 0,
                      mm.getFields().size() );
    }
View Full Code Here

        FactModelContentHandler ch = new FactModelContentHandler();
        List<FactMetaModel> list = ch.toModel( drl );
        assertEquals( 1,
                      list.size() );
        FactMetaModel mm = list.get( 0 );
        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

        FactModelContentHandler ch = new FactModelContentHandler();
        List<FactMetaModel> list = ch.toModel( drl );
        assertEquals( 1,
                      list.size() );
        FactMetaModel mm = list.get( 0 );
        assertEquals( "FooBar",
                      mm.getName() );
        assertEquals( 0,
                      mm.getFields().size() );
        assertEquals( 1,
                      mm.getAnnotations().size() );
        assertEquals( "event",
                      mm.getAnnotations().get( 0 ).values.get( "value" ) );
    }
View Full Code Here

        assertTrue( ass.getContent() instanceof FactModels );
        FactModels fm = (FactModels) ass.getContent();

        assertEquals( 1,
                      fm.models.size() );
        FactMetaModel mm = (FactMetaModel) fm.models.get( 0 );
        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

        if ( pkg == null ) return new ArrayList<FactMetaModel>();
        List<TypeDeclarationDescr> types = pkg.getTypeDeclarations();
        List<FactMetaModel> list = new ArrayList<FactMetaModel>( types.size() );
        for ( TypeDeclarationDescr td : types ) {
            FactMetaModel mm = new FactMetaModel();
            mm.setName( td.getTypeName() );
            mm.setSuperType( td.getSuperTypeName() );

            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 );
            }

            Map<String, AnnotationDescr> annotations = td.getAnnotations();
            for ( Map.Entry<String, AnnotationDescr> en : annotations.entrySet() ) {
                String annotationName = en.getKey();
                AnnotationDescr descr = en.getValue();
                Map<String, String> values = descr.getValues();
                AnnotationMetaModel am = new AnnotationMetaModel( annotationName,
                                                                  values );

                mm.getAnnotations().add( am );
            }

            list.add( mm );
        }
        return list;
View Full Code Here

      if (pkg == null) return new ArrayList<FactMetaModel>();
      List<TypeDeclarationDescr> types = pkg.getTypeDeclarations();
      List<FactMetaModel> list = new ArrayList<FactMetaModel>(types.size());
      for (TypeDeclarationDescr td : types) {
        FactMetaModel mm = new FactMetaModel();
      mm.name = td.getTypeName();
      if (td.getMetaAttributes().size() > 0) {
        //can't do this yet
        throw new DroolsParserException("will have to use text for this");
      }
View Full Code Here

TOP

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

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.