Search in sources :

Example 6 with TableModelerSource

use of org.pentaho.agilebi.modeler.util.TableModelerSource in project data-access by pentaho.

the class ModelerService method generateCSVDomain.

public Domain generateCSVDomain(ModelInfo modelInfo) throws Exception {
    initKettle();
    try {
        DatabaseMeta database = getDatabaseMeta();
        final String tableName = modelInfo.getStageTableName();
        final String datasourceName = modelInfo.getDatasourceName();
        Column[] columns = toColumns(modelInfo.getColumns());
        PhysicalTableImporter.ImportStrategy importStrategy = new CsvDatasourceImportStrategy(columns);
        TableModelerSource source = createTableModelerSource(database, tableName, null, datasourceName);
        return source.generateDomain(importStrategy);
    } catch (Exception e) {
        logger.error(e);
        throw new Exception(e.getLocalizedMessage());
    }
}
Also used : PhysicalTableImporter(org.pentaho.metadata.automodel.PhysicalTableImporter) TableModelerSource(org.pentaho.agilebi.modeler.util.TableModelerSource) CsvDatasourceImportStrategy(org.pentaho.metadata.automodel.importing.strategy.CsvDatasourceImportStrategy) Column(org.pentaho.metadata.model.thin.Column) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

Aggregations

TableModelerSource (org.pentaho.agilebi.modeler.util.TableModelerSource)6 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)6 KettleException (org.pentaho.di.core.exception.KettleException)3 ArrayList (java.util.ArrayList)2 IModelerSource (org.pentaho.agilebi.modeler.IModelerSource)2 CsvDatasourceImportStrategy (org.pentaho.metadata.automodel.importing.strategy.CsvDatasourceImportStrategy)2 Domain (org.pentaho.metadata.model.Domain)2 OlapDimension (org.pentaho.metadata.model.olap.OlapDimension)2 DatasourceMgmtServiceException (org.pentaho.platform.api.repository.datasource.DatasourceMgmtServiceException)2 DuplicateDatasourceException (org.pentaho.platform.api.repository.datasource.DuplicateDatasourceException)2 NonExistingDatasourceException (org.pentaho.platform.api.repository.datasource.NonExistingDatasourceException)2 DataAccessException (org.springframework.dao.DataAccessException)2 UsernameNotFoundException (org.springframework.security.core.userdetails.UsernameNotFoundException)2 IOException (java.io.IOException)1 Test (org.junit.Test)1 PhysicalTableImporter (org.pentaho.metadata.automodel.PhysicalTableImporter)1 Column (org.pentaho.metadata.model.thin.Column)1 ColumnInfo (org.pentaho.platform.dataaccess.datasource.wizard.models.ColumnInfo)1 ModelInfo (org.pentaho.platform.dataaccess.datasource.wizard.models.ModelInfo)1 InlineSqlModelerSource (org.pentaho.platform.dataaccess.datasource.wizard.service.impl.utils.InlineSqlModelerSource)1