editingPattern = new Pattern52(); editingPattern.setFactType( ft ); editingPattern.setBoundName( fn ); editingPattern.setNegated( isPatternNegated ); entryPointName.setText( editingPattern.getEntryPointName() ); cwo.selectItem( editingPattern.getWindow().getOperator() ); makeLimitedValueWidget(); makeDefaultValueWidget();
public Set<String> getBindings( String className ) { //For some reason, Fact Pattern data-types use the leaf name of the fully qualified Class Name //whereas Fields use the fully qualified Class Name. We don't use the generic fieldType (see //SuggestionCompletionEngine.TYPE) as we can't distinguish between different numeric types String simpleClassName = className; if ( simpleClassName != null && simpleClassName.lastIndexOf( "." ) > 0 ) { simpleClassName = simpleClassName.substring( simpleClassName.lastIndexOf( "." ) + 1 ); } Set<String> bindings = new HashSet<String>(); for ( Pattern52 p : this.model.getPatterns() ) { if ( className == null || p.getFactType().equals( simpleClassName ) ) { String binding = p.getBoundName(); if ( !( binding == null || "".equals( binding ) ) ) { bindings.add( binding ); } } for ( ConditionCol52 c : p.getChildColumns() ) { if ( c.isBound() ) { String fieldDataType = oracle.getFieldClassName( p.getFactType(), c.getFactField() ); if ( fieldDataType.equals( className ) ) { bindings.add( c.getBinding() ); } } } } return bindings; }
private String getFactType( String boundName ) { for ( Pattern52 p : model.getPatterns() ) { if ( p.getBoundName().equals( boundName ) ) { return p.getFactType(); } } return ""; }
private ListBox loadPatterns() { Set<String> vars = new HashSet<String>(); ListBox patterns = new ListBox(); for ( Pattern52 p : model.getPatterns() ) { if ( !vars.contains( p.getBoundName() ) ) { patterns.addItem( ( p.isNegated() ? Constants.INSTANCE.negatedPattern() + " " : "" ) + p.getFactType() + " [" + p.getBoundName() + "]", p.getFactType() + " " + p.getBoundName() + " " + p.isNegated() ); vars.add( p.getBoundName() ); } } return patterns; }
private boolean canConditionBeDeleted( ConditionCol52 col ) { Pattern52 pattern = model.getPattern( col ); if ( pattern.getChildColumns().size() > 1 ) { return true; } if ( isBindingUsed( pattern.getBoundName() ) ) { return false; } return true; }
final Pattern52 p1 = new Pattern52(); p1.setBoundName( "c1" ); p1.setFactType( "Driver" ); c1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL ); p1.getChildColumns().add( c1 ); dt.getConditions().add( p1 ); final Pattern52 p2 = new Pattern52(); p2.setBoundName( "c2" ); p2.setFactType( "Driver" ); c2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL ); c2.setValueList( "a,b,c" ); p2.getChildColumns().add( c2 ); dt.getConditions().add( p1 );
@Override public boolean isPatternEvent( final Pattern52 pattern ) { return oracle.isFactTypeAnEvent( pattern.getFactType() ); }
private List<ConditionCol52> findAvailableColumnsToExpand() { final List<ConditionCol52> availableColumns = new ArrayList<ConditionCol52>(); for ( CompositeColumn<?> cc : model.getPatterns() ) { if ( cc instanceof Pattern52 ) { final Pattern52 p = (Pattern52) cc; for ( ConditionCol52 c : p.getChildColumns() ) { switch ( model.getTableFormat() ) { case EXTENDED_ENTRY: if ( modelUtils.hasValueList( c ) ) { final String[] values = modelUtils.getValueList( c ); if ( values != null && values.length > 1 ) { availableColumns.add( c ); } } else if ( oracle.hasEnums( p.getFactType(), c.getFactField() ) ) { availableColumns.add( c ); } break; case LIMITED_ENTRY: availableColumns.add( c ); } } } } return availableColumns; }
dt.setTableName( "limited-entry" ); Pattern52 p1 = new Pattern52(); p1.setBoundName( "p1" ); p1.setFactType( "Smurf" ); dt.getConditions().add( p1 );
@Override public void setChosenConditions( final Pattern52 pattern, final List<ConditionCol52> conditions ) { pattern.getChildColumns().clear(); pattern.getChildColumns().addAll( conditions ); }
@UiHandler(value = "btnAdd") public void btnAddClick( final ClickEvent event ) { for ( String type : availableTypesSelections ) { final Pattern52 pattern = new Pattern52(); pattern.setFactType( type ); chosenPatterns.add( pattern ); } setChosenPatterns( chosenPatterns ); presenter.setConditionPatterns( chosenPatterns ); presenter.stateChanged(); }
Pattern52 p = new Pattern52(); ConditionCol52 c = new ConditionCol52(); p.getChildColumns().add( c ); dt.getConditions().add( p );
@Override public void onValueChange( final ValueChangeEvent<String> event ) { String binding = txtBinding.getText(); chosenPatternSelection.setBoundName( binding ); presenter.stateChanged(); validateBinding(); }
private ListBox loadBoundFacts() { Set<String> facts = new HashSet<String>(); for ( Pattern52 p : model.getPatterns() ) { if ( !p.isNegated() ) { facts.add( p.getBoundName() ); } } ListBox box = new ListBox(); for ( Iterator<String> iterator = facts.iterator(); iterator.hasNext(); ) { String b = (String) iterator.next(); box.addItem( b ); } String[] globs = this.oracle.getGlobalVariables(); for ( int i = 0; i < globs.length; i++ ) { box.addItem( globs[ i ] ); } return box; }
public boolean isPatternValid( Pattern52 p ) { return !( p.getBoundName() == null || p.getBoundName().equals( "" ) ); }
private void chosenTypesSelected( final Set<Pattern52> ps ) { btnRemove.setEnabled( true ); if ( ps.size() == 1 ) { chosenPatternSelection = ps.iterator().next(); patternDefinition.setVisible( true ); validateBinding(); txtBinding.setEnabled( true ); txtBinding.setText( chosenPatternSelection.getBoundName() ); txtEntryPoint.setEnabled( true ); txtEntryPoint.setText( chosenPatternSelection.getEntryPointName() ); enableMoveUpButton(); enableMoveDownButton(); if ( presenter.isPatternEvent( chosenPatternSelection ) ) { ddCEPWindow.setCEPWindow( chosenPatternSelection ); cepWindowContainer.setVisible( true ); } else { cepWindowContainer.setVisible( false ); } } else { chosenPatternSelection = null; patternDefinition.setVisible( false ); txtBinding.setEnabled( false ); txtBinding.setText( "" ); txtEntryPoint.setEnabled( false ); txtEntryPoint.setText( "" ); btnMoveUp.setEnabled( false ); btnMoveDown.setEnabled( false ); cepWindowContainer.setVisible( false ); } }
public void onClick( ClickEvent w ) { String[] val = pats.getValue( pats.getSelectedIndex() ).split( "\\s" ); editingPattern = model.getConditionPattern( val[ 1 ] ); //Clear Field and Operator when pattern changes editingCol.setFactField( null ); editingCol.setOperator( null ); //Set-up UI entryPointName.setText( editingPattern.getEntryPointName() ); cwo.selectItem( editingPattern.getWindow().getOperator() ); makeLimitedValueWidget(); makeDefaultValueWidget(); displayCEPOperators(); doPatternLabel(); doValueList(); doCalculationType(); pop.hide(); } } );
@Override public void onValueChange( final ValueChangeEvent<OperatorSelection> event ) { if ( chosenPatternSelection == null ) { return; } OperatorSelection selection = event.getValue(); String selected = selection.getValue(); chosenPatternSelection.getWindow().setOperator( selected ); }
entryPointName.setText( editingPattern.getEntryPointName() ); entryPointName.setEnabled( !isReadOnly ); if ( !isReadOnly ) {
allColumns.add( new MetadataCol52() ); Pattern52 p1 = new Pattern52(); p1.setBoundName( "p1" ); p1.setFactType( "Person" ); allPatterns.add( p1 ); col1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL ); col1.setOperator( "" ); p1.getChildColumns().add( col1 ); allColumns.add( col1 );