Examples of ScorecardModel


Examples of org.drools.ide.common.client.modeldriven.scorecards.ScorecardModel

        if (sce == null) {
            sce = SuggestionCompletionCache.getInstance().getEngineFromCache(asset.getMetaData().getModuleName());
            sceModelFields = sce.getModelFields();
        }

        final ScorecardModel scorecardModel = (ScorecardModel) asset.getContent();

        scorecardPropertiesGrid = new Grid(4, 4);
        scorecardPropertiesGrid.setCellSpacing(5);
        scorecardPropertiesGrid.setCellPadding(5);

        tbInitialScore = TextBoxFactory.getTextBox(SuggestionCompletionEngine.TYPE_NUMERIC_DOUBLE);
        tbInitialScore.setText(Double.toString(scorecardModel.getInitialScore()));

        String factName = scorecardModel.getFactName();
        if (factName.lastIndexOf(".") > -1){
            // if fact is a fully qualified className, strip off the packageName
            factName = factName.substring(factName.lastIndexOf(".")+1);
        }
        final EnumDropDown dropDownFields = new EnumDropDown("",
                new DropDownValueChanged() {
                    public void valueChanged(String newText,
                                             String newValue) {
                        //do nothing
                    }
                }, DropDownData.create(new String[]{}));

        EnumDropDown dropDownFacts = new EnumDropDown(factName,
                new DropDownValueChanged() {
                    public void valueChanged(String newText, String newValue) {
                        String selectedField = scorecardModel.getFieldName();
                        selectedField = selectedField+" : double";
                        dropDownFields.setDropDownData(selectedField, DropDownData.create(getEligibleFields(newValue, typesForScore)));
                    }
                }, DropDownData.create(sce.getFactTypes()));

        ddReasonCodeField = new EnumDropDown("",
                new DropDownValueChanged() {
                    public void valueChanged(String newText,
                                             String newValue) {
                        //do nothing
                    }
                }, DropDownData.create(new String[]{}));

        String rcField = scorecardModel.getReasonCodeField() +" : List";
        ddReasonCodeField.setDropDownData(rcField,DropDownData.create(getEligibleFields(factName,typesForRC)));

        boolean useReasonCodes = scorecardModel.isUseReasonCodes();
        String reasonCodesAlgo = scorecardModel.getReasonCodesAlgorithm();
        if (reasonCodesAlgo == null || reasonCodesAlgo.trim().length() == 0) {
            reasonCodesAlgo = "none";
        }

        ddUseReasonCode = booleanEditor(Boolean.toString(useReasonCodes));
        ddReasonCodeAlgo = dropDownEditor(DropDownData.create(REASON_CODE_ALGORITHMS), reasonCodesAlgo);
        tbBaselineScore = TextBoxFactory.getTextBox(SuggestionCompletionEngine.TYPE_NUMERIC_DOUBLE);

        scorecardPropertiesGrid.setText(0, 0, "Facts");
        scorecardPropertiesGrid.setText(0, 1, "Resultant Score Field");
        scorecardPropertiesGrid.setText(0, 2, "Initial Score");

        scorecardPropertiesGrid.setWidget(1, 0, dropDownFacts);
        scorecardPropertiesGrid.setWidget(1, 1, dropDownFields);
        scorecardPropertiesGrid.setWidget(1, 2, tbInitialScore);

        scorecardPropertiesGrid.setText(2, 0, "Use Reason Codes");
        scorecardPropertiesGrid.setText(2, 1, "Resultant Reason Codes Field");
        scorecardPropertiesGrid.setText(2, 2, "Reason Codes Algorithm");
        scorecardPropertiesGrid.setText(2, 3, "Baseline Score");

        scorecardPropertiesGrid.setWidget(3, 0, ddUseReasonCode);
        scorecardPropertiesGrid.setWidget(3, 1, ddReasonCodeField);
        scorecardPropertiesGrid.setWidget(3, 2, ddReasonCodeAlgo);
        scorecardPropertiesGrid.setWidget(3, 3, tbBaselineScore);

        /* TODO : Remove this explicitly Disabled Reasoncode support field*/
        ddUseReasonCode.setEnabled(false);

        tbBaselineScore.setText(Double.toString(scorecardModel.getBaselineScore()));

        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 0, "200px");
        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 1, "250px");
        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 2, "200px");
        scorecardPropertiesGrid.getCellFormatter().setWidth(0, 3, "200px");

        int index = Arrays.asList(sce.getFactTypes()).indexOf(factName);
        dropDownFacts.setSelectedIndex(index);
        dropDownFields.setDropDownData(scorecardModel.getFieldName()+" : double", DropDownData.create(getEligibleFields(factName, typesForScore)));

        return scorecardPropertiesGrid;
    }
