Package org.drools.scorecards

Examples of org.drools.scorecards.ScorecardError


                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    for (Attribute attribute : characteristic.getAttributes()){
                        String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "cellRef"),2);
                        String weight = ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), ScorecardPMMLExtensionNames.CHARACTERTISTIC_WEIGHT);
                        if ( StringUtils.isEmpty(weight) || !isDouble(weight)){
                            parseErrors.add(new ScorecardError(newCellRef, "Attribute is missing weight or specified weight is not a double."));
                        }
                    }
                }
            }
        }
View Full Code Here


                    if (charReasonCode == null || StringUtils.isEmpty(charReasonCode)){
                        for (Attribute attribute : characteristic.getAttributes()){
                            String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "cellRef"),3);
                            String attrReasonCode = attribute.getReasonCode();
                            if ( attrReasonCode == null || StringUtils.isEmpty(attrReasonCode)){
                                parseErrors.add(new ScorecardError(newCellRef, "Attribute is missing Reason Code"));
                            }
                        }
                    }
                }
            }
View Full Code Here

                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    Double charBaseline = characteristic.getBaselineScore();
                    if  ( (charBaseline == null || charBaseline.doubleValue() == 0)
                            && ((scorecardBaseline == null || scorecardBaseline.doubleValue() == 0)) ){
                        String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), "cellRef"),2);
                        parseErrors.add(new ScorecardError(newCellRef, "Characteristic is missing Baseline Score"));
                    }
                }
            }
        }
    }
View Full Code Here

                Characteristics characteristics = (Characteristics)obj;
                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    String dataType = ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), ScorecardPMMLExtensionNames.CHARACTERTISTIC_DATATYPE);
                    String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), "cellRef"),1);
                    if ( dataType == null || StringUtils.isEmpty(dataType)) {
                        parseErrors.add(new ScorecardError(newCellRef, "Missing Data Type!"));
                    else  if ( !XLSKeywords.DATATYPE_TEXT.equalsIgnoreCase(dataType) && !XLSKeywords.DATATYPE_NUMBER.equalsIgnoreCase(dataType&& !XLSKeywords.DATATYPE_BOOLEAN.equalsIgnoreCase(dataType)){
                        parseErrors.add(new ScorecardError(newCellRef, "Invalid Data Type!"));
                    }

                    if (XLSKeywords.DATATYPE_BOOLEAN.equalsIgnoreCase(dataType)){
                        for (Attribute attribute : characteristic.getAttributes()){
                            String value = ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "predicateResolver");
                            if (!"TRUE".equalsIgnoreCase(value) && !"FALSE".equalsIgnoreCase(value)){
                                parseErrors.add(new ScorecardError(newCellRef, "Characteristic '"+characteristic.getName()+"' is Boolean and can support TRUE|FALSE only"));
                                break;
                            }
                        }
                    } else if (XLSKeywords.DATATYPE_NUMBER.equalsIgnoreCase(dataType)){
                        for (Attribute attribute : characteristic.getAttributes()){
                            String value = ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "predicateResolver");
                            if (!StringUtil.isNumericWithOperators(value)){
                                parseErrors.add(new ScorecardError(newCellRef, "Characteristic '"+characteristic.getName()+"' is Number and can support numerics only"));
                            }
                        }
                    }
                }
            }
View Full Code Here

            if (obj instanceof Characteristics){
                Characteristics characteristics = (Characteristics)obj;
                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    String newCellRef = ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), "cellRef");
                    if ( characteristic.getAttributes().size() == 0 ) {
                        parseErrors.add(new ScorecardError(newCellRef, "Missing Attribute Bins for Characteristic '"+characteristic.getName()+"'."));
                    }
                }
            }
        }
    }
