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 Object


Method Summary
static javax.ws.rs.core.UriInfo addAutoExpand(javax.ws.rs.core.UriInfo uriInfo, String expandable)
           
static boolean areBuildPositionsRequested(javax.ws.rs.core.UriInfo uriInfo)
           
static void assertExecutePermission(PlanKey planKey)
           
static void assertIpAddressIsLocal(String address)
           
static void assertPlanPermission(BambooPermission permission, PlanKey planKey)
           
static void assertReadPermission()
           
static void assertRestrictedAdminPermission()
           
static void assertSystemAdminPermission()
           
static javax.ws.rs.core.CacheControl cacheNever()
          Removes caching in response
static boolean containsFavouriteQueryParam(javax.ws.rs.core.UriInfo uriInfo)
           
static boolean containsMyOnlyQueryParam(javax.ws.rs.core.UriInfo uriInfo)
           
static String formatDateTime(long datetime)
           
static BuildState getBuildStateQueryParam(javax.ws.rs.core.UriInfo uriInfo)
           
static Map<String,String> getFormParamsMap(javax.ws.rs.core.MultivaluedMap<String,String> formParams)
          Returns first occurrence of parameters map
static I18nBean getI18nBean()
           
static Class<? extends ImmutablePlan> getPlanType(javax.ws.rs.core.UriInfo uriInfo)
           
static List<String> getQueryParamAsList(javax.ws.rs.core.UriInfo uriInfo, String key)
           
static Map<String,String> getQueryParamsMap(javax.ws.rs.core.UriInfo uriInfo)
          Returns first occurrence of parameters map
static 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, 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
 

Method Detail

getI18nBean

public static I18nBean getI18nBean()

addAutoExpand

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

containsFavouriteQueryParam

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

containsMyOnlyQueryParam

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

areBuildPositionsRequested

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

getPlanType

public static Class<? extends ImmutablePlan> 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,
                                    String param)

getQueryParamAsList

@Nullable
public static List<String> getQueryParamAsList(javax.ws.rs.core.UriInfo uriInfo,
                                                        String key)

getQueryParamsMap

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

Parameters:
uriInfo -
Returns:
query parameters map

getFormParamsMap

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

Parameters:
formParams -
Returns:
query parameters map

getBuildStateQueryParam

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

formatDateTime

public static String formatDateTime(long datetime)

cacheNever

public static javax.ws.rs.core.CacheControl cacheNever()
Removes caching in response

Returns:

getReturnUri

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

Parameters:
uriInfo -
Returns:
'returnUrl' request parameter or null if empty

assertPlanPermission

public static void assertPlanPermission(@NotNull
                                        BambooPermission permission,
                                        @NotNull
                                        PlanKey planKey)

assertReadPermission

public static void assertReadPermission()

assertExecutePermission

public static void assertExecutePermission(PlanKey planKey)

assertSystemAdminPermission

public static void assertSystemAdminPermission()

assertRestrictedAdminPermission

public static void assertRestrictedAdminPermission()

assertIpAddressIsLocal

public static void assertIpAddressIsLocal(@NotNull
                                          String address)
                                   throws UnknownHostException
Throws:
UnknownHostException


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.