Examples of ScorecardModel


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

    @Override
    public FormatConversionResult convert( String name,
                                           byte[] input ) {
        String xml = new String( input );
        ScoreCardModel model = GuidedScoreCardXMLPersistence.getInstance().unmarshall( xml );

        String drl = new StringBuilder().append( GuidedScoreCardDRLPersistence.marshal( model ) ).toString();

        return new FormatConversionResult( getDestinationName( name ), drl.getBytes() );
    }
View Full Code Here

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

        return xt.toXML(model);
    }

    public ScorecardModel unmarshall(String xml) {
        if (xml == null || xml.trim().length() == 0) {
            return new ScorecardModel();
        }
        return (ScorecardModel) xt.fromXML(xml);
    }
View Full Code Here

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

public class ScorecardsContentHandler extends ContentHandler
        implements
        IRuleAsset, IHasCustomValidator {

    public void retrieveAssetContent(Asset asset, AssetItem item) throws SerializationException {
        ScorecardModel model = ScorecardsXMLPersistence.getInstance().unmarshall(item.getContent());
        asset.setContent(model);
    }
View Full Code Here

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

        ScorecardModel model = ScorecardsXMLPersistence.getInstance().unmarshall(item.getContent());
        asset.setContent(model);
    }

    public void storeAssetContent(Asset asset, AssetItem repoAsset) throws SerializationException {
        ScorecardModel model = (ScorecardModel) asset.getContent();
        repoAsset.updateContent(ScorecardsXMLPersistence.getInstance().marshal(model));
    }
