public String getTargetSchema() { return (String) getProperty( TARGET_SCHEMA ); }
public IPhysicalModel getPhysicalModel() { return (IPhysicalModel) getParent(); }
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 = ""; } }
SqlPhysicalTable physicalTable = new SqlPhysicalTable(); physicalTable.setId( id ); physicalTable.setTargetSchema( schemaName ); List<IPhysicalColumn> fields = physicalTable.getPhysicalColumns(); physicalTable.setTargetTable( tableName ); physicalTable.setName( new LocalizedString( locale, niceName ) ); physicalTable.setTableType( TableType.DIMENSION ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ physicalTable.setTableType( TableType.FACT ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
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 ); }
model.setDatasource( dataSource ); SqlPhysicalTable table = new SqlPhysicalTable( model ); table.setId( "INLINE_SQL_1" ); //$NON-NLS-1$ model.getPhysicalTables().add( table ); table.setTargetTableType( TargetTableType.INLINE_SQL ); table.setTargetTable( query ); String physicalColumnID = Settings.getPhysicalColumnIDPrefix() + "_" + columnHeader[i]; //$NON-NLS-1$ column.setId( physicalColumnID ); table.getPhysicalColumns().add( column );
public static final String proposeSqlBasedLogicalTableId( String locale, LogicalTable businessTable, SqlPhysicalTable physicalTable ) { String baseID = Util.toId( businessTable.getName( locale ) ); String namePart = Util.toId( Util.NVL( physicalTable.getName( locale ), physicalTable.getTargetTable() ) ); String id = Settings.getBusinessTableIDPrefix() + baseID + "_" + namePart; //$NON-NLS-1$ if ( Settings.isAnIdUppercase() ) { id = id.toUpperCase(); } return id; }
private LogicalTable createBusinessTable( SqlPhysicalTable physicalTable, String locale ) { // Create a business table with a new ID and localized name // LogicalTable businessTable = new LogicalTable( null, physicalTable ); // Try to set the name of the business table to something nice (beautify) // String tableName = PhysicalTableImporter.beautifyName( physicalTable.getTargetTable() ); businessTable.setName( new LocalizedString( locale, tableName ) ); businessTable.setId( Util.proposeSqlBasedLogicalTableId( locale, businessTable, physicalTable ) ); // Add columns to this by copying the physical columns to the business // columns... // for ( IPhysicalColumn physicalColumn : physicalTable.getPhysicalColumns() ) { LogicalColumn businessColumn = new LogicalColumn(); businessColumn.setPhysicalColumn( physicalColumn ); businessColumn.setLogicalTable( businessTable ); // We're done, add the business column. // // Propose a new ID businessColumn.setId( Util.proposeSqlBasedLogicalColumnId( locale, businessTable, (SqlPhysicalColumn) physicalColumn ) ); businessTable.addLogicalColumn( businessColumn ); } return businessTable; }
SqlPhysicalTable table = new SqlPhysicalTable( model ); table.setId( physicalTable.getAttribute( "name" ) ); //$NON-NLS-1$ xmiConceptMap.put( physicalTable.getAttribute( "xmi.id" ), table ); //$NON-NLS-1$ model.addPhysicalTable( table ); col.setId( colelement.getAttribute( "name" ) ); //$NON-NLS-1$ xmiConceptMap.put( colelement.getAttribute( "xmi.id" ), col ); //$NON-NLS-1$ table.addPhysicalColumn( col ); bindParentConcept( colelement, domain, col );
cwmRdbTable.setAttribute( "isSystem", "false" ); //$NON-NLS-1$ //$NON-NLS-2$ cwmRdbTable.setAttribute( "isTemporary", "false" ); //$NON-NLS-1$ //$NON-NLS-2$ cwmRdbTable.setAttribute( "name", table.getId() ); //$NON-NLS-1$ String idstr = idGen.getNextId(); cwmRdbTable.setAttribute( "xmi.id", idstr ); //$NON-NLS-1$ "TABLE_TARGET_DATABASE_NAME", model.getId(), idGen.getNextId() ) ); //$NON-NLS-1$ if ( table.getParentConcept() != null ) { if ( modelElement == null ) { modelElement = doc.createElement( "CWM:ModelElement.taggedValue" ); //$NON-NLS-1$ "CONCEPT_PARENT_NAME", table.getParentConcept().getId(), idGen.getNextId() ) ); //$NON-NLS-1$ for ( IPhysicalColumn column : table.getPhysicalColumns() ) { SqlPhysicalColumn sqlColumn = (SqlPhysicalColumn) column; Element rdbColumn = doc.createElement( "CWMRDB:Column" ); //$NON-NLS-1$
SqlPhysicalTable sqlTable = new SqlPhysicalTable( sqlModel ); sqlTable.setTargetTableType( TargetTableType.INLINE_SQL ); SqlPhysicalColumn sqlColumn = new SqlPhysicalColumn( sqlTable ); convertConceptFromLegacy( column, sqlColumn ); sqlTable.getPhysicalColumns().add( sqlColumn );
convertConceptToLegacy( table, physicalTable ); for ( IPhysicalColumn col : sqlTable.getPhysicalColumns() ) { PhysicalColumn column = new PhysicalColumn(); column.setTable( physicalTable );
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 ); }
public Integer getRelativeSize() { return (Integer) getProperty( RELATIVE_SIZE ); }
targetTable = ( (SqlPhysicalTable) domain.getPhysicalModels().get( 0 ).getPhysicalTables().get( 0 ) ).getTargetTable(); DatasourceDTO datasource = null;
public String getTargetTable() { return (String) getProperty( TARGET_TABLE ); }
public TargetTableType getTargetTableType() { return (TargetTableType) getProperty( TARGET_TABLE_TYPE ); }
public TableType getTableType() { return (TableType) getProperty( TABLETYPE_PROPERTY ); }
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() ); }