public void resolveConnectionFromDomain() { // set up the datasource if ( domain != null && source != null ) { domain.getPhysicalModels().get( 0 ); // TODO: resolve GWT DatabaseMeta databaseMeta = ThinModelConverter.convertToLegacy(physicalModel.getId(), // physicalModel.getDatasource()); // TODO: resolve GWT source.setDatabaseMeta(databaseMeta); } }
public boolean supportsBusinessData( BusinessData businessData ) { return ( businessData.getDomain().getPhysicalModels().get( 0 ) instanceof SqlPhysicalModel ); }
public static String getMondrianDatasource( Domain domain ) { return ( (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ) ).getId(); }
/** * find a physical table in the domain * * @param tableId * the table id * @return physical table */ public IPhysicalModel findPhysicalModel( String modelId ) { for ( IPhysicalModel model : getPhysicalModels() ) { if ( modelId.equals( model.getId() ) ) { return model; } } return null; }
/** * find a physical table in the domain * * @param tableId * the table id * @return physical table */ public IPhysicalTable findPhysicalTable( String tableId ) { for ( IPhysicalModel model : getPhysicalModels() ) { for ( IPhysicalTable table : model.getPhysicalTables() ) { if ( tableId.equals( table.getId() ) ) { return table; } } } return null; }
public BusinessData loadBusinessData( String domainId, String modelId ) throws DatasourceServiceException { Domain domain = getMetadataDomainRepository().getDomain( domainId ); List<List<String>> data = null; if ( domain.getPhysicalModels().get( 0 ) instanceof InlineEtlPhysicalModel ) { InlineEtlPhysicalModel model = (InlineEtlPhysicalModel) domain.getPhysicalModels().get( 0 ); data = DatasourceInMemoryServiceHelper.getCsvDataSample( model.getFileLocation(), model.getHeaderPresent(), model .getDelimiter(), model.getEnclosure(), 5 ); } else { SqlPhysicalModel model = (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ); String query = model.getPhysicalTables().get( 0 ).getTargetTable(); SerializedResultSet resultSet = DatasourceInMemoryServiceHelper .getSerializeableResultSet( model.getDatasource().getDatabaseName(), query, 5, null ); data = resultSet.getData(); } return new BusinessData( domain, data ); }
public void initialize( Domain domain ) throws ModelerException { SqlPhysicalModel model = (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ); SqlPhysicalTable table = model.getPhysicalTables().get( 0 ); String targetTable = (String) table.getProperty( "target_table" ); //$NON-NLS-1$ if ( !StringUtils.isEmpty( targetTable ) ) { domain.setId( targetTable ); } this.databaseMeta = ThinModelConverter.convertToLegacy( model.getId(), model.getDatasource() ); }
public void initialize( Domain domain ) throws ModelerException { SqlPhysicalModel model = (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ); SqlPhysicalTable table = model.getPhysicalTables().get( 0 ); String targetTable = (String) table.getProperty( "target_table" ); if ( !StringUtils.isEmpty( targetTable ) ) { domain.setId( targetTable ); } this.databaseMeta = ThinModelConverter.convertToLegacy( model.getId(), model.getDatasource() ); this.tableName = table.getTargetTable(); this.schemaName = table.getTargetSchema(); if ( schemaName == null ) { schemaName = ""; } }
public BusinessData loadBusinessData( String domainId, String modelId ) throws DatasourceServiceException { Domain domain = getMetadataDomainRepository().getDomain( domainId ); List<List<String>> data = null; if ( domain.getPhysicalModels().get( 0 ) instanceof InlineEtlPhysicalModel ) { InlineEtlPhysicalModel model = (InlineEtlPhysicalModel) domain.getPhysicalModels().get( 0 ); String relativePath = PentahoSystem.getSystemSetting( "file-upload-defaults/relative-path", String.valueOf( CsvTransformGenerator.DEFAULT_RELATIVE_UPLOAD_FILE_PATH ) ); //$NON-NLS-1$ String csvFileLoc = PentahoSystem.getApplicationContext().getSolutionPath( relativePath ); data = DatasourceServiceHelper.getCsvDataSample( csvFileLoc + model.getFileLocation(), model.getHeaderPresent(), model.getDelimiter(), model.getEnclosure(), 5 ); } else { SqlPhysicalModel model = (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ); String query = model.getPhysicalTables().get( 0 ).getTargetTable(); SerializedResultSet resultSet = DatasourceServiceHelper.getSerializeableResultSet( model.getDatasource().getDatabaseName(), query, 5, PentahoSessionHolder.getSession() ); data = resultSet.getData(); } return new BusinessData( domain, data ); }
private void moveDimensionToModel( final ModelerWorkspace dimensionWorkspace, final ModelerWorkspace factWorkspace, final String factKey, final String dimKey ) throws ModelerException { DimensionMetaData dimension = getLastDimension( dimensionWorkspace ); dimension.setName( getName() ); removeExistingDimension( factWorkspace ); factWorkspace.addDimension( dimension ); LogicalTable dimTable = dimensionWorkspace.getLogicalModel( ModelerPerspective.ANALYSIS ).getLogicalTables().get( 0 ); LogicalTable factTable = factWorkspace.getLogicalModel( ModelerPerspective.ANALYSIS ).getLogicalTables().get( 0 ); LogicalModel logicalModel = factWorkspace.getLogicalModel( ModelerPerspective.ANALYSIS ); logicalModel.addLogicalTable( dimTable ); @SuppressWarnings( "unchecked" ) List<SqlPhysicalTable> physicalTables = (List<SqlPhysicalTable>) factWorkspace.getDomain().getPhysicalModels().get( 0 ).getPhysicalTables(); physicalTables.add( (SqlPhysicalTable) dimTable.getPhysicalTable() ); logicalModel.addLogicalRelationship( new LogicalRelationship( logicalModel, factTable, dimTable, locateLogicalColumn( factWorkspace, factKey ), locateLogicalColumn( dimensionWorkspace, dimKey ) ) ); }
for ( IPhysicalModel model : domain.getPhysicalModels() ) { if ( model.getId().equals( "__MISSING_PARENT_PHYSICAL_MODEL__" ) ) { //$NON-NLS-1$ continue; for ( IPhysicalModel model : domain.getPhysicalModels() ) { if ( model instanceof SqlPhysicalModel ) { SqlPhysicalModel sqlModel = (SqlPhysicalModel) model;
"Provider=mondrian;DataSource=\"" + ( (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ) ) .getId() + "\""; //$NON-NLS-1$ String catDef = "solution:" + solutionStorage + RepositoryFile.SEPARATOR //$NON-NLS-1$
List<? extends IPhysicalTable> tables = workspace.getDomain().getPhysicalModels().get( 0 ).getPhysicalTables(); Set<String> tableIds = new HashSet<String>();
for ( IPhysicalTable table : domain.getPhysicalModels().get( 0 ).getPhysicalTables() ) { Boolean isFact = (Boolean) table.getProperty( "FACT_TABLE" ); items.add( new AvailableTable( table, isFact == null ? false : isFact.booleanValue() ) );
generator.setTableNames( tableNames ); domain = generator.generateDomain( importStrategy ); for ( IPhysicalModel physicalModel : domain.getPhysicalModels() ) { for ( IPhysicalTable physicalTable : physicalModel.getPhysicalTables() ) { physicalTable.setName( new LocalizedString( locale, datasourceName ) );
targetTable = ( (SqlPhysicalTable) domain.getPhysicalModels().get( 0 ).getPhysicalTables().get( 0 ) ).getTargetTable(); DatasourceDTO datasource = null;
.getSession() != null ) ? PentahoSessionHolder.getSession().getName() : null ); Domain domain = sqlModelGenerator.generate(); domain.getPhysicalModels().get( 0 ).setId( connection.getName() );
public void refresh( Domain newDomain ) throws ModelerException { for ( IPhysicalTable table : newDomain.getPhysicalModels().get( 0 ).getPhysicalTables() ) { boolean isFact = table.getProperty( "FACT_TABLE" ) != null ? (Boolean) table.getProperty( "FACT_TABLE" ) : false; items.add( new AvailableTable( table, isFact ) );
for ( IPhysicalModel physicalModel : domain.getPhysicalModels() ) { if ( physicalModel instanceof SqlPhysicalModel ) { SqlPhysicalModel sqlModel = (SqlPhysicalModel) physicalModel;