Package org.drools.workbench.models.guided.scorecard.shared

Examples of org.drools.workbench.models.guided.scorecard.shared.Characteristic


            model.setReasonCodeField( rcField );
        }

        model.getCharacteristics().clear();
        for ( final DirtyableFlexTable flexTable : characteristicsTables ) {
            final Characteristic characteristic = new Characteristic();
            characteristic.setName( ( (TextBox) flexTable.getWidget( 0,
                                                                     1 ) ).getValue() );

            //Characteristic Fact Type
            enumDropDown = (ListBox) flexTable.getWidget( 2,
                                                          0 );
            if ( enumDropDown.getSelectedIndex() > -1 ) {
                final String simpleFactName = enumDropDown.getValue( enumDropDown.getSelectedIndex() );
                characteristic.setFact( simpleFactName );
                oracle.getFieldCompletions( simpleFactName,
                                            new Callback<ModelField[]>() {
                                                @Override
                                                public void callback( final ModelField[] fields ) {
                                                    if ( fields != null ) {
                                                        for ( ModelField mf : fields ) {
                                                            if ( mf.getType().equals( simpleFactName ) ) {
                                                                characteristic.setFact( mf.getClassName() );
                                                                break;
                                                            }
                                                        }
                                                    }
                                                }
                                            } );

                //Characteristic Field (cannot be set if no Fact Type has been set)
                enumDropDown = (ListBox) flexTable.getWidget( 2,
                                                              1 );
                if ( enumDropDown.getSelectedIndex() > -1 ) {
                    String fieldName = enumDropDown.getValue( enumDropDown.getSelectedIndex() );
                    fieldName = fieldName.substring( 0, fieldName.indexOf( ":" ) ).trim();
                    characteristic.setField( fieldName );
                } else {
                    characteristic.setField( "" );
                }
                getDataTypeForField( simpleFactName,
                                     characteristic.getField(),
                                     new Callback<String>() {
                                         @Override
                                         public void callback( final String result ) {
                                             characteristic.setDataType( result );
                                         }
                                     } );
            }

            //Characteristic Reason Code
            characteristic.setReasonCode( ( (TextBox) flexTable.getWidget( 2,
                                                                           3 ) ).getValue() );

            //Characteristic Base Line Score
            final String baselineScore = ( (TextBox) flexTable.getWidget( 2,
                                                                          2 ) ).getValue();
            try {
                characteristic.setBaselineScore( Double.parseDouble( baselineScore ) );
            } catch ( Exception e ) {
                characteristic.setBaselineScore( 0.0d );
            }

            //Characteristic Attributes
            characteristic.getAttributes().clear();
            characteristic.getAttributes().addAll( characteristicsAttrMap.get( flexTable ).getList() );

            model.getCharacteristics().add( characteristic );
        }

        return model;
View Full Code Here


        model.setFactName( "org.drools.workbench.models.guided.scorecard.backend.test1.Applicant" );
        model.setFieldName( "score" );
        model.setUseReasonCodes( false );
        model.setReasonCodeField( "" );

        final Characteristic c = new Characteristic();
        c.setName( "c1" );
        c.setFact( "org.drools.workbench.models.guided.scorecard.backend.test1.Applicant" );
        c.setDataType( "Double" );
        c.setField( "age" );
        c.setBaselineScore( 0.0 );
        c.setReasonCode( "" );

        final Attribute a = new Attribute();
        a.setOperator( "=" );
        a.setValue( "10" );
        a.setPartialScore( 0.1 );
        a.setReasonCode( "" );

        c.getAttributes().add( a );
        model.getCharacteristics().add( c );

        final String drl1 = GuidedScoreCardDRLPersistence.marshal( model );
        assertNotNull( drl1 );
View Full Code Here

        model.setFactName( "org.drools.workbench.models.guided.scorecard.backend.test1.Applicant" );
        model.setFieldName( "score" );
        model.setUseReasonCodes( false );
        model.setReasonCodeField( "" );

        final Characteristic c = new Characteristic();
        c.setName( "c1" );
        c.setFact( "org.drools.workbench.models.guided.scorecard.backend.test1.ApplicantAttribute" );
        c.setDataType( "int" );
        c.setField( "attribute" );
        c.setBaselineScore( 0.0 );
        c.setReasonCode( "" );

        final Attribute a = new Attribute();
        a.setOperator( "=" );
        a.setValue( "10" );
        a.setPartialScore( 0.1 );
        a.setReasonCode( "" );

        c.getAttributes().add( a );
        model.getCharacteristics().add( c );

        return model;
    }
View Full Code Here

        model.setName( name );

        model.setFactName( "Applicant" );
        model.setFieldName( "age" );

        final Characteristic c = new Characteristic();
        c.setName( "c1" );
        c.setFact( "Mortgage" );
        c.setField( "amount" );
        c.setDataType( DataType.TYPE_NUMERIC_INTEGER );

        model.getCharacteristics().add( c );

        return model;
    }
View Full Code Here

            model.setReasonCodeField( rcField );
        }

        model.getCharacteristics().clear();
        for ( final DirtyableFlexTable flexTable : characteristicsTables ) {
            final Characteristic characteristic = new Characteristic();
            characteristic.setName( ( (TextBox) flexTable.getWidget( 0,
                                                                     1 ) ).getValue() );

            //Characteristic Fact Type
            enumDropDown = (ListBox) flexTable.getWidget( 2,
                                                          0 );
            if ( enumDropDown.getSelectedIndex() > -1 ) {
                final String simpleFactName = enumDropDown.getValue( enumDropDown.getSelectedIndex() );
                characteristic.setFact( simpleFactName );
                oracle.getFieldCompletions( simpleFactName,
                                            new Callback<ModelField[]>() {
                                                @Override
                                                public void callback( final ModelField[] fields ) {
                                                    if ( fields != null ) {
                                                        for ( ModelField mf : fields ) {
                                                            if ( mf.getType().equals( simpleFactName ) ) {
                                                                characteristic.setFact( mf.getClassName() );
                                                                break;
                                                            }
                                                        }
                                                    }
                                                }
                                            } );

                //Characteristic Field (cannot be set if no Fact Type has been set)
                enumDropDown = (ListBox) flexTable.getWidget( 2,
                                                              1 );
                if ( enumDropDown.getSelectedIndex() > -1 ) {
                    String fieldName = enumDropDown.getValue( enumDropDown.getSelectedIndex() );
                    fieldName = fieldName.substring( 0, fieldName.indexOf( ":" ) ).trim();
                    characteristic.setField( fieldName );
                } else {
                    characteristic.setField( "" );
                }
                getDataTypeForField( simpleFactName,
                                     characteristic.getField(),
                                     new Callback<String>() {
                                         @Override
                                         public void callback( final String result ) {
                                             characteristic.setDataType( result );
                                         }
                                     } );
            }

            //Characteristic Reason Code
            characteristic.setReasonCode( ( (TextBox) flexTable.getWidget( 2,
                                                                           3 ) ).getValue() );

            //Characteristic Base Line Score
            final String baselineScore = ( (TextBox) flexTable.getWidget( 2,
                                                                          2 ) ).getValue();
            try {
                characteristic.setBaselineScore( Double.parseDouble( baselineScore ) );
            } catch ( Exception e ) {
                characteristic.setBaselineScore( 0.0d );
            }

            //Characteristic Attributes
            characteristic.getAttributes().clear();
            characteristic.getAttributes().addAll( characteristicsAttrMap.get( flexTable ).getList() );

            model.getCharacteristics().add( characteristic );
        }

        return model;
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.scorecard.shared.Characteristic

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.