com.atlassian.gadgets.dashboard.internal.rest
Class DashboardResource

java.lang.Object
  extended by com.atlassian.gadgets.dashboard.internal.rest.DashboardResource

public class DashboardResource
extends Object

Provides REST endpoints for using the dashboard.


Constructor Summary
DashboardResource(DashboardPermissionService permissionService, GadgetRequestContextFactory gadgetRequestContextFactory, AddGadgetHandler addGadgetHandler, ChangeLayoutHandler changeLayoutHandler, DashboardRepository repository, RepresentationFactory representationFactory, com.atlassian.sal.api.message.I18nResolver i18n)
          Constructor.
 
Method Summary
 javax.ws.rs.core.Response addGadget(DashboardId dashboardId, javax.servlet.http.HttpServletRequest request, Reader jsonContent)
          Adds a gadget to a dashboard, returning the new gadget's entity representation if successful.
 javax.ws.rs.core.Response changeLayoutViaPOST(DashboardId dashboardId, javax.servlet.http.HttpServletRequest request, String entity)
          Changes the existing layout of the specified dashboard in response to a POST request.
 javax.ws.rs.core.Response changeLayoutViaPUT(DashboardId dashboardId, javax.servlet.http.HttpServletRequest request, String entity)
          Changes the existing layout of the specified dashboard in response to a PUT request.
 javax.ws.rs.core.Response getDashboard(DashboardId dashboardId, javax.servlet.http.HttpServletRequest request)
           
 javax.ws.rs.core.Response getNumGadgets(DashboardId dashboardId, javax.servlet.http.HttpServletRequest request)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DashboardResource

public DashboardResource(DashboardPermissionService permissionService,
                         GadgetRequestContextFactory gadgetRequestContextFactory,
                         AddGadgetHandler addGadgetHandler,
                         ChangeLayoutHandler changeLayoutHandler,
                         DashboardRepository repository,
                         RepresentationFactory representationFactory,
                         com.atlassian.sal.api.message.I18nResolver i18n)
Constructor.

Parameters:
permissionService - the PermissionService implementation to use
gadgetRequestContextFactory - the GadgetRequestContextFactory to use
addGadgetHandler - the AddGadgetHandler to use
changeLayoutHandler - the ChangeLayoutHandler to use
repository - the Repository to use
representationFactory - the RepresentationFactory to use to construct JAXB reps
i18n - the I18nResolver from SAL
Method Detail

getDashboard

public javax.ws.rs.core.Response getDashboard(DashboardId dashboardId,
                                              @Context
                                              javax.servlet.http.HttpServletRequest request)

getNumGadgets

public javax.ws.rs.core.Response getNumGadgets(DashboardId dashboardId,
                                               @Context
                                               javax.servlet.http.HttpServletRequest request)

addGadget

public javax.ws.rs.core.Response addGadget(DashboardId dashboardId,
                                           @Context
                                           javax.servlet.http.HttpServletRequest request,
                                           Reader jsonContent)
Adds a gadget to a dashboard, returning the new gadget's entity representation if successful.

If the request body contains a gadgetId and sourceDashboardId, then this will be treated as a 'move' operation, where the gadget will be added to the dashboard specified and deleted from the sourceDashboard.

Parameters:
dashboardId - the dashboard to add the gadget to
request - the HttpServletRequest that was routed here
jsonContent - the body of the post in JSON
Returns:
a Response with the resulting status code and gadget URL if applicable

changeLayoutViaPOST

public javax.ws.rs.core.Response changeLayoutViaPOST(DashboardId dashboardId,
                                                     @Context
                                                     javax.servlet.http.HttpServletRequest request,
                                                     String entity)
Changes the existing layout of the specified dashboard in response to a POST request.

Parameters:
dashboardId - ID of the dashboard on which to change the layout
request - the HttpServletRequest that was routed here
entity - the new layout data
Returns:
a Response for the client with details on the request's success or failure

changeLayoutViaPUT

public javax.ws.rs.core.Response changeLayoutViaPUT(DashboardId dashboardId,
                                                    @Context
                                                    javax.servlet.http.HttpServletRequest request,
                                                    String entity)
Changes the existing layout of the specified dashboard in response to a PUT request.

Parameters:
dashboardId - ID of the dashboard on which to change the layout
request - the HttpServletRequest that was routed here
entity - the new layout data
Returns:
a Response for the client with details on the request's success or failure


Copyright © 2014 Atlassian. All Rights Reserved.