extension.setName( PMMLExtensionNames.EXTERNAL_CLASS );
extension.setValue( characteristic.getFact() );
miningField.getExtensions().add( extension );
for ( final org.drools.workbench.models.guided.scorecard.shared.Attribute attribute : characteristic.getAttributes() ) {
final Attribute _attribute = new Attribute();
_characteristic.getAttributes().add( _attribute );
extension = new Extension();
extension.setName( ScorecardPMMLExtensionNames.CHARACTERTISTIC_FIELD );
extension.setValue( characteristic.getField() );
_attribute.getExtensions().add( extension );
if ( model.isUseReasonCodes() ) {
_attribute.setReasonCode( attribute.getReasonCode() );
}
_attribute.setPartialScore( attribute.getPartialScore() );
final String operator = attribute.getOperator();
final String dataType = characteristic.getDataType();
String predicateResolver;
if ( "boolean".equalsIgnoreCase( dataType ) ) {
predicateResolver = operator.toUpperCase();
} else if ( "String".equalsIgnoreCase( dataType ) ) {
if ( operator.contains( "=" ) ) {
predicateResolver = operator + attribute.getValue();
} else {
predicateResolver = attribute.getValue() + ",";
}
} else {
if ( NUMERIC_OPERATORS.contains( operator ) ) {
predicateResolver = operator + " " + attribute.getValue();
} else {
predicateResolver = attribute.getValue().replace( ",", "-" );
}
}
extension = new Extension();
extension.setName( "predicateResolver" );
extension.setValue( predicateResolver );
_attribute.getExtensions().add( extension );
}
}
pmmlScorecard.getExtensionsAndCharacteristicsAndMiningSchemas().add( miningSchema );
pmmlScorecard.getExtensionsAndCharacteristicsAndMiningSchemas().add( output );