com.atlassian.bamboo.plugins.rest.service
Class PlanServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.plugins.rest.service.PlanServiceImpl
All Implemented Interfaces:
PlanService

public class PlanServiceImpl
extends java.lang.Object
implements PlanService


Constructor Summary
PlanServiceImpl(BambooUserManager bambooUserManager, CachedPlanManager cachedPlanManager, FilteringPlanManager filteringPlanManager, LabelManager labelManager, PlanExecutionManager planExecutionManager, PlanManager planManager, ResultsSummaryManager resultsSummaryManager)
           
 
Method Summary
 void assertPlanExistsAndVisible(PlanKey planKey)
          Checks if Plan exists and is visible for calling user
 RestBranchLatestActive createLatestActiveBranchResult(ImmutablePlan branch)
           
 RestPlanBranchList createPaginatedBranchResponse(java.util.List<? extends ImmutablePlan> branches, com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo)
           
 RestPlans createPaginatedPlanResponse(java.util.List<? extends ImmutablePlan> plans, com.atlassian.user.User user, javax.ws.rs.core.UriInfo uriInfo)
           
 ImmutablePlan getBranchByName(ImmutablePlan plan, java.lang.String branchName)
          Get branch of a given plan by name.
 java.util.List<ImmutableChainBranch> getBranchesForChain(ImmutablePlan plan)
           
 java.util.List<ImmutableJob> getBranchesForJob(Job job)
           
 ImmutableChain getChainByKey(PlanKey planKey)
          Returns a Plan if plan exists and is visible for calling user
 ImmutablePlan getPlanByKey(PlanKey planKey)
          Returns a Plan if plan exists and is visible for calling user
 ImmutablePlan getPlanByKeyUnchecked(PlanKey planKey)
          Returns a Plan if plan exists.
 java.util.List<? extends ImmutablePlan> getPlans(javax.ws.rs.core.UriInfo uriInfo, com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
          Get a list of plans.
 java.util.List<? extends ImmutablePlan> getPlansByProject(Project project, javax.ws.rs.core.UriInfo uriInfo)
          Get a list of plans that belong to a project.
 java.util.List<? extends ImmutablePlan> getPlansByProject(Project project, javax.ws.rs.core.UriInfo uriInfo, com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
          Get a list of plans that belong to a project.
 java.util.List<? extends ImmutablePlan> getRunnablePlans(Project project, javax.ws.rs.core.UriInfo uriInfo)
          Get a list of plans that can be run currently logged in user.
 boolean isPlanCreationAllowed()
          Check whether or not a plan can be created or not (based on licensing etc)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlanServiceImpl

public PlanServiceImpl(BambooUserManager bambooUserManager,
                       CachedPlanManager cachedPlanManager,
                       FilteringPlanManager filteringPlanManager,
                       LabelManager labelManager,
                       PlanExecutionManager planExecutionManager,
                       PlanManager planManager,
                       ResultsSummaryManager resultsSummaryManager)
Method Detail

getBranchesForChain

public java.util.List<ImmutableChainBranch> getBranchesForChain(ImmutablePlan plan)
Specified by:
getBranchesForChain in interface PlanService

getBranchesForJob

public java.util.List<ImmutableJob> getBranchesForJob(Job job)
Specified by:
getBranchesForJob in interface PlanService

createPaginatedPlanResponse

public RestPlans createPaginatedPlanResponse(java.util.List<? extends ImmutablePlan> plans,
                                             @Nullable
                                             com.atlassian.user.User user,
                                             javax.ws.rs.core.UriInfo uriInfo)
Specified by:
createPaginatedPlanResponse in interface PlanService

createPaginatedBranchResponse

public RestPlanBranchList createPaginatedBranchResponse(java.util.List<? extends ImmutablePlan> branches,
                                                        @Nullable
                                                        com.atlassian.user.User user,
                                                        javax.ws.rs.core.UriInfo uriInfo)
Specified by:
createPaginatedBranchResponse in interface PlanService

createLatestActiveBranchResult

@Nullable
public RestBranchLatestActive createLatestActiveBranchResult(ImmutablePlan branch)
Specified by:
createLatestActiveBranchResult in interface PlanService

getBranchByName

public ImmutablePlan getBranchByName(@NotNull
                                     ImmutablePlan plan,
                                     @NotNull
                                     java.lang.String branchName)
Description copied from interface: PlanService
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 interface PlanService
Parameters:
plan - plan
branchName - name of the branch to be fetched
Returns:
ImmutableChainBranch, ImmutableJob or null if not found

getPlans

public java.util.List<? extends ImmutablePlan> getPlans(@NotNull
                                                        javax.ws.rs.core.UriInfo uriInfo,
                                                        @NotNull
                                                        com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface: PlanService
Get a list of plans. This method provides favourite filtering.

Specified by:
getPlans in interface PlanService
Returns:
Filtered list of plans belonging to a project.

getPlansByProject

public java.util.List<? extends ImmutablePlan> getPlansByProject(@NotNull
                                                                 Project project,
                                                                 @NotNull
                                                                 javax.ws.rs.core.UriInfo uriInfo)
Description copied from interface: PlanService
Get a list of plans that belong to a project.

Specified by:
getPlansByProject in interface PlanService
Returns:
Filtered list of plans belonging to a project.

getPlansByProject

public java.util.List<? extends ImmutablePlan> getPlansByProject(@NotNull
                                                                 Project project,
                                                                 @NotNull
                                                                 javax.ws.rs.core.UriInfo uriInfo,
                                                                 @NotNull
                                                                 com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
Description copied from interface: PlanService
Get a list of plans that belong to a project. This method provides favourite filtering.

Specified by:
getPlansByProject in interface PlanService
Returns:
Filtered list of plans belonging to a project.

getRunnablePlans

public java.util.List<? extends ImmutablePlan> getRunnablePlans(@NotNull
                                                                Project project,
                                                                @NotNull
                                                                javax.ws.rs.core.UriInfo uriInfo)
Description copied from interface: PlanService
Get a list of plans that can be run currently logged in user.

Specified by:
getRunnablePlans in interface PlanService
Returns:

assertPlanExistsAndVisible

public void assertPlanExistsAndVisible(@NotNull
                                       PlanKey planKey)
Description copied from interface: PlanService
Checks if Plan exists and is visible for calling user

Specified by:
assertPlanExistsAndVisible in interface PlanService

getChainByKey

@NotNull
public ImmutableChain getChainByKey(@NotNull
                                            PlanKey planKey)
Returns a Plan if plan exists and is visible for calling user

Specified by:
getChainByKey in interface PlanService
Parameters:
planKey -
Returns:
Throws:
NotFoundException, - AccessDeniedException

getPlanByKey

@NotNull
public ImmutablePlan getPlanByKey(@NotNull
                                          PlanKey planKey)
Description copied from interface: PlanService
Returns a Plan if plan exists and is visible for calling user

Specified by:
getPlanByKey in interface PlanService
Parameters:
planKey - key of a plan to search for
Returns:
ImmutablePlan

getPlanByKeyUnchecked

public ImmutablePlan getPlanByKeyUnchecked(@NotNull
                                           PlanKey planKey)
Description copied from interface: PlanService
Returns a Plan if plan exists. No permission check is performed.

Specified by:
getPlanByKeyUnchecked in interface PlanService
Parameters:
planKey - key of a plan to search for
Returns:
ImmutablePlan or null if not found

isPlanCreationAllowed

public boolean isPlanCreationAllowed()
Description copied from interface: PlanService
Check whether or not a plan can be created or not (based on licensing etc)

Specified by:
isPlanCreationAllowed in interface PlanService
Returns:
true if a plan can be created otherwise false;


Copyright © 2012 Atlassian. All Rights Reserved.