public String toString() { StringBuffer buff = new StringBuffer(); buff.append( "Node[" + id + "]: Table " ); if ( ( table != null ) && ( table.getPhysicalTable() != null ) ) { buff.append( table.getPhysicalTable().getName( "" ) ); } else if ( table != null ) { buff.append( table.getName( "" ) ); // Business Table } else { buff.append( "*null*" ); // Business } return buff.toString(); } }
protected void populateAvailableFields() { if ( physicalTable != null ) { for ( IPhysicalColumn column : physicalTable.getPhysicalColumns() ) { AvailableField field = new AvailableField( column ); availableFields.add( field ); } } Collections.sort( this.availableFields, itemComparator ); }
private LogicalTable findFactTable( String table, LogicalModel logicalModel ) { LogicalTable factTable = null; for ( LogicalTable lTable : logicalModel.getLogicalTables() ) { if ( lTable.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { Object prop = lTable.getPhysicalTable().getProperty( "target_table" ); if ( prop != null && prop.equals( table ) ) { factTable = lTable; break; } } } return factTable; }
if ( !tableIds.contains( table.getId() ) ) { tableIds.add( table.getId() ); String catName = BaseModelerWorkspaceHelper.getCleanCategoryName( table.getName( locale ), workspace, tableIds.size() ); if ( aTable.isSameUnderlyingPhysicalTable( table ) ) { for ( AvailableField field : aTable.getAvailableFields() ) { if ( field.getPhysicalColumn().getPhysicalTable().getId().equals( table.getId() ) ) { category.add( workspace.createFieldForParentWithNode( category, field ) );
boolean isFact = table.getProperty( "FACT_TABLE" ) != null ? (Boolean) table.getProperty( "FACT_TABLE" ) : false; items.add( new AvailableTable( table, isFact ) ); 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 ( AvailableField f : table.getAvailableFields() ) { if ( f.getPhysicalColumn().getId().equals( lm.getLogicalColumn().getPhysicalColumn().getId() ) && f.getPhysicalColumn().getPhysicalTable().getId().equals( lm.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ) ) { for ( AvailableField f : table.getAvailableFields() ) { if ( f.getPhysicalColumn().getId().equals( field.getLogicalColumn().getPhysicalColumn().getId() ) && f.getPhysicalColumn().getPhysicalTable().getId().equals( field.getLogicalColumn().getPhysicalColumn().getPhysicalTable().getId() ) ) {
logicalModel.setPhysicalModel( physTable.getPhysicalModel() ); col.setLogicalTable( parent ); parent.addLogicalColumn( col ); for ( IPhysicalColumn phycol : parent.getPhysicalTable().getPhysicalColumns() ) { if ( phycol.getId().equals( pcol ) ) { col.setPhysicalColumn( phycol );
throw new IllegalStateException( "Fact table not found" ); } else { factTable.getPhysicalTable().setProperty( "FACT_TABLE", true ); workspace.getAvailableTables().setFactTable( factTable.getPhysicalTable() ); businessTable.setName( new LocalizedString( locale, businessTable.getPhysicalTable().getName( locale ) ) ); businessTable.setName( new LocalizedString( locale, businessTable.getPhysicalTable().getName( locale ) ) );
for ( IPhysicalModel physicalModel : domain.getPhysicalModels() ) { for ( IPhysicalTable physicalTable : physicalModel.getPhysicalTables() ) { physicalTable.setName( new LocalizedString( locale, datasourceName ) ); businessTable.setName( new LocalizedString( locale, businessTable.getPhysicalTable().getName( locale ) ) );
private void assignFactTable( final ModelerWorkspace workspace ) { List<LogicalTable> logicalTables = workspace.getLogicalModel( ModelerPerspective.ANALYSIS ).getLogicalTables(); logicalTables.get( 0 ).getPhysicalTable().setProperty( "FACT_TABLE", true ); }
private boolean isFactTable( IPhysicalTable table ) { String agileBiVersion = (String) getWorkspace().getLogicalModel( ModelerPerspective.ANALYSIS ).getProperty( "AGILE_BI_VERSION" ); if ( agileBiVersion != null && Float.parseFloat( agileBiVersion ) >= 2.0 ) { // if we're in a multi-table mode check for a fact table if ( getWorkspace().getAvailableTables().size() > 1 ) { Object factProp = table.getProperty( "FACT_TABLE" ); if ( factProp == null || factProp.equals( Boolean.FALSE ) ) { return false; } else { return true; } } } return false; }
IPhysicalTable physicalTable = domain.findPhysicalTable( businessTable.getPhysicalTable().getId() ); if ( physicalTable != null && logicalModel.getPhysicalModel() == null ) { logicalModel.setPhysicalModel( physicalTable.getPhysicalModel() ); for ( IPhysicalColumn physicalColumn : physicalTable.getPhysicalColumns() ) { if ( physicalColumn.getId().equals( column.getPhysicalColumn().getId() ) ) { logicalColumn.setPhysicalColumn( physicalColumn );
protected static LogicalTable findCorrespondingOlapTable( LogicalTable relationalTable, LogicalModel olapModel ) { for ( LogicalTable table : olapModel.getLogicalTables() ) { if ( table.getPhysicalTable().getId().equals( relationalTable.getPhysicalTable().getId() ) ) { return table; } } return null; }
private void addFieldsToTables( Domain domain, AbstractModelList<JoinTableModel> availableTables ) { String locale = LocalizedString.DEFAULT_LOCALE; Outter: for ( JoinTableModel table : availableTables ) { for ( LogicalTable tbl : domain.getLogicalModels().get( 0 ).getLogicalTables() ) { if ( tbl.getPhysicalTable().getProperty( "target_table" ).equals( table.getName() ) ) { for ( LogicalColumn col : tbl.getLogicalColumns() ) { JoinFieldModel field = new JoinFieldModel(); field.setName( col.getName( locale ) ); field.setParentTable( table ); table.getFields().add( field ); } continue Outter; } } } }
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 setPhysicalTable( IPhysicalTable physicalTable ) { this.physicalTable = physicalTable; setName( physicalTable.getName( LocalizedString.DEFAULT_LOCALE ) ); availableFields = new ArrayList<AvailableField>(); populateAvailableFields(); }
Object factProp = col.getLogicalTable().getPhysicalTable().getProperty( "FACT_TABLE" ); if ( factProp == null || factProp.equals( Boolean.FALSE ) ) { throw new IllegalStateException( ModelerMessagesHolder.getMessages()
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 ); } } }
public void changeColumn( String columnType ) { Object selectedTreeItem = getSelectedTreeItem(); if ( selectedTreeItem == null ) { return; } ColumnBackedNode selectedColumnBackedNode = (ColumnBackedNode) selectedTreeItem; // only restrict to a table if this node needs to & the node has siblings that might conflict when changing the // parent IPhysicalTable restrictedPhysicalTable = selectedColumnBackedNode.getTableRestriction(); if ( restrictedPhysicalTable == null ) { colController.show( workspace, selectedColumnBackedNode, columnType ); return; } AvailableTable restrictToTable = null; AvailableItemCollection availableTables = workspace.getAvailableTables(); String name = restrictedPhysicalTable.getName( getWorkspaceHelper().getLocale() ); restrictToTable = availableTables.findAvailableTable( name ); colController.show( workspace, selectedColumnBackedNode, columnType, restrictToTable ); }