com.atlassian.bamboo.ww2
Class FreemarkerContext

java.lang.Object
  extended by com.atlassian.bamboo.ww2.FreemarkerContext

public class FreemarkerContext
extends java.lang.Object

This class is similar to BambooActionSupport but does not require an action or action context. This makes this functionality available to any servlets as well.


Constructor Summary
FreemarkerContext(BambooLicenseManager bambooLicenseManager, AdministrationConfigurationManager administrationConfigurationManager, BambooPermissionManager bambooPermissionManager, DashboardCachingManager dashboardCachingManager, com.atlassian.plugin.web.WebInterfaceManager webInterfaceManager, BambooUserManager bambooUserManager, com.atlassian.plugin.PluginAccessor pluginAccessor, PlanFavouriteService planFavouriteService, GravatarService gravatarService, ServerLifecycleProvider serverLifecycleProvider, PlanManager planManager, BootstrapManager bootstrapManager, FeatureManager featureManager)
           
 
Method Summary
 BambooLicenseManager getBambooLicenseManager()
           
 BambooUser getBambooUser(java.lang.String username)
           
 BootstrapManager getBootstrapManager()
           
 java.lang.String getCurrentUrl(javax.servlet.http.HttpServletRequest request)
           
 ElasticConfiguration getElasticConfig()
           
 FeatureManager getFeatureManager()
           
 java.lang.String getGravatarUrl(java.lang.String userName, java.lang.String size)
           
 java.lang.String getInstanceName()
           
 PluggableFooter getPluggableFooter()
          Gets the pluggable footer plugin.
 PluggableTopNavigation getPluggableTopNavigation()
          Gets the pluggable top navigation plugin.
 int getRemainingJobsLimit()
           
 ServerLifecycleState getServerLifecycleState()
           
 com.atlassian.user.User getUser(javax.servlet.http.HttpServletRequest request)
           
 java.util.Map<java.lang.String,java.lang.Object> getWebFragmentsContextMapNoAction(javax.servlet.http.HttpServletRequest request)
          A context map that gets appended to for web fragments.
 java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getWebItems(java.lang.String sectionName, javax.servlet.http.HttpServletRequest request)
          Returns a list of Map objects with prefilled text, id, accesskey, href fields for a template engine layer to consome
 java.util.List<com.atlassian.plugin.web.descriptors.WebItemModuleDescriptor> getWebItemsForSectionNoAction(java.lang.String sectionName, javax.servlet.http.HttpServletRequest request)
          Will not bother putting any build information on the context
 java.util.Collection<java.lang.String> getWebPanels(java.lang.String location)
          Gets all the rendered WebPanels for the location specified.
 java.util.Collection<java.lang.String> getWebPanels(java.lang.String location, java.util.Map<java.lang.String,java.lang.Object> context)
           
 java.util.Collection<java.lang.String> getWebPanelsForPlan(java.lang.String location, java.lang.String planKey)
          Gets all the rendered WebPanels for the location specified for a specific plan key.
 java.util.Collection<java.lang.String> getWebPanelsForResultsSummary(java.lang.String location, ResultsSummary resultsSummary)
          Gets all the rendered WebPanels for the location specified for a specific ResultSummary.
 java.util.List<com.atlassian.plugin.web.descriptors.WebSectionModuleDescriptor> getWebSectionsForLocationNoAction(java.lang.String location, javax.servlet.http.HttpServletRequest request)
          Will not bother putting any build information on the context
 boolean hasAdminPermission()
           
 boolean hasBuilds()
           
 boolean hasGlobalAdminPermission()
           
 boolean hasGlobalPermission(java.lang.String permission)
          Does this user have the global permission right?
 boolean hasRestrictedAdminPermission()
           
 boolean isAuthorBambooServer(java.lang.String userName)
          Is the supplied author user the bamboo server?
 boolean isEc2ConfigurationWarningRequired()
           
 boolean isEnableSignup()
           
 boolean isFavourite(ImmutablePlan plan, javax.servlet.http.HttpServletRequest request)
           
 boolean isUserAutocompleteAllowed()
           
 java.lang.String renderFreemarkerTemplateNoAction(java.lang.String templateString, javax.servlet.http.HttpServletRequest request)
          Will not bother putting any build information on the context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FreemarkerContext

public FreemarkerContext(BambooLicenseManager bambooLicenseManager,
                         AdministrationConfigurationManager administrationConfigurationManager,
                         BambooPermissionManager bambooPermissionManager,
                         DashboardCachingManager dashboardCachingManager,
                         com.atlassian.plugin.web.WebInterfaceManager webInterfaceManager,
                         BambooUserManager bambooUserManager,
                         com.atlassian.plugin.PluginAccessor pluginAccessor,
                         PlanFavouriteService planFavouriteService,
                         GravatarService gravatarService,
                         ServerLifecycleProvider serverLifecycleProvider,
                         PlanManager planManager,
                         BootstrapManager bootstrapManager,
                         FeatureManager featureManager)
Method Detail

getInstanceName

@Nullable
public java.lang.String getInstanceName()

getUser

@Nullable
public com.atlassian.user.User getUser(javax.servlet.http.HttpServletRequest request)

isEnableSignup

public boolean isEnableSignup()

isUserAutocompleteAllowed

public boolean isUserAutocompleteAllowed()

isEc2ConfigurationWarningRequired

public boolean isEc2ConfigurationWarningRequired()

getElasticConfig

@Nullable
public ElasticConfiguration getElasticConfig()

getCurrentUrl

