public int getColumnCount() { if ( parent == null ) { return 0; } return parent.getColumnNames().length; }
public String getColumnName( final int col ) { if ( parent == null ) { return null; } final String[] columnNames = parent.getColumnNames(); return columnNames[col]; }
public String[] getColumnNames() { return parent.getColumnNames(); } }
public String[] getColumnNames() { return wrappedDataRow.getColumnNames(); } }
public String[] getColumnNames() { final String[] cols = backend.getColumnNames(); final String[] retval = new String[cols.length + 3]; System.arraycopy( cols, 0, retval, 3, cols.length ); retval[0] = DataFactory.QUERY_LIMIT; retval[1] = DataFactory.QUERY_TIMEOUT; retval[2] = DataFactory.QUERY_SORT; return retval; }
public String[] getColumnNames() { if ( dataRow == null ) { throw new IllegalStateException( "Not connected" ); } return dataRow.getColumnNames(); }
public int findColumn( final String name ) { if ( parent == null ) { return -1; } return Arrays.asList( parent.getColumnNames() ).indexOf( name ); }
public CompoundDataRow( final DataRow envDataRow, final DataRow dataRow ) { this.envDataRow = envDataRow; this.dataRow = dataRow; columnSources = new LinkedHashMap<String, Boolean>(); final String[] dataRowNames = dataRow.getColumnNames(); for ( int i = 0; i < dataRowNames.length; i++ ) { final String dataRowName = dataRowNames[i]; columnSources.put( dataRowName, Boolean.TRUE ); } final String[] envRowNames = envDataRow.getColumnNames(); for ( int i = 0; i < envRowNames.length; i++ ) { final String dataRowName = envRowNames[i]; columnSources.put( dataRowName, Boolean.FALSE ); } }
private String[] computeEffectiveColumnNameSet() { List<String> c = Arrays.asList( parent.getColumnNames() ); ArrayList<String> retval = new ArrayList<String>( c ); if ( !retval.contains( DataFactory.QUERY_LIMIT ) ) { retval.add( DataFactory.QUERY_LIMIT ); } retval.add( DataFactoryDesignTimeSupport.DESIGN_TIME ); return retval.toArray( new String[retval.size()] ); }
/** * Writes the names of the columns of the dataRow into the CSVRow. * * @param dr * the dataRow which should be written * @param row * the CSVRow used to collect the RowData. */ private void writeDataRowNames( final DataRow dr, final CSVRow row ) { final String[] names = dr.getColumnNames(); final int length = names.length; for ( int i = 0; i < length; i++ ) { final String columnName = names[i]; row.append( columnName ); } }
public void putAll( final DataRow dataRow ) { if ( dataRow == null ) { throw new NullPointerException(); } final String[] names = dataRow.getColumnNames(); for ( int i = 0; i < names.length; i++ ) { final String name = names[i]; put( name, dataRow.get( name ) ); } }
public StaticDataRow( final DataRow dataRow ) { if ( dataRow == null ) { throw new NullPointerException(); } synchronized ( dataRow ) { final String[] columnNames = dataRow.getColumnNames(); final int columnCount = columnNames.length; this.names = columnNames.clone(); final HashMap<String, Object> values = new HashMap<String, Object>(); for ( int i = 0; i < columnCount; i++ ) { final String name = columnNames[i]; values.put( name, dataRow.get( name ) ); } this.values = Collections.unmodifiableMap( values ); } }
/** * Writes the contents of the dataRow into the CSVRow. * * @param dr * the dataRow which should be written * @param row * the CSVRow used to collect the RowData. */ private void writeDataRow( final DataRow dr, final CSVRow row ) { final String[] names = dr.getColumnNames(); final int length = names.length; for ( int i = 0; i < length; i++ ) { final Object o = dr.get( names[i] ); row.append( o ); } }
/** * Returns the known column names, this data-row understands. The column names may change over time but do not change * while a event is processed by a function. The array returned is a copy of the internal data-storage and can be * safely modified. * * @return the column names as array. */ public String[] getColumnNames() { final LinkedMap columnSources = new LinkedMap(); final String[] dataRowNames = dataRow.getColumnNames(); for ( int i = 0; i < dataRowNames.length; i++ ) { final String dataRowName = dataRowNames[i]; columnSources.put( dataRowName, Boolean.TRUE ); } final String[] envRowNames = envDataRow.getColumnNames(); for ( int i = 0; i < envRowNames.length; i++ ) { final String dataRowName = envRowNames[i]; columnSources.put( dataRowName, Boolean.FALSE ); } return (String[]) columnSources.keys( new String[columnSources.size()] ); }
public ImportedVariablesDataRow( final MasterDataRow innerRow ) { if ( innerRow == null ) { throw new NullPointerException(); } final DataRow globalView = innerRow.getGlobalView(); final String[] names = globalView.getColumnNames(); final int cols = names.length; this.dataAttributes = new HashMap<String, DataAttributes>(); this.outerNames = new String[cols]; this.innerNames = outerNames; final Object[] values = new Object[cols]; final DataSchema dataSchema = innerRow.getDataSchema(); for ( int i = 0; i < cols; i++ ) { final String name = names[i]; if ( name == null ) { throw new IllegalStateException( "Every column must have a name." ); } outerNames[i] = name; values[i] = globalView.get( name ); dataAttributes.put( name, dataSchema.getAttributes( name ) ); } setData( outerNames, values ); }
public static void removeAllColumns( final DataRow dataRow, final MasterDataRowChangeHandler globalView ) { final MasterDataRowChangeEvent event = globalView.getReusableEvent(); event.reuse( MasterDataRowChangeEvent.COLUMN_REMOVED, "", null ); final String[] columnNames = dataRow.getColumnNames(); for ( int i = 0; i < columnNames.length; i++ ) { final String columnName = columnNames[i]; if ( columnName != null ) { event.setColumnName( columnName ); globalView.dataRowChanged( event ); } } }
@Test public void testQueryDesignTimeStructure() throws ReportDataFactoryException { DataRow parameters = mock( DataRow.class ); TableModel model = mock( TableModel.class ); doReturn( new String[] {} ).when( parameters ).getColumnNames(); doReturn( model ).when( parameters ).get( QUERY ); TableModel result = factory.queryDesignTimeStructure( QUERY, parameters ); assertThat( result, is( equalTo( model ) ) ); }
private AutoGeneratorFieldDescription[] computeFields( final DataRow dataRow, final DataSchema dataSchema, final DataAttributeContext context ) { final ArrayList<AutoGeneratorFieldDescription> fields = new ArrayList<AutoGeneratorFieldDescription>(); final String[] columnNames = dataRow.getColumnNames(); for ( int i = 0; i < columnNames.length; i++ ) { final String name = columnNames[i]; final DataAttributes attributes = dataSchema.getAttributes( name ); if ( attributes == null ) { continue; } if ( AutoGeneratorUtility.isIgnorable( attributes, context ) ) { continue; } final Number width = AutoGeneratorUtility.createFieldWidth( attributes, context ); final String fieldName = AutoGeneratorUtility.createFieldName( attributes, context ); final ElementType targetType = AutoGeneratorUtility.createFieldType( attributes, context ); final Boolean hideDuplicateItems = (Boolean) attributes.getMetaAttribute( MetaAttributeNames.Formatting.NAMESPACE, MetaAttributeNames.Formatting.HIDE_DUPLICATE_ITEMS, Number.class, context ); fields.add( new AutoGeneratorFieldDescription( fieldName, targetType, width, hideDuplicateItems ) ); } return fields.toArray( new AutoGeneratorFieldDescription[fields.size()] ); }
public static void refreshDataRow( final DataRow dataRow, final MasterDataRowChangeHandler changeHandler ) { final String[] columnNames = dataRow.getColumnNames(); final MasterDataRowChangeEvent event = changeHandler.getReusableEvent(); event.reuse( MasterDataRowChangeEvent.COLUMN_UPDATED, "", null ); for ( int i = 0; i < columnNames.length; i++ ) { final String columnName = columnNames[i]; if ( columnName != null ) { final Object columnValue = dataRow.get( columnName ); event.setColumnName( columnName ); event.setColumnValue( columnValue ); changeHandler.dataRowChanged( event ); } } }
public static void addColumns( final DataRow dataRow, final MasterDataRowChangeHandler globalView ) { final MasterDataRowChangeEvent event = globalView.getReusableEvent(); event.reuse( MasterDataRowChangeEvent.COLUMN_ADDED, "", null ); final String[] columnNames = dataRow.getColumnNames(); for ( int i = 0; i < columnNames.length; i++ ) { final String columnName = columnNames[i]; if ( columnName != null ) { final Object columnValue = dataRow.get( columnName ); event.setColumnName( columnName ); event.setColumnValue( columnValue ); globalView.dataRowChanged( event ); } } }