private String getFactType( FactPattern fp, SingleFieldConstraint sfc ) { String factType; if ( sfc == null ) { factType = fp.getFactType(); } else { factType = sfc.getFieldType(); //If field name is "this" use parent FactPattern type otherwise we can use the Constraint's field type String fieldName = sfc.getFieldName(); if ( DataType.TYPE_THIS.equals( fieldName ) ) { factType = fp.getFactType(); } } return factType; }
private DropDownData getDropDownData() { //Set applicable flags and reference data depending upon type if ( DataType.TYPE_BOOLEAN.equals( this.fieldType ) ) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create( new String[]{ "true", "false" } ); } else { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if ( constraintList != null && constraintList.getConstraints() != null ) { for ( FieldConstraint con : constraintList.getConstraints() ) { if ( con instanceof SingleFieldConstraint ) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put( fieldName, sfc.getValue() ); } } } this.dropDownData = sce.getEnums( this.factType, fieldName, currentValueMap ); } return dropDownData; }
private boolean isLHSFieldTypeEquivalent( String boundVariable ) { String boundFieldType = this.model.getLHSBindingType( boundVariable ); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.fieldType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } FieldConstraint fc = this.model.getLHSBoundField( boundVariable ); if ( fc instanceof SingleFieldConstraint ) { String fieldName = ( (SingleFieldConstraint) fc ).getFieldName(); String parentFactTypeForBinding = this.model.getLHSParentFactPatternForBinding( boundVariable ).getFactType(); String[] dd = this.sce.getEnumValues( parentFactTypeForBinding, fieldName ); return isEnumEquivalent( dd ); } return false; } return isBoundVariableApplicable( boundFieldType ); }
private void visitSingleFieldConstraint( SingleFieldConstraint sfc ) { InterpolationVariable var = new InterpolationVariable( sfc.getValue(), sfc.getFieldType(), factPattern.getFactType(), sfc.getFieldName() ); if ( BaseSingleFieldConstraint.TYPE_TEMPLATE == sfc.getConstraintValueType() && !vars.containsKey( var ) ) { vars.put( var, vars.size() ); } //Visit Connection constraints if ( sfc.getConnectives() != null ) { for ( int i = 0; i < sfc.getConnectives().length; i++ ) { final ConnectiveConstraint cc = sfc.getConnectives()[ i ]; InterpolationVariable ccVar = new InterpolationVariable( cc.getValue(), cc.getFieldType(), factPattern.getFactType(), cc.getFieldName() ); if ( BaseSingleFieldConstraint.TYPE_TEMPLATE == cc.getConstraintValueType() && !vars.containsKey( ccVar ) ) { vars.put( ccVar, vars.size() ); } } } }
String fieldName = con.getFieldName(); bindingLabel.append( fieldName );
public void onClick( ClickEvent event ) { String[] fields = new String[ 0 ]; //If field name is "this" use parent FactPattern type otherwise we can use the Constraint's field type String fieldName = con.getFieldName(); if ( DataType.TYPE_THIS.equals( fieldName ) ) { fields = connectives.getCompletions().getFieldCompletions( pattern.getFactType() ); } else { fields = connectives.getCompletions().getFieldCompletions( con.getFieldType() ); } popupCreator.showBindFieldPopup( (Widget) event.getSource(), pattern, con, fields, popupCreator ); } };
private boolean isLHSFieldTypeEquivalent( String boundVariable ) { String boundFieldType = modeller.getModel().getLHSBindingType( boundVariable ); //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) { if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) { return false; } FieldConstraint fc = this.modeller.getModel().getLHSBoundField( boundVariable ); if ( fc instanceof SingleFieldConstraint ) { String fieldName = ( (SingleFieldConstraint) fc ).getFieldName(); String parentFactTypeForBinding = this.modeller.getModel().getLHSParentFactPatternForBinding( boundVariable ).getFactType(); String[] dd = this.modeller.getSuggestionCompletions().getEnumValues( parentFactTypeForBinding, fieldName ); return isEnumEquivalent( dd ); } return false; } //If the fieldTypes are identical (and not SuggestionCompletionEngine.TYPE_COMPARABLE) then return true if ( boundFieldType.equals( this.variableType ) ) { return true; } return false; }
StringBuilder parentBuf = new StringBuilder(); while ( parent != null ) { String fieldName = parent.getFieldName(); parentBuf.insert( 0, fieldName + "." ); buf.append( ( (SingleFieldConstraintEBLeftSide) constr ).getExpressionLeftSide().getText() ); } else { String fieldName = constr.getFieldName(); buf.append( fieldName );
private SingleFieldConstraint visitSingleFieldConstraint( SingleFieldConstraint sfc ) { SingleFieldConstraint clone = new SingleFieldConstraint(); clone.setConstraintValueType( sfc.getConstraintValueType() ); clone.setExpressionValue( (ExpressionFormLine) visit( sfc.getExpressionValue() ) ); clone.setFieldBinding( sfc.getFieldBinding() ); clone.setFactType( sfc.getFactType() ); clone.setFieldName( sfc.getFieldName() ); clone.setFieldType( sfc.getFieldType() ); clone.setOperator( sfc.getOperator() ); for ( Map.Entry<String, String> entry : sfc.getParameters().entrySet() ) { clone.setParameter( entry.getKey(), entry.getValue() ); } clone.setValue( sfc.getValue() ); if ( sfc.getConnectives() != null ) { clone.setConnectives( new ConnectiveConstraint[ sfc.getConnectives().length ] ); for ( int i = 0; i < sfc.getConnectives().length; i++ ) { clone.getConnectives()[ i ] = (ConnectiveConstraint) visit( sfc.getConnectives()[ i ] ); } } return clone; }
popup.addAttribute( Constants.INSTANCE.BindTheFieldCalled0ToAVariable( con.getFieldName() ), vn ); popup.addAttribute( Constants.INSTANCE.ApplyAConstraintToASubFieldOf0( con.getFieldName() ), sub ); sub.addClickHandler( new ClickHandler() {
SingleFieldConstraint sfc = (SingleFieldConstraint) con; this.factType = sfc.getFactType(); this.fieldName = sfc.getFieldName(); this.fieldType = sce.getFieldType( factType, fieldName );
fieldName = c.getFieldName();
cons.getConstraintValueType() ); assertEquals( "name", cons.getFieldName() ); assertEquals( "==", cons.getOperator() ); cons.getConstraintValueType() ); assertEquals( "age", cons.getFieldName() ); assertEquals( "<", cons.getOperator() ); cons = (SingleFieldConstraint) cheese.getConstraint( 0 ); assertEquals( "type", cons.getFieldName() ); assertEquals( "==", cons.getOperator() );
cons.getConstraintValueType() ); assertEquals( "name", cons.getFieldName() ); assertEquals( "==", cons.getOperator() ); cons.getConstraintValueType() ); assertEquals( "age", cons.getFieldName() ); assertEquals( "<", cons.getOperator() ); cons = (SingleFieldConstraint) cheese.getConstraint( 0 ); assertEquals( "type", cons.getFieldName() ); assertEquals( "==", cons.getOperator() );
SingleFieldConstraint fcr1sfc = (SingleFieldConstraint) fcr1; assertEquals( "name", fcr1sfc.getFieldName() ); assertEquals( DataType.TYPE_STRING, fcr1sfc.getFieldType() );
cons.getConstraintValueType() ); assertEquals( "name", cons.getFieldName() ); assertEquals( "==", cons.getOperator() ); cons.getConstraintValueType() ); assertEquals( "age", cons.getFieldName() ); assertEquals( "<", cons.getOperator() );
String fieldName = sfc.getFieldName(); if ( fieldName.equals( DataType.TYPE_THIS ) ) { showLiteralSelector = CEPOracle.isCEPOperator( sfc.getOperator() );
result0Fp1Con1.getConstraintValueType() ); assertEquals( "name", result0Fp1Con1.getFieldName() ); assertEquals( "==", result0Fp1Con1.getOperator() ); result0Fp2Con1.getConstraintValueType() ); assertEquals( "name", result0Fp2Con1.getFieldName() ); assertEquals( "==", result0Fp2Con1.getOperator() ); result0Fp2Con2.getConstraintValueType() ); assertEquals( "age", result0Fp2Con2.getFieldName() ); assertEquals( "==", result0Fp2Con2.getOperator() ); result1Fp1Con1.getConstraintValueType() ); assertEquals( "name", result1Fp1Con1.getFieldName() ); assertEquals( "==", result1Fp1Con1.getOperator() ); result2Fp1Con1.getConstraintValueType() ); assertEquals( "name", result2Fp1Con1.getFieldName() ); assertEquals( "==", result2Fp1Con1.getOperator() );