//Build a normal SingleFieldConstraint for a non-otherwise cell value
private FieldConstraint makeSingleFieldConstraint( ConditionCol52 c,
String cell ) {
SingleFieldConstraint sfc = new SingleFieldConstraint( c.getFactField() );
//Condition columns can be defined as having no operator, in which case the operator
//is taken from the cell's value. Pretty yucky really if we're to be able to perform
//expansion and contraction of decision table columns.... this might have to go.
if ( no( c.getOperator() ) ) {
String[] a = cell.split( "\\s" );
if ( a.length > 1 ) {
//Operator might be 1 part (e.g. "==") or two parts (e.g. "not in")
StringBuilder operator = new StringBuilder( a[ 0 ] );
for ( int i = 1; i < a.length - 1; i++ ) {
operator.append( a[ i ] );
}
sfc.setOperator( operator.toString() );
sfc.setValue( a[ a.length - 1 ] );
} else {
sfc.setValue( cell );
}
} else {
sfc.setOperator( c.getOperator() );
if ( OperatorsOracle.operatorRequiresList( c.getOperator() ) ) {
sfc.setValue( makeInList( cell ) );
} else {
if ( !c.getOperator().equals( "== null" ) && !c.getOperator().equals( "!= null" ) ) {
sfc.setValue( cell );
}
}
}
if ( c.getConstraintValueType() == BaseSingleFieldConstraint.TYPE_LITERAL && c.isBound() ) {
sfc.setFieldBinding( c.getBinding() );
}
sfc.setParameters( c.getParameters() );
sfc.setConstraintValueType( c.getConstraintValueType() );
sfc.setFieldType( c.getFieldType() );
return sfc;
}