Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
akhanch committed Mar 23, 2015
1 parent cbd266d commit 75277ef
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 9 deletions.
Expand Up @@ -1177,7 +1177,8 @@ private void addFieldRestriction( final StringBuilder buf,
buf );
break;
case BaseSingleFieldConstraint.TYPE_TEMPLATE:
buildTemplateFieldValue( type,
buildTemplateFieldValue( operator,
type,
fieldType,
value,
buf );
Expand Down Expand Up @@ -1249,7 +1250,7 @@ protected void buildLiteralFieldValue( final String operator,
buf.append( " " );
}

private void populateValueList( final StringBuilder buf,
protected void populateValueList( final StringBuilder buf,
final int type,
final String fieldType,
final String value ) {
Expand Down Expand Up @@ -1293,16 +1294,26 @@ protected void buildExpressionFieldValue( final ExpressionFormLine expression,
}
}

protected void buildTemplateFieldValue( final int type,
protected void buildTemplateFieldValue( final String operator,
final int type,
final String fieldType,
final String value,
final StringBuilder buf ) {
buf.append( " " );
constraintValueBuilder.buildLHSFieldValue( buf,
if ( OperatorsOracle.operatorRequiresList( operator ) ) {
buf.append( " " );
constraintValueBuilder.buildLHSFieldValue( buf,
type,
DataType.TYPE_COLLECTION,
"@{makeValueList(" + value + ")}" );
buf.append( " " );
} else {
buf.append( " " );
constraintValueBuilder.buildLHSFieldValue( buf,
type,
fieldType,
"@{removeDelimitingQuotes(" + value + ")}" );
buf.append( " " );
buf.append( " " );
}
}

private void buildEnumFieldValue( final String operator,
Expand Down
Expand Up @@ -600,9 +600,38 @@ protected String marshalRule( final RuleModel model ) {
"}" );

header.append( "@code{\n" +
"def capitals(value) {\n" +
" value.toUpperCase();\n" +
"}}" );
"def capitals(value) {\n" +
" value.toUpperCase();\n" +
"}}" );
header.append("@code{\n" +
" def makeValueList(value) {\n"+
" if(value.startsWith('\"') && value.endsWith('\"')) {\n" +
" value = value.substring(1, value.length() - 1);\n" +
" }\n" +
" workingValue = value.trim();\n"+
" if ( workingValue.startsWith('(') ) {\n"+
" workingValue = workingValue.substring( 1 );\n"+
" }\n"+
" if ( workingValue.endsWith(')') ) {\n"+
" workingValue = workingValue.substring( 0," +
" workingValue.length() - 1 );\n"+
" }\n"+
" values = workingValue.split( ',' );\n"+
" output = ' (';\n"+
" for (v : values ) {\n"+
" v = v.trim();\n"+
" if ( v.startsWith( '\"' ) ) {\n"+
" v = v.substring( 1 );\n"+
" }\n"+
" if ( v.endsWith( '\"' ) ) {\n"+
" v = v.substring( 0,v.length() - 1 );\n"+
" }\n"+
" output+='\"'+v+'\", ';\n"+
" }"+
" output=output.substring(0,output.length()-2)+')';\n"+
" output;\n"+
" }\n"+
"}");

return header.append( buf ).toString();
}
Expand Down

0 comments on commit 75277ef

Please sign in to comment.