/** * @return the IDs of the used business tables */ public String[] getLogicalTableIDs() { String[] names = new String[tables.size()]; for ( int i = 0; i < tables.size(); i++ ) { names[i] = tables.get( i ).getId(); } return names; }
private LogicalTable findOlapCloneForTableInDomain( LogicalTable supposedLTable, Domain domain ) { if ( supposedLTable.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { return supposedLTable; } for ( LogicalTable table : domain.getLogicalModels().get( 1 ).getLogicalTables() ) { if ( table.getId().equals( supposedLTable.getId() + BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { return table; } } throw new IllegalStateException( "Unable to find a OLAP copy for table: " + supposedLTable.getId() ); }
/** * finds a logical table within the model. * * @param tableId the table to find * @return a logical table object. */ public LogicalTable findLogicalTable( String tableId ) { for ( LogicalTable table : getLogicalTables() ) { if ( tableId.equals( table.getId() ) ) { return table; } } return null; }
@Override public List<String> getUniqueId() { List<String> uid = new ArrayList<String>( getParent().getUniqueId() ); uid.add( CLASS_ID.concat( UID_TYPE_SEPARATOR ) + getId() ); return uid; }
public String toString() { String thisPath = ""; //$NON-NLS-1$ for ( int i = 0; i < size(); i++ ) { LogicalRelationship relationship = getRelationship( i ); if ( i > 0 ) { thisPath += ", "; //$NON-NLS-1$ } thisPath += "[" + relationship.getFromTable().getId() + "-" + relationship.getToTable().getId() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return thisPath; }
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; }
private LogicalColumn findPrimaryKeyFor( LogicalModel model, LogicalTable factTable, LogicalTable dimTable ) { LogicalRelationship ship = model.findRelationshipUsing( dimTable, factTable ); if ( ship == null ) { throw new IllegalStateException( "Unable to find a primary key for table: " + dimTable.getId() ); } if ( ship.getFromTable().equals( dimTable ) ) { return ship.getFromColumn(); } else { return ship.getToColumn(); } }
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; }
public LogicalTable findLogicalTable( IPhysicalTable table, ModelerPerspective perspective ) { LogicalModel logicalModel = this.getLogicalModel( perspective ); if ( logicalModel == null ) { return null; } for ( LogicalTable logicalTable : logicalModel.getLogicalTables() ) { if ( logicalTable.getPhysicalTable().equals( table ) || logicalTable.getPhysicalTable().getId().equals( table.getId() ) || logicalTable.getId().equals( table.getId() ) ) { return logicalTable; // boolean isOlapTable = logicalTable.getId().endsWith(BaseModelerWorkspaceHelper.OLAP_SUFFIX); // if (perspective == ModelerPerspective.ANALYSIS && isOlapTable) { // return logicalTable; // } else if (perspective == ModelerPerspective.REPORTING && !isOlapTable) { // return logicalTable; // } } } return null; }
Map<String, String> LogicalTableToAliasMap = new HashMap<String, String>(); if ( !relation.rightAlias.equals( DEFAULT_ALIAS ) ) { LogicalTableToAliasMap.put( relation.relation.getToTable().getId(), relation.rightAlias ); LogicalTableToAliasMap.put( relation.relation.getFromTable().getId(), relation.leftAlias ); String rightAlias = relation.relation.getToTable().getId(); if ( !relation.rightAlias.equals( DEFAULT_ALIAS ) ) { rightAlias = rightAlias + "_" + relation.rightAlias; //$NON-NLS-1$ String leftAlias = relation.relation.getFromTable().getId(); if ( !relation.leftAlias.equals( DEFAULT_ALIAS ) ) { leftAlias = leftAlias + "_" + relation.leftAlias; //$NON-NLS-1$
@Override public Object onDrop( Object data ) throws ModelerException { try { MemberPropertyMetaData memberProp = null; if ( data instanceof AvailableField ) { ColumnBackedNode node = getWorkspace().createColumnBackedNode( (AvailableField) data, ModelerPerspective.ANALYSIS ); memberProp = getWorkspace().createMemberPropertyForParentWithNode( this, node ); } else if ( data instanceof MemberPropertyMetaData ) { memberProp = (MemberPropertyMetaData) data; memberProp.setParent( this ); } else { return null; } LogicalTable existingTable = getLogicalColumn().getLogicalTable(); LogicalColumn col = memberProp.getLogicalColumn(); if ( col == null ) { return null; } if ( col.getLogicalTable().getId() != existingTable.getId() ) { throw new IllegalStateException( ModelerMessagesHolder.getMessages().getString( "DROP.ERROR.MEMBER_PROP_FROM_DIFFERENT_TABLE" ) ); } return memberProp; } catch ( Exception e ) { throw new ModelerException( e ); } }
List<LogicalTable> olapTables = new ArrayList<LogicalTable>(); for ( LogicalTable table : combinedModel.getLogicalTables() ) { if ( table.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { table.setLogicalModel( olapModel ); olapTables.add( table );
if ( !table.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { table.getLogicalColumns().clear();
if ( table.getId().endsWith( BaseModelerWorkspaceHelper.OLAP_SUFFIX ) ) { table.getLogicalColumns().clear();
String tblName = selection.getLogicalColumn().getLogicalTable().getId(); if ( !selection.getAlias().equals( DEFAULT_ALIAS ) ) { tblName += "_" + selection.getAlias(); //$NON-NLS-1$