Examples of FactMetaModel


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

        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

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

        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

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

        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

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.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

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

Examples of org.drools.workbench.screens.factmodel.model.FactMetaModel

        final FactEditorPopup popup = new FactEditorPopup( modelNameHelper,
                                                           superTypeFactModels );

        popup.setOkCommand( new Command() {
            public void execute() {
                FactMetaModel factMetaModel = popup.getFactModel();

                factModels.getModels().add( factMetaModel );
                superTypeFactModels.add( factMetaModel );
                addFactModelToStackPanel( factMetaModel );
            }
View Full Code Here

Examples of org.drools.workbench.screens.factmodel.model.FactMetaModel

    private Command okCommand;

    public FactEditorPopup( ModelNameHelper modelNameHelper,
                            List<FactMetaModel> superTypeFactModels ) {
        this( new FactMetaModel(),
              superTypeFactModels,
              modelNameHelper );
    }
View Full Code Here

Examples of org.drools.workbench.screens.factmodel.model.FactMetaModel

        return 0;
    }

    private boolean createsCircularDependency( String type ) {
        final Set<String> circulars = new HashSet<String>();
        final FactMetaModel fmm = getFactMetaModel( type );
        return addCircular( fmm,
                            circulars );
    }
View Full Code Here

Examples of org.drools.workbench.screens.factmodel.model.FactMetaModel

        String type = fmm.getName();
        if ( circulars.contains( type ) ) {
            return true;
        }
        circulars.add( type );
        FactMetaModel efmm = getFactMetaModel( fmm.getSuperType() );
        return addCircular( efmm,
                            circulars );
    }
View Full Code Here

Examples of org.drools.workbench.screens.factmodel.model.FactMetaModel

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

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

                mm.getFields().add( fm );
            }

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

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

            list.add( mm );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.