com.atlassian.bamboo.plugins.rest.common
Class RestHelper

java.lang.Object
  extended by com.atlassian.bamboo.plugins.rest.common.RestHelper

public final class RestHelper
extends java.lang.Object

User: mwent Date: Apr 29, 2009 Time: 9:59:45 AM


Constructor Summary
RestHelper()
           
 
Method Summary
static javax.ws.rs.core.UriInfo addAutoExpand(javax.ws.rs.core.UriInfo uriInfo, java.lang.String expandable)
           
static void assertGlobalAdminReadPermission()
           
static void assertPlanExistsAndVisible(PlanManager planManager, PlanKey planKey)
          Checks if Plan exists and is visible for calling user
static void assertReadPermission()
           
static RestPlans createPaginatedPlanResponse(java.util.Collection<Plan> plans, LabelManager labelManager, com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo)
           
static java.lang.String formatDateTime(long datetime)
           
static BuildState getBuildStateQueryParam(javax.ws.rs.core.UriInfo uriInfo)
           
static boolean getFavouriteQueryParam(javax.ws.rs.core.UriInfo uriInfo)
           
static java.util.Map<java.lang.String,java.lang.String> getFormParamsMap(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> formParams)
          Returns first occurrence of parameters map
static Plan getPlanByKey(PlanManager planManager, PlanKey planKey)
          Returns a Plan if plan exists and is visible for calling user
static java.lang.Class getPlanType(javax.ws.rs.core.UriInfo uriInfo)
           
static java.util.List<java.lang.String> getQueryParamAsList(javax.ws.rs.core.UriInfo uriInfo, java.lang.String key)
           
static java.util.Map<java.lang.String,java.lang.String> getQueryParamsMap(javax.ws.rs.core.UriInfo uriInfo)
          Returns first occurrence of parameters map
static java.net.URI getReturnUri(javax.ws.rs.core.UriInfo uriInfo)
          Content of 'returnUrl' request parameter or null if empty.
static boolean hasCloverEnabledQueryParam(javax.ws.rs.core.UriInfo uriInfo)
           
static boolean hasQueryParam(javax.ws.rs.core.UriInfo uriInfo, java.lang.String param)
           
static boolean hasWithBuildPermissionOnlyParam(javax.ws.rs.core.UriInfo uriInfo)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestHelper

public RestHelper()
Method Detail

addAutoExpand

public static javax.ws.rs.core.UriInfo addAutoExpand(javax.ws.rs.core.UriInfo uriInfo,
                                                     java.lang.String expandable)

getFavouriteQueryParam

public static boolean getFavouriteQueryParam(javax.ws.rs.core.UriInfo uriInfo)

getPlanType

public static java.lang.Class getPlanType(javax.ws.rs.core.UriInfo uriInfo)

hasCloverEnabledQueryParam

public static boolean hasCloverEnabledQueryParam(javax.ws.rs.core.UriInfo uriInfo)

hasWithBuildPermissionOnlyParam

public static boolean hasWithBuildPermissionOnlyParam(javax.ws.rs.core.UriInfo uriInfo)

hasQueryParam

public static boolean hasQueryParam(javax.ws.rs.core.UriInfo uriInfo,
                                    java.lang.String param)

getQueryParamAsList

public static java.util.List<java.lang.String> getQueryParamAsList(javax.ws.rs.core.UriInfo uriInfo,
                                                                   java.lang.String key)

getQueryParamsMap

@NotNull
public static java.util.Map<java.lang.String,java.lang.String> getQueryParamsMap(javax.ws.rs.core.UriInfo uriInfo)
Returns first occurrence of parameters map

Parameters:
uriInfo -
Returns:

getFormParamsMap

@NotNull
public static java.util.Map<java.lang.String,java.lang.String> getFormParamsMap(javax.ws.rs.core.MultivaluedMap<java.lang.String,java.lang.String> formParams)
Returns first occurrence of parameters map

Parameters:
formParams -
Returns:

createPaginatedPlanResponse

public static RestPlans createPaginatedPlanResponse(java.util.Collection<Plan> plans,
                                                    LabelManager labelManager,
                                                    @Nullable
                                                    com.atlassian.user.User user,
                                                    javax.ws.rs.core.UriInfo uriInfo)

getBuildStateQueryParam

public static BuildState getBuildStateQueryParam(@NotNull
                                                 javax.ws.rs.core.UriInfo uriInfo)

getPlanByKey

public static Plan getPlanByKey(PlanManager planManager,
                                PlanKey planKey)
Returns a Plan if plan exists and is visible for calling user

Parameters:
planManager -
planKey -
Returns:
Throws:
NotFoundException, - AccessDeniedException

assertPlanExistsAndVisible

public static void assertPlanExistsAndVisible(PlanManager planManager,
                                              PlanKey planKey)
Checks if Plan exists and is visible for calling user

Parameters:
planManager -
planKey -
Throws:
NotFoundException, - AccessDeniedException

formatDateTime

public static java.lang.String formatDateTime(long datetime)

getReturnUri

@Nullable
public static java.net.URI getReturnUri(javax.ws.rs.core.UriInfo uriInfo)
Content of 'returnUrl' request parameter or null if empty.

Parameters:
uriInfo -
Returns:

assertReadPermission

public static void assertReadPermission()

assertGlobalAdminReadPermission

public static void assertGlobalAdminReadPermission()


Copyright © 2011 Atlassian. All Rights Reserved.