Skip to content

Commit

Permalink
[BZ-1052313] fix drl unmarshalling of accumulate constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofusco committed Jan 27, 2014
1 parent ed38d5f commit 5b650c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Expand Up @@ -1994,7 +1994,15 @@ private IFactPattern parsePatternSource( RuleModel m,
AccumulateDescr accumulate = (AccumulateDescr) patternSource;
FromAccumulateCompositeFactPattern fac = new FromAccumulateCompositeFactPattern();
fac.setSourcePattern( parseBaseDescr( m, accumulate.getInput(), boundParams, dmo ) );
fac.setFactPattern( new FactPattern( pattern.getObjectType() ) );

FactPattern factPattern = new FactPattern( pattern.getObjectType() );
parseConstraint( m,
factPattern,
pattern.getConstraint(),
boundParams,
dmo );

fac.setFactPattern( factPattern );
for ( AccumulateDescr.AccumulateFunctionCallDescr func : accumulate.getFunctions() ) {
String funcName = func.getFunction();
boolean first = true;
Expand Down Expand Up @@ -2778,7 +2786,7 @@ private SingleFieldConstraint createFieldConstraint( RuleModel m,
ModelField field = findField( findFields( m, factPattern.getFactType() ),
fieldConstraint.getFieldName() );

if ( field != null ) {
if ( field != null && (fieldConstraint.getFieldType() == null || fieldConstraint.getFieldType().trim().length() == 0) ) {
fieldConstraint.setFieldType( field.getType() );
}
return fieldConstraint;
Expand Down
Expand Up @@ -2837,7 +2837,6 @@ public void testFromBoundVariable() {
}

@Test
@Ignore("Bug 1052313 - Restrictions on Number that is result of 'accumulate' CE are not shown in GRE when the rule is reopened")
public void testFromAccumulate() {
String drl = "import java.lang.Number;\n"
+ "import org.mortgages.Applicant;\n"
Expand Down

0 comments on commit 5b650c7

Please sign in to comment.