use of com.thinkbiganalytics.metadata.api.datasource.JdbcDatasourceDetails 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());
}
}
Aggregations