Search in sources :

Example 1 with DatasourceDetails

use of com.thinkbiganalytics.metadata.api.datasource.DatasourceDetails in project kylo by Teradata.

the class DatasourceModelTransform method toDatasource.

/**
 * Transforms the specified domain object to a REST object.
 *
 * @param domain the domain object
 * @param level  the level of detail
 * @return the REST object
 * @throws IllegalArgumentException if the domain object cannot be converted
 */
public UserDatasource toDatasource(@Nonnull final com.thinkbiganalytics.metadata.api.datasource.UserDatasource domain, @Nonnull final Level level) {
    final DatasourceDetails details = domain.getDetails().orElse(null);
    if (details == null) {
        final UserDatasource userDatasource = new UserDatasource();
        updateDatasource(userDatasource, domain, level);
        return userDatasource;
    } else if (details instanceof JdbcDatasourceDetails) {
        final JdbcDatasource jdbcDatasource = new JdbcDatasource();
        updateDatasource(jdbcDatasource, domain, level);
        return jdbcDatasource;
    } else {
        throw new IllegalArgumentException("Not a supported datasource details class: " + details.getClass());
    }
}
Also used : JdbcDatasource(com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource) UserDatasource(com.thinkbiganalytics.metadata.rest.model.data.UserDatasource) JdbcDatasourceDetails(com.thinkbiganalytics.metadata.api.datasource.JdbcDatasourceDetails) DatasourceDetails(com.thinkbiganalytics.metadata.api.datasource.DatasourceDetails) JdbcDatasourceDetails(com.thinkbiganalytics.metadata.api.datasource.JdbcDatasourceDetails)

Aggregations

DatasourceDetails (com.thinkbiganalytics.metadata.api.datasource.DatasourceDetails)1 JdbcDatasourceDetails (com.thinkbiganalytics.metadata.api.datasource.JdbcDatasourceDetails)1 JdbcDatasource (com.thinkbiganalytics.metadata.rest.model.data.JdbcDatasource)1 UserDatasource (com.thinkbiganalytics.metadata.rest.model.data.UserDatasource)1