public boolean isSameUnderlyingPhysicalColumn( IPhysicalColumn column ) { IPhysicalTable table = column.getPhysicalTable(); return getPhysicalColumn().getId().equals( column.getId() ) && getPhysicalColumn().getPhysicalTable().getId().equals( table.getId() ); } }
protected String getColumnNameFromLogicalColumn( LogicalColumn col ) { String columnName = ""; //$NON-NLS-1$ if ( col != null ) { IPhysicalColumn physicalColumn = col.getPhysicalColumn(); if ( physicalColumn != null ) { columnName = physicalColumn.getName( locale ); } } return columnName; }
public ColumnBackedNode createColumnBackedNode( AvailableField field, ModelerPerspective perspective ) { String locale = workspaceHelper.getLocale(); ColumnBackedNode node = new BaseColumnBackedMetaData( field.getName() ); LogicalTable lTab = findLogicalTable( field.getPhysicalColumn().getPhysicalTable(), perspective ); LogicalColumn lCol = null; lCol.setDataType( field.getPhysicalColumn().getDataType() ); if ( field.getPhysicalColumn().getAggregationList() != null ) { lCol.setAggregationList( field.getPhysicalColumn().getAggregationList() ); if ( field.getPhysicalColumn().getAggregationType() != null ) { lCol.setAggregationType( field.getPhysicalColumn().getAggregationType() ); lCol.setName( new LocalizedString( locale, field.getPhysicalColumn().getName( locale ) ) ); String colId = "LC_" + toId( lTab.getPhysicalTable().getName( locale ) ) + "_" + toId( field.getPhysicalColumn().getId() );
public GeoRole matchColumnToGeoRole( IPhysicalColumn column ) { for ( GeoRole role : this ) { if ( role.evaluate( column.getId() ) ) { return role; } } return null; }
@Override public boolean acceptsDrop( Object obj ) { String myTableId = this.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId(); if ( obj instanceof AvailableField ) { AvailableField field = (AvailableField) obj; return myTableId.equals( field.getPhysicalColumn().getPhysicalTable().getId() ); } else if ( obj instanceof MemberPropertyMetaData ) { MemberPropertyMetaData field = (MemberPropertyMetaData) obj; if ( field.getLogicalColumn() != null ) { return myTableId.equals( field.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ); } } return false; }
olapCol.setDataType( col.getDataType() ); if ( col.getPhysicalColumn().getAggregationList() != null ) { olapCol.setAggregationList( col.getPhysicalColumn().getAggregationList() ); if ( col.getPhysicalColumn().getAggregationType() != null ) { olapCol.setAggregationType( col.getPhysicalColumn().getAggregationType() ); } else { if ( olapCol.getDataType().equals( DataType.NUMERIC ) ) { + ModelerWorkspace.toId( col.getPhysicalColumn().getId() ) + BaseModelerWorkspaceHelper.OLAP_SUFFIX;
if ( logicalColumn.getPhysicalColumn().getProperty( "target_column" ).equals( joinModel.getLeftKeyFieldModel().getName() ) ) { fromColumn = logicalColumn; if ( logicalColumn.getPhysicalColumn().getProperty( "target_column" ).equals( joinModel.getRightKeyFieldModel().getName() ) ) { toColumn = logicalColumn;
DataType dataType = field.getPhysicalColumn().getDataType(); if ( dataType == DataType.NUMERIC ) { if ( !existingMeasures.contains( field.getName() ) ) {
public GeoRole matchFieldToGeoRole( AvailableField field ) { for ( GeoRole role : this ) { if ( role.evaluate( field.getPhysicalColumn().getId() ) ) { return role; } else if ( field.getPhysicalColumn().getId().startsWith( "pc__" ) ) { // sql data sources prefix the column ids with pc__, if that is detected just match with out it if ( role.evaluate( field.getPhysicalColumn().getId().substring( 4 ) ) ) { return role; } } } return null; }
@Override public boolean acceptsDrop( Object obj ) { boolean isSupportedType = false; isSupportedType = ( obj instanceof AvailableField || obj instanceof LevelMetaData || obj instanceof MeasureMetaData || obj instanceof MemberPropertyMetaData ); // get the columns of children, make sure the potential drop object is backed by the same table if ( isSupportedType ) { if ( size() == 0 ) { // no children to compare tables with, accept the drop return true; } LevelMetaData level = this.get( 0 ); if ( level.getLogicalColumn() == null ) { return false; // make them fix the broken column first } String myTableId = level.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId(); if ( obj instanceof AvailableField ) { AvailableField field = (AvailableField) obj; return myTableId.equals( field.getPhysicalColumn().getPhysicalTable().getId() ); } else if ( obj instanceof ColumnBackedNode ) { // this will take care of both Levels & Measures ColumnBackedNode field = (ColumnBackedNode) obj; return myTableId.equals( field.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ); } } return false; }
logicalColumn ) ) { String targetColumn = (String) logicalColumn.getPhysicalColumn().getProperty( SqlPhysicalColumn.TARGET_COLUMN ); MeasureMetaData measureMetaData = new MeasureMetaData( targetColumn,
for ( AvailableField field : table.getAvailableFields() ) { DataType dataType = field.getPhysicalColumn().getDataType(); if ( dataType == DataType.NUMERIC ) { if ( !existingMeasures.contains( field.getName() ) ) {
public LogicalColumn findLogicalColumn( IPhysicalColumn column, ModelerPerspective perspective ) { LogicalColumn col = null; IPhysicalTable physicalTable = column.getPhysicalTable(); LogicalModel logicalModel = this.getLogicalModel( perspective ); if ( logicalModel == null ) { return col; } for ( LogicalTable table : logicalModel.getLogicalTables() ) { if ( table.getPhysicalTable().getId().equals( physicalTable.getId() ) ) { if ( ( perspective == ModelerPerspective.ANALYSIS && table.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) || ( perspective == ModelerPerspective.REPORTING && !table.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) ) { for ( LogicalColumn lCol : table.getLogicalColumns() ) { if ( lCol.getPhysicalColumn().getId().equals( column.getId() ) ) { return lCol; } } } } } return col; }
protected static LogicalColumn findCorrespondingOlapColumn( LogicalColumn relationalColumn, LogicalModel olapModel ) { LogicalTable olapTable = findCorrespondingOlapTable( relationalColumn.getLogicalTable(), olapModel ); if ( olapTable != null ) { for ( LogicalColumn col : olapTable.getLogicalColumns() ) { if ( col.getPhysicalColumn().getId().equals( relationalColumn.getPhysicalColumn().getId() ) ) { return col; } } } return null; }
@Override public IPhysicalTable getTableRestriction() { // if the level has children (member props), restrict to the current table if ( this.size() > 0 && this.getLogicalColumn() != null ) { return this.getLogicalColumn().getPhysicalColumn().getPhysicalTable(); } // restricted by siblings table if ( parent != null && parent.size() > 0 ) { for ( LevelMetaData sibling : getHierarchyMetaData() ) { if ( sibling != this && sibling.getLogicalColumn() != null ) { return sibling.getLogicalColumn().getPhysicalColumn().getPhysicalTable(); } } } return null; }
@Bindable public void setColumnName( LogicalColumn col ) { String prevName = this.colName; // TODO: GWT LanguageChoice.getInstance().getDefaultLocale().toString() this.colName = ( col != null && col.getPhysicalColumn() != null ) ? col.getPhysicalColumn().getName( locale ) : ""; //$NON-NLS-1$ this.firePropertyChange( "columnName", prevName, this.colName ); //$NON-NLS-1$ }
for ( AvailableTable table : tablesList ) { for ( AvailableField f : table.getAvailableFields() ) { if ( f.getPhysicalColumn().getId().equals( measure.getLogicalColumn().getPhysicalColumn().getId() ) && f.getPhysicalColumn().getPhysicalTable().getId().equals( measure.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ) ) { for ( AvailableTable table : tablesList ) { for ( AvailableField f : table.getAvailableFields() ) { if ( f.getPhysicalColumn().getId().equals( lm.getLogicalColumn().getPhysicalColumn().getId() ) && f.getPhysicalColumn().getPhysicalTable().getId().equals( lm.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ) ) { for ( AvailableTable table : tablesList ) { for ( AvailableField f : table.getAvailableFields() ) { if ( f.getPhysicalColumn().getId().equals( field.getLogicalColumn().getPhysicalColumn().getId() ) && f.getPhysicalColumn().getPhysicalTable().getId().equals( field.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ) ) {
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 ); } } }
@Override public IPhysicalTable getTableRestriction() { // restrict to the table of the parent Level if ( ( (LevelMetaData) getParent() ).getLogicalColumn() != null ) { return ( (LevelMetaData) getParent() ).getLogicalColumn().getPhysicalColumn().getPhysicalTable(); } return ( (LevelMetaData) getParent() ).getTableRestriction(); } }
public AvailableField( IPhysicalColumn physicalColumn ) { setPhysicalColumn( physicalColumn ); setName( physicalColumn.getName( LocalizedString.DEFAULT_LOCALE ) ); setImage( FIELD_IMAGE ); setClassname( CLASS_NAME ); }