private Widget connectiveValueEditor( final BaseSingleFieldConstraint con ) { return new ConstraintValueEditor( con, pattern.getConstraintList(), this.modeller, this.eventBus, isReadOnly ); }
private void generateConstraints( final FactPattern pattern ) { int printedCount = 0; for ( int i = 0; i < pattern.getFieldConstraints().length; i++ ) { StringBuilder buffer = new StringBuilder(); generateConstraint( pattern.getConstraintList().getConstraints()[ i ], false, buffer ); if ( buffer.length() > 0 ) { if ( printedCount > 0 ) { buf.append( ", " ); } buf.append( buffer ); printedCount++; } } }
private Widget valueEditor( final SingleFieldConstraint c ) { //Create a new ConstraintValueEditor ConstraintValueEditor constraintValueEditor = new ConstraintValueEditor( c, pattern.getConstraintList(), this.getModeller(), this.getEventBus(), this.readOnly ); constraintValueEditor.setOnValueChangeCommand( new Command() { public void execute() { setModified( true ); refreshConstraintValueEditorsDropDownData( c ); } } ); //Keep a reference to the value editors so they can be refreshed for dependent enums constraintValueEditors.put( c, constraintValueEditor ); return constraintValueEditor; }
private void generateFactPattern( final FactPattern pattern ) { if ( pattern.isNegated() ) { buf.append( "not " ); } else if ( pattern.isBound() ) { bindingsPatterns.put( pattern.getBoundName(), pattern ); buf.append( pattern.getBoundName() ); buf.append( " : " ); } if ( pattern.getFactType() != null ) { buf.append( pattern.getFactType() ); } buf.append( "( " ); // top level constraints if ( pattern.getConstraintList() != null ) { generateConstraints( pattern ); } buf.append( ")" ); //Add CEP window definition CEPWindow window = pattern.getWindow(); if ( window.isDefined() ) { buf.append( " " ); buf.append( window.getOperator() ); buf.append( buildOperatorParameterDRL( window.getParameters() ) ); } }
final FactPattern fact = (FactPattern) pat; if ( fact.getConstraintList() != null ) { final FieldConstraint[] cons = fact.getConstraintList().getConstraints(); if ( cons != null ) { for ( int k = 0; k < cons.length; k++ ) {
@Test public void testFieldsDeclaredButNoConstraints() { RuleModel m = new RuleModel(); m.name = "boo"; FactPattern p = new FactPattern( "Person" ); // this isn't an effective constraint, so it should be ignored. p.addConstraint( new SingleFieldConstraint( "field1" ) ); m.addLhsItem( p ); String actual = BRDRLPersistence.getInstance().marshal( m ); String expected = "rule \"boo\" \tdialect \"mvel\"\n when Person() then end"; checkMarshallUnmarshall( expected, m ); SingleFieldConstraint con = (SingleFieldConstraint) p.getConstraintList().getConstraint( 0 ); con.setFieldBinding( "q" ); // now it should appear, as we are binding a var to it expected = "rule \"boo\" dialect \"mvel\" when Person(q : field1) then end"; checkMarshallUnmarshall( expected, m ); }
person.getConstraintList().getConstraints().length ); SingleFieldConstraint cons = (SingleFieldConstraint) person.getConstraint( 0 ); assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL, cheese.getConstraintList().getConstraints().length ); cons = (SingleFieldConstraint) cheese.getConstraint( 0 ); assertEquals( "type",
person.getConstraintList().getConstraints().length ); SingleFieldConstraint cons = (SingleFieldConstraint) person.getConstraint( 0 ); assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL, cheese.getConstraintList().getConstraints().length ); cons = (SingleFieldConstraint) cheese.getConstraint( 0 ); assertEquals( "type",
person.getConstraintList().getConstraints().length );
result0Fp1.getConstraintList().getConstraints().length ); result0Fp2.getConstraintList().getConstraints().length ); result1Fp1.getConstraintList().getConstraints().length ); result2Fp1.getConstraintList().getConstraints().length );