public class FreemarkerContext extends Object implements BareFreeMarkerContext
Modifier and Type | Class and Description |
---|---|
static class |
FreemarkerContext.WebItemDto |
static class |
FreemarkerContext.WebSectionDto |
Constructor and Description |
---|
FreemarkerContext(AdministrationConfigurationAccessor administrationConfigurationAccessor,
BambooLicenseManager bambooLicenseManager,
BambooPermissionManager bambooPermissionManager,
BambooUserManager bambooUserManager,
BootstrapManager bootstrapManager,
CachedPlanManager cachedPlanManager,
CachedRepositoryDefinitionManager cachedRepositoryDefinitionManager,
CommentManager commentManager,
DarkFeatureService darkFeatureService,
DocumentationLinkProvider documentationLinkProvider,
FeatureManager featureManager,
GravatarService gravatarService,
LinkedDeploymentProjectCacheService linkedDeploymentProjectCacheService,
NotificationManager notificationManager,
PlanFavouriteService planFavouriteService,
PlanManager planManager,
com.atlassian.plugin.PluginAccessor pluginAccessor,
ServerStatusProvider serverStatusProvider,
StorageCappingService storageCappingService,
VcsRepositoryViewerManager vcsRepositoryViewerManager,
com.atlassian.plugin.web.api.DynamicWebInterfaceManager webInterfaceManager,
com.atlassian.plugin.webresource.WebResourceIntegration webResourceIntegration,
SystemInfo systemInfo,
com.atlassian.plugin.webresource.WebResourceUrlProvider webResourceUrlProvider,
CustomVariableContext customVariableContext) |
Modifier and Type | Method and Description |
---|---|
boolean |
canCreatePlan() |
boolean |
canCreatePlanInProject(@NotNull Project project) |
boolean |
canCreateProject() |
boolean |
canRunCustomBuild(PlanIdentifier plan)
Checks if the current user has permissions sufficient to run custom/parameterised build of a given plan
|
BambooLicenseManager |
getBambooLicenseManager() |
@Nullable BambooUser |
getBambooUser(@Nullable String username) |
BootstrapManager |
getBootstrapManager() |
@Nullable String |
getCurrentUrl(javax.servlet.http.HttpServletRequest request) |
DarkFeatureService |
getDarkFeatureService() |
List<com.atlassian.plugin.web.api.WebItem> |
getDynamicWebItemsForSectionNoAction(String sectionName,
javax.servlet.http.HttpServletRequest request)
Obtain a list of web items within the provided location.
|
List<com.atlassian.plugin.web.api.WebSection> |
getDynamicWebSectionsForLocationNoAction(String location,
javax.servlet.http.HttpServletRequest request)
Obtain a list of web sections within the provided location.
|
@Nullable String |
getFaviconPath() |
FeatureManager |
getFeatureManager() |
@Nullable String |
getGravatarUrl(@Nullable String userName,
String size) |
DocumentationLinkProvider |
getHelpLink() |
@NotNull String |
getInstanceName() |
@Nullable String |
getLogoPath() |
NotificationManager |
getNotificationManager() |
@Nullable PluggableFooter |
getPluggableFooter()
Gets the pluggable footer plugin.
|
@Nullable PluggableTopNavigation |
getPluggableTopNavigation()
Gets the pluggable top navigation plugin.
|
int |
getRemainingJobsLimit() |
@Nullable String |
getRequestUrl(javax.servlet.http.HttpServletRequest request)
It's alternate method for
getCurrentUrl(HttpServletRequest) . |
@Nullable String |
getRssLink(@NotNull DeploymentProject project) |
@Nullable String |
getRssLink(@NotNull ImmutablePlan plan) |
@Nullable String |
getRssRepositoryId(@NotNull DeploymentProject project) |
@Nullable String |
getRssRepositoryId(@NotNull ImmutablePlan plan) |
@NotNull ServerLifecycleState |
getServerLifecycleState() |
@NotNull ServerStatusInfo |
getServerStatusInfo() |
StorageCappingService |
getStorageCappingService() |
@Nullable com.atlassian.user.User |
getUser(@Nullable javax.servlet.http.HttpServletRequest request) |
Map<String,Object> |
getWebFragmentsContextMapNoAction(javax.servlet.http.HttpServletRequest request)
A context map that gets appended to for web fragments.
|
@NotNull List<Map<String,Object>> |
getWebItems(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
|
List<com.atlassian.plugin.web.descriptors.WebItemModuleDescriptor> |
getWebItemsForSectionNoAction(String sectionName,
javax.servlet.http.HttpServletRequest request)
Deprecated.
|
Collection<String> |
getWebPanels(@NotNull String location)
Gets all the rendered
WebPanel s for the location specified. |
Collection<String> |
getWebPanels(@NotNull String location,
@NotNull Map<String,Object> context) |
Collection<String> |
getWebPanelsForPlan(@NotNull String location,
@NotNull String planKey)
Gets all the rendered
WebPanel s for the location specified for a specific plan key. |
Collection<String> |
getWebPanelsForResultsSummary(@NotNull String location,
@NotNull ResultsSummary resultsSummary)
Gets all the rendered
WebPanel s for the location specified for a specific ResultSummary. |
List<com.atlassian.plugin.web.descriptors.WebSectionModuleDescriptor> |
getWebSectionsForLocationNoAction(String location,
javax.servlet.http.HttpServletRequest request)
Deprecated.
|
List<FreemarkerContext.WebSectionDto> |
getWebSectionsWithItems(@NotNull String location,
@NotNull javax.servlet.http.HttpServletRequest request,
@NotNull String pageCrumb)
Return a DTO storing all web sections for the given
location together with a list of all web items
under each web section. |
@Nullable String |
getXsrfToken() |
boolean |
hasAdminPermission() |
boolean |
hasBuilds() |
boolean |
hasComments(@NotNull BambooIdProvider entity) |
boolean |
hasGlobalAdminPermission() |
boolean |
hasGlobalPermission(String permission)
Does this user have the global permission right?
|
boolean |
hasLinkedDeployments(@Nullable PlanKey planKey) |
boolean |
hasProjectAdminPermission(@NotNull Project project) |
boolean |
hasProjectPermission(String permission,
String projectKey) |
boolean |
hasRestrictedAdminPermission() |
boolean |
isAuthorBambooServer(@Nullable String userName)
Is the supplied author user the bamboo server?
|
boolean |
isAwaitingSpecsExecution(@Nullable ImmutablePlan plan) |
boolean |
isBambooSpecsFailure(@Nullable ImmutableResultsSummary buildResult) |
boolean |
isBambooSpecsResult(@Nullable ImmutableResultsSummary buildResult) |
boolean |
isBambooSpecsSuccess(@Nullable ImmutableResultsSummary buildResult) |
boolean |
isEnableSignup() |
boolean |
isFavourite(ImmutablePlan plan,
javax.servlet.http.HttpServletRequest request) |
boolean |
isFunctionalTest() |
boolean |
isOnDemandInstance() |
boolean |
isRepositoryDashboardOn() |
boolean |
isRssManagedPlan(@Nullable ImmutablePlan plan) |
boolean |
isShowAdminContactDetailsToAnonymousUsers() |
boolean |
isUserAutocompleteAllowed() |
boolean |
isXsrfTokenNeeded(@Nullable String formActionDestination) |
String |
renderFreemarkerTemplateNoAction(String templateString,
javax.servlet.http.HttpServletRequest request)
Will not bother putting any build information on the context
|
String |
sanitizeUrl(String url) |
@Nullable Boolean |
shouldShowActionTip(@NotNull String actionKey,
@NotNull javax.servlet.http.HttpServletRequest request)
Check if provided action-key is
available inside user preferences.
|
@Inject public FreemarkerContext(AdministrationConfigurationAccessor administrationConfigurationAccessor, BambooLicenseManager bambooLicenseManager, BambooPermissionManager bambooPermissionManager, BambooUserManager bambooUserManager, BootstrapManager bootstrapManager, CachedPlanManager cachedPlanManager, CachedRepositoryDefinitionManager cachedRepositoryDefinitionManager, CommentManager commentManager, DarkFeatureService darkFeatureService, DocumentationLinkProvider documentationLinkProvider, FeatureManager featureManager, GravatarService gravatarService, LinkedDeploymentProjectCacheService linkedDeploymentProjectCacheService, NotificationManager notificationManager, PlanFavouriteService planFavouriteService, PlanManager planManager, com.atlassian.plugin.PluginAccessor pluginAccessor, ServerStatusProvider serverStatusProvider, StorageCappingService storageCappingService, VcsRepositoryViewerManager vcsRepositoryViewerManager, com.atlassian.plugin.web.api.DynamicWebInterfaceManager webInterfaceManager, com.atlassian.plugin.webresource.WebResourceIntegration webResourceIntegration, SystemInfo systemInfo, com.atlassian.plugin.webresource.WebResourceUrlProvider webResourceUrlProvider, CustomVariableContext customVariableContext)
@NotNull public @NotNull String getInstanceName()
@Nullable public @Nullable String getLogoPath()
@Nullable public @Nullable String getFaviconPath()
@Nullable public @Nullable com.atlassian.user.User getUser(@Nullable @Nullable javax.servlet.http.HttpServletRequest request)
public boolean isEnableSignup()
public boolean isUserAutocompleteAllowed()
public boolean isOnDemandInstance()
@Nullable public @Nullable String getCurrentUrl(javax.servlet.http.HttpServletRequest request)
@Nullable public @Nullable String getRequestUrl(javax.servlet.http.HttpServletRequest request)
getCurrentUrl(HttpServletRequest)
.
In some circumstances getCurrentUrl doesn't work correctly.
For example: it doesn't work for "/plugins/servlet/*"
request
- public boolean hasBuilds()
public int getRemainingJobsLimit()
public boolean isFavourite(ImmutablePlan plan, javax.servlet.http.HttpServletRequest request)
@Nullable public @Nullable String getGravatarUrl(@Nullable @Nullable String userName, String size)
@Nullable public @Nullable BambooUser getBambooUser(@Nullable @Nullable String username)
public boolean isAuthorBambooServer(@Nullable @Nullable String userName)
userName
- @Deprecated public List<com.atlassian.plugin.web.descriptors.WebItemModuleDescriptor> getWebItemsForSectionNoAction(String sectionName, javax.servlet.http.HttpServletRequest request)
getDynamicWebItemsForSectionNoAction(String, HttpServletRequest)
sectionName
- - the section to retrieve the web items forrequest
- - the http requestpublic List<com.atlassian.plugin.web.api.WebItem> getDynamicWebItemsForSectionNoAction(String sectionName, javax.servlet.http.HttpServletRequest request)
WebItem
,
WebItemProvider
,
DynamicWebInterfaceManager
@NotNull public @NotNull List<Map<String,Object>> getWebItems(String sectionName, javax.servlet.http.HttpServletRequest request)
sectionName
- request
- @Deprecated public List<com.atlassian.plugin.web.descriptors.WebSectionModuleDescriptor> getWebSectionsForLocationNoAction(String location, javax.servlet.http.HttpServletRequest request)
getDynamicWebSectionsForLocationNoAction(String, HttpServletRequest)
location
- - the location to retrieve the web sections forrequest
- - the http requestpublic List<com.atlassian.plugin.web.api.WebSection> getDynamicWebSectionsForLocationNoAction(String location, javax.servlet.http.HttpServletRequest request)
WebSection
,
WebSectionProvider
,
DynamicWebInterfaceManager
public List<FreemarkerContext.WebSectionDto> getWebSectionsWithItems(@NotNull @NotNull String location, @NotNull @NotNull javax.servlet.http.HttpServletRequest request, @NotNull @NotNull String pageCrumb)
location
together with a list of all web items
under each web section.
Based on the pageCrumb
the result will also contain information whether a web section or a web item is
currently active or not.
This method supports dynamically generated web sections and web items (produced by web section providers and web item providers, respectively).
public String renderFreemarkerTemplateNoAction(String templateString, javax.servlet.http.HttpServletRequest request)
templateString
- - to renderrequest
- - the http requestpublic boolean hasGlobalPermission(String permission)
permission
- The global permission being checked.true
if the current user has this permission; false
otherwise.public boolean hasGlobalAdminPermission()
public boolean hasRestrictedAdminPermission()
public boolean hasProjectAdminPermission(@NotNull @NotNull Project project)
public boolean canCreateProject()
public boolean canCreatePlanInProject(@NotNull @NotNull Project project)
public boolean canCreatePlan()
public boolean canRunCustomBuild(PlanIdentifier plan)
public boolean hasAdminPermission()
public BambooLicenseManager getBambooLicenseManager()
@NotNull public @NotNull ServerLifecycleState getServerLifecycleState()
@NotNull public @NotNull ServerStatusInfo getServerStatusInfo()
@Nullable public @Nullable PluggableTopNavigation getPluggableTopNavigation()
@Nullable public @Nullable PluggableFooter getPluggableFooter()
@Nullable public @Nullable Boolean shouldShowActionTip(@NotNull @NotNull String actionKey, @NotNull @NotNull javax.servlet.http.HttpServletRequest request)
request
- actionKey
- public Map<String,Object> getWebFragmentsContextMapNoAction(javax.servlet.http.HttpServletRequest request)
request
- - servlet requestpublic Collection<String> getWebPanelsForPlan(@NotNull @NotNull String location, @NotNull @NotNull String planKey)
WebPanel
s 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)
location
- the web panel will be displayedplanKey
- key of the plan for the contextpublic Collection<String> getWebPanelsForResultsSummary(@NotNull @NotNull String location, @NotNull @NotNull ResultsSummary resultsSummary)
WebPanel
s 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)
location
- the web panel will be displayedresultsSummary
- passed to the web panels in the contextpublic Collection<String> getWebPanels(@NotNull @NotNull String location)
WebPanel
s for the location specified.
If called in the context of rendering a BambooActionSupport
action the context used is taken from BambooActionSupport.getWebPanelContext(String)
location
- public Collection<String> getWebPanels(@NotNull @NotNull String location, @NotNull @NotNull Map<String,Object> context)
public FeatureManager getFeatureManager()
public DarkFeatureService getDarkFeatureService()
public DocumentationLinkProvider getHelpLink()
public StorageCappingService getStorageCappingService()
@Nullable public @Nullable String getRssLink(@NotNull @NotNull ImmutablePlan plan)
@Nullable public @Nullable String getRssRepositoryId(@NotNull @NotNull ImmutablePlan plan)
@Nullable public @Nullable String getRssLink(@NotNull @NotNull DeploymentProject project)
@Nullable public @Nullable String getRssRepositoryId(@NotNull @NotNull DeploymentProject project)
public boolean isRssManagedPlan(@Nullable @Nullable ImmutablePlan plan)
public boolean isRepositoryDashboardOn()
public BootstrapManager getBootstrapManager()
@Nullable public @Nullable String getXsrfToken()
getXsrfToken
in interface BareFreeMarkerContext
public boolean isXsrfTokenNeeded(@Nullable @Nullable String formActionDestination)
isXsrfTokenNeeded
in interface BareFreeMarkerContext
public boolean hasLinkedDeployments(@Nullable @Nullable PlanKey planKey)
public boolean isFunctionalTest()
public boolean hasComments(@NotNull @NotNull BambooIdProvider entity)
public boolean isShowAdminContactDetailsToAnonymousUsers()
public NotificationManager getNotificationManager()
public boolean isBambooSpecsFailure(@Nullable @Nullable ImmutableResultsSummary buildResult)
public boolean isBambooSpecsSuccess(@Nullable @Nullable ImmutableResultsSummary buildResult)
public boolean isBambooSpecsResult(@Nullable @Nullable ImmutableResultsSummary buildResult)
public boolean isAwaitingSpecsExecution(@Nullable @Nullable ImmutablePlan plan)
Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.