Search in sources :

Example 1 with WidgetDatasourceMap

use of com.hortonworks.streamline.registries.dashboard.entites.WidgetDatasourceMap in project streamline by hortonworks.

the class DashboardCatalogService method getWidgetDatasourceMapping.

public Set<Long> getWidgetDatasourceMapping(Widget widget) {
    List<QueryParam> queryParams = Collections.singletonList(new QueryParam(WidgetDatasourceMap.WIDGET_ID, widget.getId().toString()));
    Collection<WidgetDatasourceMap> mappings = dao.find(WIDGET_DATASOURCE_MAPPING_NAMESPACE, queryParams);
    if (mappings != null) {
        return mappings.stream().map(WidgetDatasourceMap::getWidgetId).collect(Collectors.toSet());
    }
    return Collections.emptySet();
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WidgetDatasourceMap(com.hortonworks.streamline.registries.dashboard.entites.WidgetDatasourceMap)

Example 2 with WidgetDatasourceMap

use of com.hortonworks.streamline.registries.dashboard.entites.WidgetDatasourceMap in project streamline by hortonworks.

the class DashboardCatalogService method addWidgetDatasourceMapping.

public void addWidgetDatasourceMapping(Widget widget, Set<Long> datasourceIds) {
    datasourceIds.forEach(datasourceId -> {
        ensureDatasourceExists(widget.getDashboardId(), datasourceId);
        dao.<WidgetDatasourceMap>add(new WidgetDatasourceMap(widget.getId(), datasourceId));
    });
}
Also used : WidgetDatasourceMap(com.hortonworks.streamline.registries.dashboard.entites.WidgetDatasourceMap)

Aggregations

WidgetDatasourceMap (com.hortonworks.streamline.registries.dashboard.entites.WidgetDatasourceMap)2 QueryParam (com.hortonworks.registries.common.QueryParam)1