View Full Code Here

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

    }

    @Override
    public ScoreCardModelContent loadContent( final Path path ) {
        try {
            final ScoreCardModel model = load( path );
            final PackageDataModelOracle oracle = dataModelService.getDataModel( path );
            return new ScoreCardModelContent( model,
                                              oracle );

        } catch ( Exception e ) {
View Full Code Here

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

    @Override
    public void create( final Package pkg,
                        final String baseFileName,
                        final NewResourcePresenter presenter ) {
        final ScoreCardModel model = new ScoreCardModel();
        model.setName( baseFileName );
        model.setPackageName( pkg.getPackageName() );
        busyIndicatorView.showBusyIndicator( CommonConstants.INSTANCE.Saving() );
        scoreCardService.call( getSuccessCallback( presenter ),
                               new HasBusyIndicatorDefaultErrorCallback( busyIndicatorView ) ).create( pkg.getPackageMainResourcesPath(),
                                                                                                       buildFileName( resourceType,
                                                                                                                      baseFileName ),
View Full Code Here

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

    }

    @Override
    public ScoreCardModelContent loadContent( final Path path ) {
        try {
            final ScoreCardModel model = load( path );
            final PackageDataModelOracle oracle = dataModelService.getDataModel( path );
            final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
            final GuidedScoreCardModelVisitor visitor = new GuidedScoreCardModelVisitor( model );
            DataModelOracleUtilities.populateDataModel( oracle,
                                                        dataModel,
View Full Code Here

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

                "    }\n" +
                "}";
    }

    public static ScoreCardModel createEmptyGuidedScoreCard() {
        final ScoreCardModel model = new ScoreCardModel();
        model.setName( "test" );
        return model;
    }
View Full Code Here

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

        model.setName( "test" );
        return model;
    }

    public static String createEmptyGuidedScoreCardXML() {
        final ScoreCardModel model = createEmptyGuidedScoreCard();
        return GuidedScoreCardXMLPersistence.getInstance().marshal( model );
    }
View Full Code Here

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

        final ScoreCardModel model = createEmptyGuidedScoreCard();
        return GuidedScoreCardXMLPersistence.getInstance().marshal( model );
    }

    public static ScoreCardModel createGuidedScoreCard() {
        final ScoreCardModel model = new ScoreCardModel();
        model.setName( "test" );

        model.setPackageName( "org.drools.workbench.models.guided.scorecard.backend.test1" );
        model.setReasonCodesAlgorithm( "none" );
        model.setBaselineScore( 0.0 );
        model.setInitialScore( 0.0 );

        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

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

        return model;
    }

    public static String createGuidedScoreCardXML() {
        final ScoreCardModel model = createGuidedScoreCard();
        return GuidedScoreCardXMLPersistence.getInstance().marshal( model );
    }
View Full Code Here

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

    }

    @Override
    public ScoreCardModelContent loadContent( final Path path ) {
        try {
            final ScoreCardModel model = load( path );
            final PackageDataModelOracle oracle = dataModelService.getDataModel( path );
            final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
            final GuidedScoreCardModelVisitor visitor = new GuidedScoreCardModelVisitor( model );
            DataModelOracleUtilities.populateDataModel( oracle,
                                                        dataModel,
View Full Code Here

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

    public KObject toKObject( final Path path ) {
        KObject index = null;

        try {
            final String content = ioService.readAllString( path );
            final ScoreCardModel model = GuidedScoreCardXMLPersistence.getInstance().unmarshall( content );

            final ProjectDataModelOracle dmo = getProjectDataModelOracle( path );
            final Project project = projectService.resolveProject( Paths.convert( path ) );
            final Package pkg = projectService.resolvePackage( Paths.convert( path ) );
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.