Search in sources :

Example 6 with Widget

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

the class DashboardCatalogResource method getWidget.

@GET
@Path("/{dashboardId}/widgets/{widgetId}")
@Timed
public Response getWidget(@PathParam("dashboardId") Long dashboardId, @PathParam("widgetId") Long widgetId) {
    Widget widget = dashboardCatalogService.getWidget(dashboardId, widgetId);
    if (widget != null) {
        WidgetDto dto = WidgetDto.fromWidget(widget);
        dto.setDatasourceIds(dashboardCatalogService.getWidgetDatasourceMapping(widget));
        return WSUtils.respondEntity(dto, OK);
    }
    throw EntityNotFoundException.byId(getCompositeId(dashboardId, widgetId));
}
Also used : Widget(com.hortonworks.streamline.registries.dashboard.entites.Widget) WidgetDto(com.hortonworks.streamline.registries.dashboard.dto.WidgetDto) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Example 7 with Widget

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

the class DashboardCatalogService method getWidget.

public Widget getWidget(Long dashboardId, Long widgetId) {
    Widget widget = new Widget();
    widget.setDashboardId(dashboardId);
    widget.setId(widgetId);
    ensureDashboardExists(dashboardId);
    return dao.get(new StorableKey(WIDGET_NAMESPACE, widget.getPrimaryKey()));
}
Also used : StorableKey(com.hortonworks.registries.storage.StorableKey) Widget(com.hortonworks.streamline.registries.dashboard.entites.Widget)

Aggregations

Widget (com.hortonworks.streamline.registries.dashboard.entites.Widget)7 Timed (com.codahale.metrics.annotation.Timed)5 WidgetDto (com.hortonworks.streamline.registries.dashboard.dto.WidgetDto)5 Path (javax.ws.rs.Path)5 StorableKey (com.hortonworks.registries.storage.StorableKey)2 GET (javax.ws.rs.GET)2 Sets (com.google.common.collect.Sets)1 QueryParam (com.hortonworks.registries.common.QueryParam)1 ArrayList (java.util.ArrayList)1 DELETE (javax.ws.rs.DELETE)1 POST (javax.ws.rs.POST)1 PUT (javax.ws.rs.PUT)1