Interface PlanRestService

    • Method Detail

      • createPaginatedBranchResponse

        RestPlanBranchList createPaginatedBranchResponse​(List<? extends ImmutablePlan> branches,
                                                         @Nullable
                                                         @Nullable com.atlassian.user.User user,
                                                         javax.ws.rs.core.UriInfo uriInfo,
                                                         boolean allBranches)
        Parameters:
        branches -
        user -
        uriInfo -
        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
      • getBranchByName

        @Nullable
        @Nullable ImmutablePlan getBranchByName​(@NotNull
                                                @NotNull ImmutablePlan plan,
                                                @NotNull
                                                @NotNull String branchName)
        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.
        Parameters:
        plan - plan
        branchName - name of the branch to be fetched
        Returns:
        ImmutableChainBranch, ImmutableJob or null if not found
      • createPaginatedPlanResponse

        RestPlans createPaginatedPlanResponse​(List<? extends ImmutablePlan> plans,
                                              @Nullable
                                              @Nullable com.atlassian.user.User user,
                                              javax.ws.rs.core.UriInfo uriInfo)
      • getPlans

        List<ImmutablePlan> getPlans​(@NotNull
                                     @NotNull javax.ws.rs.core.UriInfo uriInfo,
                                     @NotNull
                                     @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
        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
        Parameters:
        uriInfo -
        authenticationContext -
        Returns:
        Filtered list of plans belonging to a project.
      • getPlans

        <T extends ImmutablePlanList<T> getPlans​(Class<T> planType,
                                                   @NotNull
                                                   @NotNull javax.ws.rs.core.UriInfo uriInfo,
                                                   @NotNull
                                                   @NotNull com.atlassian.plugins.rest.common.security.AuthenticationContext authenticationContext)
        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
        Parameters:
        planType - type of plans
        uriInfo -
        authenticationContext -
        Returns:
        Filtered list of plans belonging to a project.
      • getJobsForPlan

        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)
        Get a list of jobs of specified plan.
        Parameters:
        planKey - planKey
        uriInfo -
        authenticationContext -
        Returns:
        Filtered list of jobs belonging to a plan.
      • getStagesForPlan

        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)
        Get a list of stages of specified plan.
        Parameters:
        planKey - planKey
        uriInfo -
        authenticationContext -
        Returns:
        Filtered list of stages belonging to a plan.
      • getPlansByProject

        List<ImmutablePlan> getPlansByProject​(@NotNull
                                              @NotNull Project project,
                                              @NotNull
                                              @NotNull javax.ws.rs.core.UriInfo uriInfo)
        Get a list of plans that belong to a project.
        Parameters:
        project -
        uriInfo -
        Returns:
        Filtered list of plans belonging to a project.
      • getPlansByProject

        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)
        Get a list of plans that belong to a project. This method provides favourite filtering.
        Parameters:
        project -
        uriInfo -
        authenticationContext -
        Returns:
        Filtered list of plans belonging to a project.
      • getRunnablePlans

        List<ImmutablePlan> getRunnablePlans​(@NotNull
                                             @NotNull Project project,
                                             @NotNull
                                             @NotNull javax.ws.rs.core.UriInfo uriInfo)
        Get a list of plans that can be run currently logged in user.
        Parameters:
        project -
        uriInfo -
        Returns:
        A list of plans that the current user can run.
      • assertPlanExistsAndVisible

        void assertPlanExistsAndVisible​(@NotNull
                                        @NotNull PlanKey planKey)
        Checks if Plan exists and is visible for calling user
        Parameters:
        planKey -
      • assertPlanExistsAndVisible

        void assertPlanExistsAndVisible​(@NotNull
                                        @NotNull PlanKey planKey,
                                        @NotNull
                                        @NotNull Class<? extends ImmutablePlan> clazz)
        Checks if Plan exists, has correct type and is visible for calling user
        Parameters:
        planKey -
        clazz -
      • getChainByKey

        @NotNull
        @NotNull ImmutableChain getChainByKey​(@NotNull
                                              @NotNull PlanKey planKey)
        Returns a Plan if plan exists and is visible for calling user
        Parameters:
        planKey -
        Returns:
        the chain matching the given planKey
      • getPlanByKey

        @NotNull
        @NotNull ImmutablePlan getPlanByKey​(@NotNull
                                            @NotNull PlanKey planKey)
        Returns a Plan if plan exists and is visible for calling user In clustered mode, there is NO consistency guarantee.
        Parameters:
        planKey - key of a plan to search for
        Returns:
        ImmutablePlan
        Throws:
        NotFoundException - when plan was not found
        org.acegisecurity.AccessDeniedException - when authenticated user has no permission to the plan
      • getPlanByKeyWithHighConsistencyGuarantee

        @NotNull
        @NotNull ImmutablePlan getPlanByKeyWithHighConsistencyGuarantee​(@NotNull
                                                                        @NotNull PlanKey planKey)
        Returns a Plan if plan exists and is visible for calling user. There is a guarantee that the data will be up-to-date.
        Parameters:
        planKey - key of a plan to search for
        Returns:
        ImmutablePlan
        Throws:
        NotFoundException - when plan was not found
        org.acegisecurity.AccessDeniedException - when authenticated user has no permission to the plan
      • getPlanByKeyUnchecked

        @Nullable
        @Nullable ImmutablePlan getPlanByKeyUnchecked​(@NotNull
                                                      @NotNull PlanKey planKey)
        Returns a Plan if plan exists. No permission check is performed.
        Parameters:
        planKey - key of a plan to search for
        Returns:
        ImmutablePlan or null if not found
      • isPlanCreationAllowed

        boolean isPlanCreationAllowed()
        Check whether or not a plan can be created or not (based on licensing etc)
        Returns:
        true if a plan can be created otherwise false;