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 Domain getDomain() { return (Domain) getParent(); }
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 ); }
LocaleType locale = new LocaleType( LocalizedString.DEFAULT_LOCALE, Locale.US.getDisplayName() ); if ( validate() ) { SqlPhysicalModel model = new SqlPhysicalModel(); String modelID = Settings.getBusinessModelIDPrefix() + modelName; model.setId( modelID ); model.setName( new LocalizedString( locale.getCode(), modelName ) ); SqlDataSource dataSource = new SqlDataSource(); dataSource.getAttributes().put( "QUOTE_ALL_FIELDS", "Y" ); //$NON-NLS-1$ //$NON-NLS-2$ model.setDatasource( dataSource ); model.getPhysicalTables().add( table ); table.setTargetTableType( TargetTableType.INLINE_SQL ); table.setTargetTable( query );
domain.setLocales( locales ); SqlPhysicalModel physicalModel = new SqlPhysicalModel(); physicalModel.setId( databaseMeta.getName() ); physicalModel.setDatasource( ThinModelConverter.convertFromLegacy( databaseMeta ) ); PhysicalTableImporter.importTableDefinition( database, schemaTable.getSchemaName(), schemaTable .getTableName(), locale, importStrategy ); physicalModel.addPhysicalTable( physicalTable );
@Override public List<String> getUniqueId() { List<String> uid = new ArrayList<String>(); uid.add( CLASS_ID.concat( UID_TYPE_SEPARATOR ) + getId() ); return uid; }
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 ); }
SqlPhysicalModel sqlModel = new SqlPhysicalModel(); sqlModel.setDatasource( dataSource ); sqlModel.setId( database.getName() ); sqlTable.getPhysicalColumns().add( sqlColumn ); sqlModel.getPhysicalTables().add( sqlTable );
SqlPhysicalModel sqlPhysicalModel = new SqlPhysicalModel(); domain.addPhysicalModel( sqlPhysicalModel ); SqlDataSource sqlDataSource = new SqlDataSource(); sqlPhysicalModel.setDatasource( sqlDataSource ); sqlPhysicalModel.setId( name ); Map<String, String> kvp = logger.warn( Messages.getErrorString( "XmiParser.ERROR_0009_MISSING_DATABASE_PARENT", name ) ); //$NON-NLS-1$ if ( missingParentModel == null ) { missingParentModel = new SqlPhysicalModel(); missingParentModel.setId( "__MISSING_PARENT_PHYSICAL_MODEL__" ); //$NON-NLS-1$ domain.addPhysicalModel( missingParentModel ); table.setId( physicalTable.getAttribute( "name" ) ); //$NON-NLS-1$ xmiConceptMap.put( physicalTable.getAttribute( "xmi.id" ), table ); //$NON-NLS-1$ model.addPhysicalTable( table ); bindParentConcept( physicalTable, domain, table ); NodeList columns = owned.getElementsByTagName( "CWMRDB:Column" ); //$NON-NLS-1$
public static String getMondrianDatasource( Domain domain ) { return ( (SqlPhysicalModel) domain.getPhysicalModels().get( 0 ) ).getId(); }
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 = ""; } }
SqlDataSource datasource = sqlModel.getDatasource(); Element catalog = doc.createElement( "CWMRDB:Catalog" ); //$NON-NLS-1$ catalog.setAttribute( "name", model.getId() ); //$NON-NLS-1$ if ( model instanceof SqlPhysicalModel ) { SqlPhysicalModel sqlModel = (SqlPhysicalModel) model; for ( SqlPhysicalTable table : sqlModel.getPhysicalTables() ) { Element cwmRdbTable = doc.createElement( "CWMRDB:Table" ); //$NON-NLS-1$ cwmRdbTable.setAttribute( "isAbstract", "false" ); //$NON-NLS-1$ //$NON-NLS-2$
.getId() + "\""; //$NON-NLS-1$ String catDef = "solution:" + solutionStorage + RepositoryFile.SEPARATOR //$NON-NLS-1$ + "resources" + RepositoryFile.SEPARATOR + "metadata" + RepositoryFile.SEPARATOR + file
if ( sqlModel.getDatasource().getType() == DataSourceType.JNDI ) { database = new DatabaseMeta( ( (SqlPhysicalModel) physicalModel ).getDatasource().getDatabaseName(), "MYSQL", //$NON-NLS-1$ "JNDI", "", "", "", "", "" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ database.getDatabaseInterface().setDatabaseName( ( (SqlPhysicalModel) physicalModel ).getDatasource().getDatabaseName() ); for ( IPhysicalTable table : sqlModel.getPhysicalTables() ) { SqlPhysicalTable sqlTable = (SqlPhysicalTable) table; PhysicalTable physicalTable = new PhysicalTable();