operatorParams = value.substring( 1,
endSquare ).trim();
value = value.substring( endSquare + 1 ).trim();
}
SingleFieldConstraint fieldConstraint = isExpression ?
createExpressionBuilderConstraint( m,
factPattern,
fieldName,
operator,
value ) :
createSingleFieldConstraint( m,
factPattern,
fieldName,
operator,
value );
if ( operatorParams != null ) {
int i = 0;
for ( String param : operatorParams.split( "," ) ) {
fieldConstraint.setParameter( "" + i++,
param.trim() );
}
fieldConstraint.setParameter( "org.drools.workbench.models.commons.backend.rule.visibleParameterSet",
"" + i );
fieldConstraint.setParameter( "org.drools.workbench.models.commons.backend.rule.operatorParameterGenerator",
"org.drools.workbench.models.commons.backend.rule.CEPOperatorParameterDRLBuilder" );
}
if ( fieldName.equals( "this" ) && ( operator == null || operator.equals( "!= null" ) ) ) {
fieldConstraint.setFieldType( DataType.TYPE_THIS );
}
fieldConstraint.setFactType( factPattern.getFactType() );
ModelField field = findField( findFields( m,
dmo,
factPattern.getFactType() ),
fieldConstraint.getFieldName() );
if ( field != null && ( fieldConstraint.getFieldType() == null || fieldConstraint.getFieldType().trim().length() == 0 ) ) {
fieldConstraint.setFieldType( field.getType() );
}
return fieldConstraint;
}