View Full Code Here

        for (DataExpectation dataExpectation : dataExpectations) {
            try {
                if (dataExpectation != null && dataExpectation.object != null) {
                    if ( cellValue == null || StringUtils.isEmpty(cellValue.toString())){
                        if ( dataExpectation.errorMessage != null && !StringUtils.isEmpty(dataExpectation.errorMessage)) {
                            parseErrors.add(new ScorecardError(cellRef.formatAsString(), dataExpectation.errorMessage));
                            return;
                        }
                    }
                    String setter = "set" + Character.toUpperCase(dataExpectation.property.charAt(0)) + dataExpectation.property.substring(1);
                    method = getSuitableMethod(cellValue, expectedClass, dataExpectation, setter);
                    if ( method == null ) {
                        if (cellValue != null && !StringUtils.isEmpty(cellValue.toString())) {
                            parseErrors.add(new ScorecardError(cellRef.formatAsString(), "Unexpected Value! Wrong Datatype?"));
                        }
                        return;
                    }
                    if (method.getParameterTypes()[0] == Double.class) {
                        cellValue = Double.parseDouble(cellValue.toString());
View Full Code Here

                    if (charReasonCode == null || StringUtils.isEmpty(charReasonCode)){
                        for (Attribute attribute : characteristic.getAttributes()){
                            String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "cellRef"),3);
                            String attrReasonCode = attribute.getReasonCode();
                            if ( attrReasonCode == null || StringUtils.isEmpty(attrReasonCode)){
                                parseErrors.add(new ScorecardError(newCellRef, "Attribute is missing Reason Code"));
                            }
                        }
                    }
                }
            }
View Full Code Here

                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    Double charBaseline = characteristic.getBaselineScore();
                    if  ( (charBaseline == null || charBaseline.doubleValue() == 0)
                            && ((scorecardBaseline == null || scorecardBaseline.doubleValue() == 0)) ){
                        String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), "cellRef"),2);
                        parseErrors.add(new ScorecardError(newCellRef, "Characteristic is missing Baseline Score"));
                    }
                }
            }
        }
    }
View Full Code Here

                Characteristics characteristics = (Characteristics)obj;
                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    String dataType = ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), PMMLExtensionNames.CHARACTERTISTIC_DATATYPE);
                    String newCellRef = createDataTypeCellRef(ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), "cellRef"),1);
                    if ( dataType == null || StringUtils.isEmpty(dataType)) {
                        parseErrors.add(new ScorecardError(newCellRef, "Missing Data Type!"));
                    else  if ( !XLSKeywords.DATATYPE_TEXT.equalsIgnoreCase(dataType) && !XLSKeywords.DATATYPE_NUMBER.equalsIgnoreCase(dataType&& !XLSKeywords.DATATYPE_BOOLEAN.equalsIgnoreCase(dataType)){
                        parseErrors.add(new ScorecardError(newCellRef, "Invalid Data Type!"));
                    }

                    if (XLSKeywords.DATATYPE_BOOLEAN.equalsIgnoreCase(dataType)){
                        for (Attribute attribute : characteristic.getAttributes()){
                            String value = ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "predicateResolver");
                            if (!"TRUE".equalsIgnoreCase(value) && !"FALSE".equalsIgnoreCase(value)){
                                parseErrors.add(new ScorecardError(newCellRef, "Characteristic '"+characteristic.getName()+"' is Boolean and can support TRUE|FALSE only"));
                                break;
                            }
                        }
                    } else if (XLSKeywords.DATATYPE_NUMBER.equalsIgnoreCase(dataType)){
                        for (Attribute attribute : characteristic.getAttributes()){
                            String value = ScorecardPMMLUtils.getExtensionValue(attribute.getExtensions(), "predicateResolver");
                            if (!StringUtil.isNumericWithOperators(value)){
                                parseErrors.add(new ScorecardError(newCellRef, "Characteristic '"+characteristic.getName()+"' is Number and can support numerics only"));
                            }
                        }
                    }
                }
            }
View Full Code Here

            if (obj instanceof Characteristics){
                Characteristics characteristics = (Characteristics)obj;
                for (Characteristic characteristic : characteristics.getCharacteristics()){
                    String newCellRef = ScorecardPMMLUtils.getExtensionValue(characteristic.getExtensions(), "cellRef");
                    if ( characteristic.getAttributes().size() == 0 ) {
                        parseErrors.add(new ScorecardError(newCellRef, "Missing Attribute Bins for Characteristic '"+characteristic.getName()+"'."));
                    }
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.scorecards.ScorecardError

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.