protected void populateAvailableFields() { if ( physicalTable != null ) { for ( IPhysicalColumn column : physicalTable.getPhysicalColumns() ) { AvailableField field = new AvailableField( column ); availableFields.add( field ); } } Collections.sort( this.availableFields, itemComparator ); }
IPhysicalColumn col = table.getPhysicalTable().getPhysicalColumns().get( min - 1 ); locationField = table.findFieldByPhysicalColumn( col ); } else if ( max < count ) { IPhysicalColumn col = table.getPhysicalTable().getPhysicalColumns().get( max + 1 ); locationField = table.findFieldByPhysicalColumn( col );
public void setLocationFields( ModelerWorkspace workspace, LevelMetaData locationLevel, String latitudeFieldName, String longitudeFieldName ) { boolean foundLatLongColumn = false; // -1 used to determine if something column index has not been found. > -1 if found. int latColIndex = -1; int lonColIndex = -1; // Look for specified lat and long columns List<AvailableTable> tableList = workspace.getAvailableTables().getAsAvailableTablesList(); for ( AvailableTable table : tableList ) { int count = 0; for ( IPhysicalColumn col : table.getPhysicalTable().getPhysicalColumns() ) { String fieldName = col.getId(); if ( fieldName.equalsIgnoreCase( latitudeFieldName ) ) { foundLatLongColumn = true; latColIndex = count; } else if ( fieldName.equalsIgnoreCase( longitudeFieldName ) ) { foundLatLongColumn = true; lonColIndex = count; } count++; } if ( foundLatLongColumn && locationLevel != null && latColIndex > -1 && lonColIndex > -1 ) { setLocationMemberAnnotations( locationLevel, getLocationRole() ); setLocationMemberProperties( workspace, table, locationLevel, latColIndex, lonColIndex ); } } }
col.setLogicalTable( parent ); parent.addLogicalColumn( col ); for ( IPhysicalColumn phycol : parent.getPhysicalTable().getPhysicalColumns() ) { if ( phycol.getId().equals( pcol ) ) { col.setPhysicalColumn( phycol );
private void setLocationMemberProperties( ModelerWorkspace workspace, AvailableTable table, LevelMetaData locationLevel, int latColIndex, int lonColIndex ) { // if it is a LocationField we need to make sure the lat & long columns get // added as logical columns to the model. AvailableField latField = table.findFieldByPhysicalColumn( table.getPhysicalTable().getPhysicalColumns().get( latColIndex ) ); AvailableField lonField = table.findFieldByPhysicalColumn( table.getPhysicalTable().getPhysicalColumns().get( lonColIndex ) ); ColumnBackedNode tmp = workspace.createColumnBackedNode( latField, ModelerPerspective.ANALYSIS ); tmp.getLogicalColumn().setName( new LocalizedString( workspace.getWorkspaceHelper().getLocale(), LATITUDE ) ); MemberPropertyMetaData memberProp = workspace.createMemberPropertyForParentWithNode( locationLevel, tmp ); memberProp.setName( LATITUDE ); locationLevel.add( memberProp ); tmp = workspace.createColumnBackedNode( lonField, ModelerPerspective.ANALYSIS ); tmp.getLogicalColumn().setName( new LocalizedString( workspace.getWorkspaceHelper().getLocale(), LONGITUDE ) ); memberProp = workspace.createMemberPropertyForParentWithNode( locationLevel, tmp ); memberProp.setName( LONGITUDE ); locationLevel.add( memberProp ); } }
for ( IPhysicalColumn col : table.getPhysicalTable().getPhysicalColumns() ) { if ( col.getId().equalsIgnoreCase( getDimensionName() ) ) { dimName += "2"; for ( IPhysicalColumn col : table.getPhysicalTable().getPhysicalColumns() ) { table.findFieldByPhysicalColumn( table.getPhysicalTable().getPhysicalColumns().get( latColIndex ) ); AvailableField lonField = table.findFieldByPhysicalColumn( table.getPhysicalTable().getPhysicalColumns().get( lonColIndex ) );
for ( IPhysicalColumn col : table.getPhysicalTable().getPhysicalColumns() ) {
for ( IPhysicalColumn physicalColumn : physicalTable.getPhysicalColumns() ) { if ( physicalColumn.getId().equals( column.getPhysicalColumn().getId() ) ) { logicalColumn.setPhysicalColumn( physicalColumn );