Class PlanRestServiceImpl
java.lang.Object
com.atlassian.bamboo.plugins.rest.service.PlanRestServiceImpl
- All Implemented Interfaces:
PlanRestService
Provides plan info for plugin
-
Constructor Summary
ConstructorDescriptionPlanRestServiceImpl
(BambooCachingPermissionManagerFacadeFactory bambooCachingPermissionManagerFacadeFactory, BambooUserManager bambooUserManager, CachedPlanManager cachedPlanManager, LabelManager labelManager, PlanExecutionManager planExecutionManager, PlanManager planManager, ResultsSummaryManager resultsSummaryManager) -
Method Summary
Modifier and TypeMethodDescriptionvoid
assertPlanExistsAndVisible
(@NotNull PlanKey planKey) Checks ifPlan
exists and is visible for calling uservoid
assertPlanExistsAndVisible
(@NotNull PlanKey planKey, @NotNull Class<? extends ImmutablePlan> clazz) Checks ifPlan
exists, has correct type and is visible for calling user@Nullable RestBranchLatestActive
createPaginatedBranchResponse
(List<? extends ImmutablePlan> branches, @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo, boolean allBranches) createPaginatedPlanResponse
(List<? extends ImmutablePlan> plans, @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo) @Nullable ImmutablePlan
getBranchByName
(@NotNull ImmutablePlan plan, @NotNull String branchName) Get branch of a given plan by name.@NotNull ImmutableChain
getChainByKey
(@NotNull PlanKey planKey) Returns aPlan
if plan exists and is visible for calling usergetJobsForPlan
(@NotNull PlanKey planKey, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestAuthenticationContext restAuthenticationContext) Get a list of jobs of specified plan.@NotNull ImmutablePlan
getPlanByKey
(@NotNull PlanKey planKey) Returns aPlan
if plan exists and is visible for calling user In clustered mode, there is NO consistency guarantee.getPlanByKeyUnchecked
(@NotNull PlanKey planKey) Returns aPlan
if plan exists.@NotNull ImmutablePlan
getPlanByKeyWithHighConsistencyGuarantee
(@NotNull PlanKey planKey) Returns aPlan
if plan exists and is visible for calling user.getPlans
(@NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestAuthenticationContext restAuthenticationContext) Get a list of plans.<T extends ImmutablePlan>
List<T>getPlans
(Class<T> planType, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestAuthenticationContext restAuthenticationContext) Get a list of plans.getPlansByProject
(@NotNull Project project, @NotNull javax.ws.rs.core.UriInfo uriInfo) Get a list of plans that belong to a project.getPlansByProject
(@NotNull Project project, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestAuthenticationContext restAuthenticationContext) Get a list of plans that belong to a project.getRunnablePlans
(@NotNull Project project, @NotNull javax.ws.rs.core.UriInfo uriInfo) Get a list of plans that can be run currently logged in user.getStagesForPlan
(@NotNull PlanKey planKey, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestAuthenticationContext restAuthenticationContext) Get a list of stages of specified plan.boolean
Check whether or not a plan can be created or not (based on licensing etc)
-
Constructor Details
-
PlanRestServiceImpl
@Inject public PlanRestServiceImpl(BambooCachingPermissionManagerFacadeFactory bambooCachingPermissionManagerFacadeFactory, BambooUserManager bambooUserManager, CachedPlanManager cachedPlanManager, LabelManager labelManager, PlanExecutionManager planExecutionManager, PlanManager planManager, ResultsSummaryManager resultsSummaryManager)
-
-
Method Details
-
getBranchesForChain
- Specified by:
getBranchesForChain
in interfacePlanRestService
-
getBranchesForJob
- Specified by:
getBranchesForJob
in interfacePlanRestService
-
createPaginatedPlanResponse
public RestPlans createPaginatedPlanResponse(List<? extends ImmutablePlan> plans, @Nullable @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo) - Specified by:
createPaginatedPlanResponse
in interfacePlanRestService
-
createPaginatedBranchResponse
public RestPlanBranchList createPaginatedBranchResponse(List<? extends ImmutablePlan> branches, @Nullable @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo, boolean allBranches) - Specified by:
createPaginatedBranchResponse
in interfacePlanRestService
allBranches
- return all branches, even if expand has 'favourites' parameter. This is because 'favourites' is about plans not branches and all branches of a favourite plan are to be shown- Returns:
- filtered list of branches
-
createLatestActiveBranchResult
@Nullable public @Nullable RestBranchLatestActive createLatestActiveBranchResult(ImmutablePlan branch) - Specified by:
createLatestActiveBranchResult
in interfacePlanRestService
-
getBranchByName
@Nullable public @Nullable ImmutablePlan getBranchByName(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String branchName) Description copied from interface:PlanRestService
Get branch of a given plan by name. If passed plan is Chain method will look after properly named chain branch. If passed plan is a Job method will look after corresponding job in a found chain branch.- Specified by:
getBranchByName
in interfacePlanRestService
- Parameters:
plan
- planbranchName
- name of the branch to be fetched- Returns:
ImmutableChainBranch
,ImmutableJob
or null if not found
-
getPlans
public List<ImmutablePlan> getPlans(@NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestAuthenticationContext restAuthenticationContext) Description copied from interface:PlanRestService
Get a list of plans. This method provides filtering using the following query params:favourite
- if specified return only favourite plans
permission
- if specified return only plans that user has this specific permission for
type
- if specifies return only plans of specified type
- Specified by:
getPlans
in interfacePlanRestService
- Returns:
- Filtered list of plans belonging to a project.
-
getPlans
public <T extends ImmutablePlan> List<T> getPlans(Class<T> planType, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestAuthenticationContext restAuthenticationContext) Description copied from interface:PlanRestService
Get a list of plans. This method provides filtering using the following query params:favourite
- if specified return only favourite plans
permission
- if specified return only plans that user has this specific permission for
- Specified by:
getPlans
in interfacePlanRestService
- Parameters:
planType
- type of plans- Returns:
- Filtered list of plans belonging to a project.
-
getJobsForPlan
public List<ImmutableJob> getJobsForPlan(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestAuthenticationContext restAuthenticationContext) Description copied from interface:PlanRestService
Get a list of jobs of specified plan.- Specified by:
getJobsForPlan
in interfacePlanRestService
- Parameters:
planKey
- planKey- Returns:
- Filtered list of jobs belonging to a plan.
-
getStagesForPlan
public List<ImmutableChainStage> getStagesForPlan(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestAuthenticationContext restAuthenticationContext) Description copied from interface:PlanRestService
Get a list of stages of specified plan.- Specified by:
getStagesForPlan
in interfacePlanRestService
- Parameters:
planKey
- planKey- Returns:
- Filtered list of stages belonging to a plan.
-
getPlansByProject
public List<ImmutablePlan> getPlansByProject(@NotNull @NotNull Project project, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo) Description copied from interface:PlanRestService
Get a list of plans that belong to a project.- Specified by:
getPlansByProject
in interfacePlanRestService
- Returns:
- Filtered list of plans belonging to a project.
-
getPlansByProject
public List<ImmutablePlan> getPlansByProject(@NotNull @NotNull Project project, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestAuthenticationContext restAuthenticationContext) Description copied from interface:PlanRestService
Get a list of plans that belong to a project. This method provides favourite filtering.- Specified by:
getPlansByProject
in interfacePlanRestService
- Returns:
- Filtered list of plans belonging to a project.
-
getRunnablePlans
public List<ImmutablePlan> getRunnablePlans(@NotNull @NotNull Project project, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo) Description copied from interface:PlanRestService
Get a list of plans that can be run currently logged in user.- Specified by:
getRunnablePlans
in interfacePlanRestService
- Returns:
- A list of plans that the current user can run.
-
assertPlanExistsAndVisible
Description copied from interface:PlanRestService
Checks ifPlan
exists and is visible for calling user- Specified by:
assertPlanExistsAndVisible
in interfacePlanRestService
-
assertPlanExistsAndVisible
public void assertPlanExistsAndVisible(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Class<? extends ImmutablePlan> clazz) Description copied from interface:PlanRestService
Checks ifPlan
exists, has correct type and is visible for calling user- Specified by:
assertPlanExistsAndVisible
in interfacePlanRestService
-
getChainByKey
Description copied from interface:PlanRestService
Returns aPlan
if plan exists and is visible for calling user- Specified by:
getChainByKey
in interfacePlanRestService
- Returns:
- the chain matching the given planKey
-
getPlanByKey
Description copied from interface:PlanRestService
Returns aPlan
if plan exists and is visible for calling user In clustered mode, there is NO consistency guarantee.- Specified by:
getPlanByKey
in interfacePlanRestService
- Parameters:
planKey
- key of a plan to search for- Returns:
ImmutablePlan
-
getPlanByKeyWithHighConsistencyGuarantee
@NotNull public @NotNull ImmutablePlan getPlanByKeyWithHighConsistencyGuarantee(@NotNull @NotNull PlanKey planKey) Description copied from interface:PlanRestService
Returns aPlan
if plan exists and is visible for calling user. There is a guarantee that the data will be up-to-date.- Specified by:
getPlanByKeyWithHighConsistencyGuarantee
in interfacePlanRestService
- Parameters:
planKey
- key of a plan to search for- Returns:
ImmutablePlan
-
getPlanByKeyUnchecked
Description copied from interface:PlanRestService
Returns aPlan
if plan exists. No permission check is performed.- Specified by:
getPlanByKeyUnchecked
in interfacePlanRestService
- Parameters:
planKey
- key of a plan to search for- Returns:
ImmutablePlan
or null if not found
-
isPlanCreationAllowed
public boolean isPlanCreationAllowed()Description copied from interface:PlanRestService
Check whether or not a plan can be created or not (based on licensing etc)- Specified by:
isPlanCreationAllowed
in interfacePlanRestService
- Returns:
- true if a plan can be created otherwise false;
-