Class PlanRestServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.plugins.rest.service.PlanRestServiceImpl
-
- All Implemented Interfaces:
PlanRestService
@Component public class PlanRestServiceImpl extends Object implements PlanRestService
Provides plan info for plugin
-
-
Constructor Summary
Constructors Constructor Description PlanRestServiceImpl(BambooCachingPermissionManagerFacadeFactory bambooCachingPermissionManagerFacadeFactory, BambooUserManager bambooUserManager, CachedPlanManager cachedPlanManager, LabelManager labelManager, PlanExecutionManager planExecutionManager, PlanManager planManager, ResultsSummaryManager resultsSummaryManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassertPlanExistsAndVisible(@NotNull PlanKey planKey)Checks ifPlanexists and is visible for calling uservoidassertPlanExistsAndVisible(@NotNull PlanKey planKey, @NotNull Class<? extends ImmutablePlan> clazz)Checks ifPlanexists, has correct type and is visible for calling user@Nullable RestBranchLatestActivecreateLatestActiveBranchResult(ImmutablePlan branch)RestPlanBranchListcreatePaginatedBranchResponse(List<? extends ImmutablePlan> branches, @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo, boolean allBranches)RestPlanscreatePaginatedPlanResponse(List<? extends ImmutablePlan> plans, @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo)@Nullable ImmutablePlangetBranchByName(@NotNull ImmutablePlan plan, @NotNull String branchName)Get branch of a given plan by name.List<ImmutableChainBranch>getBranchesForChain(ImmutablePlan plan)List<ImmutableJob>getBranchesForJob(ImmutableJob job)@NotNull ImmutableChaingetChainByKey(@NotNull PlanKey planKey)Returns aPlanif plan exists and is visible for calling userList<ImmutableJob>getJobsForPlan(@NotNull PlanKey planKey, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)Get a list of jobs of specified plan.@NotNull ImmutablePlangetPlanByKey(@NotNull PlanKey planKey)Returns aPlanif plan exists and is visible for calling user In clustered mode, there is NO consistency guarantee.ImmutablePlangetPlanByKeyUnchecked(@NotNull PlanKey planKey)Returns aPlanif plan exists.@NotNull ImmutablePlangetPlanByKeyWithHighConsistencyGuarantee(@NotNull PlanKey planKey)Returns aPlanif plan exists and is visible for calling user.List<ImmutablePlan>getPlans(@NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)Get a list of plans.<T extends ImmutablePlan>
List<T>getPlans(Class<T> planType, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)Get a list of plans.List<ImmutablePlan>getPlansByProject(@NotNull Project project, @NotNull javax.ws.rs.core.UriInfo uriInfo)Get a list of plans that belong to a project.List<ImmutablePlan>getPlansByProject(@NotNull Project project, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)Get a list of plans that belong to a project.List<ImmutablePlan>getRunnablePlans(@NotNull Project project, @NotNull javax.ws.rs.core.UriInfo uriInfo)Get a list of plans that can be run currently logged in user.List<ImmutableChainStage>getStagesForPlan(@NotNull PlanKey planKey, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)Get a list of stages of specified plan.booleanisPlanCreationAllowed()Check whether or not a plan can be created or not (based on licensing etc)
-
-
-
Constructor Detail
-
PlanRestServiceImpl
@Inject public PlanRestServiceImpl(BambooCachingPermissionManagerFacadeFactory bambooCachingPermissionManagerFacadeFactory, BambooUserManager bambooUserManager, CachedPlanManager cachedPlanManager, LabelManager labelManager, PlanExecutionManager planExecutionManager, PlanManager planManager, ResultsSummaryManager resultsSummaryManager)
-
-
Method Detail
-
getBranchesForChain
public List<ImmutableChainBranch> getBranchesForChain(ImmutablePlan plan)
- Specified by:
getBranchesForChainin interfacePlanRestService
-
getBranchesForJob
public List<ImmutableJob> getBranchesForJob(ImmutableJob job)
- Specified by:
getBranchesForJobin interfacePlanRestService
-
createPaginatedPlanResponse
public RestPlans createPaginatedPlanResponse(List<? extends ImmutablePlan> plans, @Nullable @Nullable com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo)
- Specified by:
createPaginatedPlanResponsein 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:
createPaginatedBranchResponsein interfacePlanRestServiceallBranches- 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:
createLatestActiveBranchResultin interfacePlanRestService
-
getBranchByName
@Nullable public @Nullable ImmutablePlan getBranchByName(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String branchName)
Description copied from interface:PlanRestServiceGet 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:
getBranchByNamein interfacePlanRestService- Parameters:
plan- planbranchName- name of the branch to be fetched- Returns:
ImmutableChainBranch,ImmutableJobor null if not found
-
getPlans
public List<ImmutablePlan> getPlans(@NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface:PlanRestServiceGet 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:
getPlansin 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 com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface:PlanRestServiceGet 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:
getPlansin 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 com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface:PlanRestServiceGet a list of jobs of specified plan.- Specified by:
getJobsForPlanin 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 com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface:PlanRestServiceGet a list of stages of specified plan.- Specified by:
getStagesForPlanin 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:PlanRestServiceGet a list of plans that belong to a project.- Specified by:
getPlansByProjectin 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 com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface:PlanRestServiceGet a list of plans that belong to a project. This method provides favourite filtering.- Specified by:
getPlansByProjectin 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:PlanRestServiceGet a list of plans that can be run currently logged in user.- Specified by:
getRunnablePlansin interfacePlanRestService- Returns:
- A list of plans that the current user can run.
-
assertPlanExistsAndVisible
public void assertPlanExistsAndVisible(@NotNull @NotNull PlanKey planKey)Description copied from interface:PlanRestServiceChecks ifPlanexists and is visible for calling user- Specified by:
assertPlanExistsAndVisiblein interfacePlanRestService
-
assertPlanExistsAndVisible
public void assertPlanExistsAndVisible(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull Class<? extends ImmutablePlan> clazz)Description copied from interface:PlanRestServiceChecks ifPlanexists, has correct type and is visible for calling user- Specified by:
assertPlanExistsAndVisiblein interfacePlanRestService
-
getChainByKey
@NotNull public @NotNull ImmutableChain getChainByKey(@NotNull @NotNull PlanKey planKey)
Description copied from interface:PlanRestServiceReturns aPlanif plan exists and is visible for calling user- Specified by:
getChainByKeyin interfacePlanRestService- Returns:
- the chain matching the given planKey
-
getPlanByKey
@NotNull public @NotNull ImmutablePlan getPlanByKey(@NotNull @NotNull PlanKey planKey)
Description copied from interface:PlanRestServiceReturns aPlanif plan exists and is visible for calling user In clustered mode, there is NO consistency guarantee.- Specified by:
getPlanByKeyin 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:PlanRestServiceReturns aPlanif plan exists and is visible for calling user. There is a guarantee that the data will be up-to-date.- Specified by:
getPlanByKeyWithHighConsistencyGuaranteein interfacePlanRestService- Parameters:
planKey- key of a plan to search for- Returns:
ImmutablePlan
-
getPlanByKeyUnchecked
public ImmutablePlan getPlanByKeyUnchecked(@NotNull @NotNull PlanKey planKey)
Description copied from interface:PlanRestServiceReturns aPlanif plan exists. No permission check is performed.- Specified by:
getPlanByKeyUncheckedin interfacePlanRestService- Parameters:
planKey- key of a plan to search for- Returns:
ImmutablePlanor null if not found
-
isPlanCreationAllowed
public boolean isPlanCreationAllowed()
Description copied from interface:PlanRestServiceCheck whether or not a plan can be created or not (based on licensing etc)- Specified by:
isPlanCreationAllowedin interfacePlanRestService- Returns:
- true if a plan can be created otherwise false;
-
-