View Full Code Here

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

        ScorecardModel model = (ScorecardModel) asset.getContent();
        repoAsset.updateContent(ScorecardsXMLPersistence.getInstance().marshal(model));
    }

    public void assembleDRL(BRMSPackageBuilder builder, AssetItem assetItem, StringBuilder stringBuilder) {
        ScorecardModel model = ScorecardsXMLPersistence.getInstance().unmarshall(assetItem.getContent());
        BuilderResult validationResult = validateScorecard(model);
        if ( !validationResult.hasLines() ) {
            String drl = getDrlFromScorecardModel(model);
            stringBuilder.append(drl);
        }
View Full Code Here

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

        }
    }

    public void assembleDRL(BRMSPackageBuilder builder, Asset asset, StringBuilder stringBuilder) {
        //called by View Source
        ScorecardModel model = (ScorecardModel) asset.getContent();
        BuilderResult validationResult = validateScorecard(model);
        if ( validationResult.hasLines() ) {
            if (StringUtils.isBlank(model.getName())) {
                stringBuilder.append("//Guided Scorecard has errors, Click on Source->Validate to view exact errors!");
            } else {
                stringBuilder.append("//Guided Scorecard ('"+model.getName()+"') has errors, Click on Source->Validate to view exact errors!");
            }
            return;
        }
        String drl = getDrlFromScorecardModel(model);
        stringBuilder.append(drl);
View Full Code Here

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

        String drl = getDrlFromScorecardModel(model);
        stringBuilder.append(drl);
    }

    public String getRawDRL(AssetItem assetItem) {
        ScorecardModel model = ScorecardsXMLPersistence.getInstance().unmarshall(assetItem.getContent());
        BuilderResult validationResult = validateScorecard(model);
        if ( !validationResult.hasLines() ) {
            return getDrlFromScorecardModel(model);
        } else {
            return "";
View Full Code Here

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

        return modelName;
    }

    public BuilderResult validateAsset(AssetItem assetItem) {
        System.out.println(">>> validateAsset() method.");
        ScorecardModel model = ScorecardsXMLPersistence.getInstance().unmarshall(assetItem.getContent());
        BuilderResult builderResult = validateScorecard(model);
        return builderResult;
    }
View Full Code Here

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

    private TextBox tbInitialScore;
    private Grid scorecardPropertiesGrid;

    public void onSave(SaveCommand saveCommand) {
        try {
            ScorecardModel scorecardModel = (ScorecardModel) asset.getContent();
            scorecardModel.setName(asset.getName());
            scorecardModel.setPackageName(asset.getMetaData().getModuleName());
            scorecardModel.setBaselineScore(Double.parseDouble(tbBaselineScore.getValue()));
            scorecardModel.setInitialScore(Double.parseDouble(tbInitialScore.getValue()));
            scorecardModel.setReasonCodesAlgorithm(ddReasonCodeAlgo.getValue(ddReasonCodeAlgo.getSelectedIndex()));
            scorecardModel.setUseReasonCodes(ddUseReasonCode.getSelectedIndex() == 1);

            EnumDropDown enumDropDown = (EnumDropDown) scorecardPropertiesGrid.getWidget(1, 0);
            String factName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
            scorecardModel.setFactName(factName);
            if (sce.getModelFields().get(factName) != null){
                for (ModelField mf : sce.getModelFields().get(factName)) {
                    if (mf.getType().equals(factName)){
                        scorecardModel.setFactName(mf.getClassName());
                        break;
                    }
                }
            }

            enumDropDown = (EnumDropDown) scorecardPropertiesGrid.getWidget(1, 1);
            if (enumDropDown.getSelectedIndex() > -1) {
                String fieldName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
                fieldName = fieldName.substring(0, fieldName.indexOf(":")).trim();
                scorecardModel.setFieldName(fieldName);
            } else {
                scorecardModel.setFieldName("");
            }

            if (ddReasonCodeField.getSelectedIndex() > -1) {
                String rcField = ddReasonCodeField.getValue(ddReasonCodeField.getSelectedIndex());
                rcField = rcField.substring(0, rcField.indexOf(":")).trim();
                scorecardModel.setReasonCodeField(rcField);
            }

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

                enumDropDown = (EnumDropDown) flexTable.getWidget(2, 0);
                String simpleFactName = enumDropDown.getValue(enumDropDown.getSelectedIndex());
                if (sce.getModelFields().get(simpleFactName) != null){
                    for (ModelField mf : sce.getModelFields().get(simpleFactName)) {
                        ////System.out.println(">>>> "+mf.getType()+"  "+mf.getClassName()+"  "+mf.getName());
                        if (mf.getType().equals(simpleFactName)){
                            characteristic.setFact(mf.getClassName());
                            break;
                        }
                    }
                }
                enumDropDown = (EnumDropDown) 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("");
                }

                characteristic.setReasonCode(((TextBox) flexTable.getWidget(2, 3)).getValue());

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

                scorecardModel.getCharacteristics().add(characteristic);
                characteristic.setDataType(getDataTypeForField(simpleFactName, characteristic.getField()));
                System.out.println(">>>SetDataType -->"+simpleFactName+"<-->"+characteristic.getField()+"<-->"+characteristic.getDataType()+"<--");
                characteristic.getAttributes().clear();
                characteristic.getAttributes().addAll(characteristicsAttrMap.get(flexTable).getList());
            }
View Full Code Here

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

        try {
            this.asset = asset;
            this.clientFactory = clientFactory;
            this.globalEventBus = globalEventBus;
            layout = new VerticalPanel();
            ScorecardModel scorecardModel = (ScorecardModel) asset.getContent();

            DecoratedDisclosurePanel disclosurePanel = new DecoratedDisclosurePanel("Scorecard " + " ( " + asset.getName() + " )");
            disclosurePanel.setWidth("100%");
            disclosurePanel.setTitle(Constants.INSTANCE.Scorecard());
            disclosurePanel.setOpen(true);

            DecoratedDisclosurePanel configPanel = new DecoratedDisclosurePanel("Setup Parameters");
            configPanel.setWidth("95%");
            configPanel.setOpen(true);
            configPanel.add(getScorecardProperties());
            VerticalPanel config = new VerticalPanel();

            DecoratedDisclosurePanel characteristicsPanel = new DecoratedDisclosurePanel("Characteristics");
            characteristicsPanel.setOpen(scorecardModel.getCharacteristics().size() > 0);
            characteristicsPanel.setWidth("95%");
            characteristicsPanel.add(getCharacteristics());

            config.setWidth("100%");
            config.add(configPanel);
            config.add(characteristicsPanel);

            disclosurePanel.add(config);
            layout.add(disclosurePanel);
            dtableContainer.setPixelSize(1000, 200);
            layout.add(dtableContainer);

            for (Characteristic characteristic : scorecardModel.getCharacteristics()) {
                DirtyableFlexTable flexTable = addCharacteristic(characteristic);
                for (Attribute attribute : characteristic.getAttributes()) {
                    addAttribute(flexTable, attribute);
                }
            }
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.