@Nullable
public java.lang.String getCurrentUrl(javax.servlet.http.HttpServletRequest request)

hasBuilds

public boolean hasBuilds()

getRemainingJobsLimit

public int getRemainingJobsLimit()

isFavourite

public boolean isFavourite(ImmutablePlan plan,
                           javax.servlet.http.HttpServletRequest request)

getGravatarUrl

@Nullable
public java.lang.String getGravatarUrl(@Nullable
                                                java.lang.String userName,
                                                java.lang.String size)

getBambooUser

@Nullable
public BambooUser getBambooUser(@Nullable
                                         java.lang.String username)

isAuthorBambooServer

public boolean isAuthorBambooServer(@Nullable
                                    java.lang.String userName)
Is the supplied author user the bamboo server?

Parameters:
userName -
Returns:
true if the author is the bamboo server, otherwise false.

getWebItemsForSectionNoAction

public java.util.List<com.atlassian.plugin.web.descriptors.WebItemModuleDescriptor> getWebItemsForSectionNoAction(java.lang.String sectionName,
                                                                                                                  javax.servlet.http.HttpServletRequest request)
Will not bother putting any build information on the context

Parameters:
sectionName - - the section to retrieve the web items for
request - - the http request
Returns:
List - all web items contained within the provided section

getWebItems

@NotNull
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getWebItems(java.lang.String sectionName,
                                                                                            javax.servlet.http.HttpServletRequest request)
Returns a list of Map objects with prefilled text, id, accesskey, href fields for a template engine layer to consome

Parameters:
sectionName -
request -
Returns:

getWebSectionsForLocationNoAction

public java.util.List<com.atlassian.plugin.web.descriptors.WebSectionModuleDescriptor> getWebSectionsForLocationNoAction(java.lang.String location,
                                                                                                                         javax.servlet.http.HttpServletRequest request)
Will not bother putting any build information on the context

Parameters:
location - - the location to retrieve the web sections for
request - - the http request
Returns:
List - all web sections contained within the provided location

renderFreemarkerTemplateNoAction

public java.lang.String renderFreemarkerTemplateNoAction(java.lang.String templateString,
                                                         javax.servlet.http.HttpServletRequest request)
Will not bother putting any build information on the context

Parameters:
templateString - - to render
request - - the http request
Returns:
The rendered string

hasGlobalPermission

public boolean hasGlobalPermission(java.lang.String permission)
Does this user have the global permission right?

Parameters:
permission - The global permission being checked.
Returns:
true if the current user has this permission; false otherwise.

hasGlobalAdminPermission

public boolean hasGlobalAdminPermission()

hasRestrictedAdminPermission

public boolean hasRestrictedAdminPermission()

hasAdminPermission

public boolean hasAdminPermission()

getBambooLicenseManager

public BambooLicenseManager getBambooLicenseManager()

getServerLifecycleState

@NotNull
public ServerLifecycleState getServerLifecycleState()

getPluggableTopNavigation

@Nullable
public PluggableTopNavigation getPluggableTopNavigation()
Gets the pluggable top navigation plugin.

Returns:
The pluggable top navigation plugin, if it exists, or null.

getPluggableFooter

@Nullable
public PluggableFooter getPluggableFooter()
Gets the pluggable footer plugin.

Returns:
The pluggable footer plugin, if it exists, or null.

getWebFragmentsContextMapNoAction

public java.util.Map<java.lang.String,java.lang.Object> getWebFragmentsContextMapNoAction(javax.servlet.http.HttpServletRequest request)
A context map that gets appended to for web fragments. Will not lok for any build information to put on the context path.

Parameters:
request - - servlet request
Returns:
A context map that gets appended to for web fragments.

getWebPanelsForPlan

public java.util.Collection<java.lang.String> getWebPanelsForPlan(@NotNull
                                                                  java.lang.String location,
                                                                  @NotNull
                                                                  java.lang.String planKey)
Gets all the rendered WebPanels for the location specified for a specific plan key. Allows the same web panel location to be used in multiple places on page with different plan contexts. If called in the context of rendering a BambooActionSupport action the context used is taken from BambooActionSupport.getWebPanelContext(String)

Parameters:
location - the web panel will be displayed
planKey - key of the plan for the context
Returns:
webPanels

getWebPanelsForResultsSummary

public java.util.Collection<java.lang.String> getWebPanelsForResultsSummary(@NotNull
                                                                            java.lang.String location,
                                                                            @NotNull
                                                                            ResultsSummary resultsSummary)
Gets all the rendered WebPanels for the location specified for a specific ResultSummary. Allows the same web panel location to be used in multiple places on page with different plan contexts. If called in the context of rendering a BambooActionSupport action the context used is taken from BambooActionSupport.getWebPanelContext(String)

Parameters:
location - the web panel will be displayed
resultsSummary - passed to the web panels in the context
Returns:
webPanels

getWebPanels

public java.util.Collection<java.lang.String> getWebPanels(@NotNull
                                                           java.lang.String location)
Gets all the rendered WebPanels for the location specified. If called in the context of rendering a BambooActionSupport action the context used is taken from BambooActionSupport.getWebPanelContext(String)

Parameters:
location -
Returns:
webPanels

getWebPanels

public java.util.Collection<java.lang.String> getWebPanels(@NotNull
                                                           java.lang.String location,
                                                           @NotNull
                                                           java.util.Map<java.lang.String,java.lang.Object> context)

getFeatureManager

public FeatureManager getFeatureManager()

getBootstrapManager

public BootstrapManager getBootstrapManager()


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.