|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.bamboo.plan.PlanManagerImpl
public class PlanManagerImpl
| Constructor Summary | |
|---|---|
PlanManagerImpl(PlanDao planDao,
BambooLicenseManager bambooLicenseManager,
com.atlassian.event.EventManager eventManager,
ProjectManager projectManager)
|
|
| Method Summary | ||
|---|---|---|
boolean |
assertPlanPermission(Plan plan)
Used to validate user permission for plan. |
|
void |
createPlan(Plan plan)
Same as savePlan, but create permissions used instead of edit permissions. |
|
void |
deletePlan(Plan plan)
Removes the plan object from the database. |
|
java.util.Set<TopLevelPlan> |
filterFavouritedPlans(java.util.Collection<TopLevelPlan> plans,
com.atlassian.user.User user)
Return a set of Builds that are a subset of the given TopLevelPlans collection that are favourited by the User |
|
java.util.List<TopLevelPlan> |
getAllPlans()
Returns all TopLevelPlan's |
|
|
getAllPlans(java.lang.Class<T> planType)
Returns all Plan's filtered by Class |
|
|
getAllPlansByProject(Project project,
java.lang.Class<T> planType)
Returns all Plan's filtered by Project and Class, including the plans
marked for deletion. |
|
|
getAllPlansForClone(java.lang.Class<T> planType)
Returns all Plan's filtered by Class
Return list filtered to show only plans the current user is allowed to clone. |
|
|
getAllPlansMarkedForDeletion(java.lang.Class<T> planType)
Returns a list of Plans that are com.atlassian.bamboo.plan.Plan#markForDeletion() for the given type |
|
java.util.List<TopLevelPlan> |
getAllPlansUnrestricted()
Returns all TopLevelPlan's ignoring permissions |
|
java.util.Set<TopLevelPlan> |
getFavouritePlans(com.atlassian.user.User user)
|
|
Plan |
getPlanById(long id)
Returns a Plan by its id |
|
|
getPlanById(long id,
java.lang.Class<T> planType)
Returns a Plan by its id and Class |
|
Plan |
getPlanByKey(PlanKey planKey)
Returns a Plan by its PlanKey |
|
|
getPlanByKey(PlanKey planKey,
java.lang.Class<T> planType)
Returns a Plan by its PlanKey and Class |
|
Plan |
getPlanByKey(java.lang.String planKey)
Returns a Plan by its planKey |
|
|
getPlanByKey(java.lang.String planKey,
java.lang.Class<T> planType)
Returns a Plan by its planKey and Class |
|
|
getPlanByKeyIfOfType(PlanKey planKey,
java.lang.Class<T> planType)
Returns a Plan by its planKey and if it's of the type Class. |
|
|
getPlanByKeyIfOfType(java.lang.String planKey,
java.lang.Class<T> planType)
Returns a Plan by its planKey and if it's of the type Class. |
|
|
getPlanByName(java.lang.String projectKey,
java.lang.String planName,
java.lang.Class<T> planType)
Returns a Plan from a project with the given plan name and Class
It is not possible to use this method if the planType parameter is a marker interface type such as Plan, Buildable or TopLevelPlan
since it is possible to have a Chain and a Job that share the same name. |
|
|
getPlanByPartialKeyAndName(PlanKey partialPlanKey,
java.lang.String planName,
java.lang.Class<T> planType)
Returns a Plan that matches the start of the given PlanKey and the full plan name |
|
Plan |
getPlanByResultKey(PlanResultKey planResultKey)
Returns a Plan by a PlanResultKey |
|
|
getPlanByResultKey(PlanResultKey planResultKey,
java.lang.Class<T> planType)
Returns a Plan from a PlanResultKey and Class |
|
int |
getPlanCount()
|
|
|
getPlanCount(java.lang.Class<T> planType)
How many plans filtered by Class currently exist |
|
java.util.List<TopLevelPlan> |
getPlansByProject(Project project)
Returns all TopLevelPlan's filtered by Project |
|
|
getPlansByProject(Project project,
java.lang.Class<T> planType)
Returns all Plan's filtered by Project and Class |
|
Plan |
getPlanSkeletonForPermissionCheckingByKey(java.lang.String planKey)
Returns a Plan skeleton skeleton providing ONLY id and key, that matches the given key
This method should be used only for permission checking using Acegi
If Job key is provided as a parameter, parent Chain will be returned anyway, as Acegi assertions are defined only for TopLevelPlans |
|
|
getProjectPlanMap(java.lang.Class<T> planType,
boolean includeEmptyProjects)
Return mapping of Project to Plan of given type |
|
boolean |
isPlanCreationAllowed()
Check whether or not a plan can be created or not (based on licensing etc) USE SPARINGLY!!! |
|
java.util.Map<PlanKey,PlanKey> |
movePlanToProject(Plan plan,
Project project,
java.lang.String newPlanKey,
java.lang.String newBuildName)
Moves plan to a selected project. |
|
|
narrow(Plan plan,
java.lang.Class<T> aClass)
Deprecated. |
|
java.lang.String |
revertVcsRevisionKey(java.lang.String buildKey,
java.lang.String revisionForBuild,
java.lang.String previousRevision)
Revert lastVcsRevisionKey in build based on previous build revision contained in BuildContext. |
|
void |
savePlan(Plan plan)
Saves the Plan |
|
void |
setPlanSuspendedState(Plan originalPlan,
boolean newState)
Persists enable/disable state of a plan. |
|
void |
updateLatestVcsKey(Plan plan,
java.lang.String vcsRevisionKey)
Updates the build to the latest passed revision key |
|
void |
updateNamesAndDescription(java.lang.String projectName,
java.lang.String buildName,
java.lang.String description,
Plan plan)
Updates project and plan names and plan description. |
|
java.lang.String |
updateVcsRevisionKey(BuildContext buildContext)
Updates lastVcsRevisionKey in build based on revision contained in BuildContext |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PlanManagerImpl(@NotNull
PlanDao planDao,
@NotNull
BambooLicenseManager bambooLicenseManager,
@NotNull
com.atlassian.event.EventManager eventManager,
ProjectManager projectManager)
| Method Detail |
|---|
@Deprecated
@Nullable
public <T extends Plan> T narrow(@NotNull
Plan plan,
@NotNull
java.lang.Class<T> aClass)
PlanManagerPlan to the given Class
Returns null if Plan could not be converted
This method should only be used if testing the capability of a Plan where generically provided.
For example, a perfectly acceptable use of #narrow(Plan,Class) may be where you are given a collection of Plans
and you want to perform a specific operation on plans that are Buildable.
In other cases (if possible) you should use one of the getPlanBy methods on this class instead of #narrow(Plan,Class).
narrow in interface PlanManagerplan - - to be narrowedaClass - - type to be narrowed to
@Nullable
public Plan getPlanById(long id)
throws IncorrectPlanTypeException
PlanManagerPlan by its id
getPlanById in interface PlanManagerid - of the plan
IncorrectPlanTypeException - if plan cannot be found
@Nullable
public <T extends Plan> T getPlanById(long id,
java.lang.Class<T> planType)
throws IncorrectPlanTypeException
PlanManagerPlan by its id and Class
getPlanById in interface PlanManagerid - of the planplanType - - the type of the plan to retrieve
IncorrectPlanTypeException - if plan cannot be found with the correct type
@Nullable
public Plan getPlanByKey(@NotNull
java.lang.String planKey)
throws IncorrectPlanTypeException
PlanManagerPlan by its planKey
getPlanByKey in interface PlanManagerplanKey - of the plan to find
IncorrectPlanTypeException - if plan cannot be found with the correct type (should never happen)
@Nullable
public <T extends Plan> T getPlanByKey(@NotNull
java.lang.String planKey,
java.lang.Class<T> planType)
throws IncorrectPlanTypeException
PlanManagerPlan by its planKey and Class
getPlanByKey in interface PlanManagerplanKey - to search forplanType - - the type of the plan to retrieve
IncorrectPlanTypeException - if plan cannot be found with the correct type
public Plan getPlanSkeletonForPermissionCheckingByKey(@NotNull
java.lang.String planKey)
PlanManagerPlan skeleton skeleton providing ONLY id and key, that matches the given key
This method should be used only for permission checking using Acegi
If Job key is provided as a parameter, parent Chain will be returned anyway, as Acegi assertions are defined only for TopLevelPlans
getPlanSkeletonForPermissionCheckingByKey in interface PlanManagerplanKey - of the plan to find
public <T extends Plan> T getPlanByKeyIfOfType(@NotNull
java.lang.String planKey,
@NotNull
java.lang.Class<T> planType)
PlanManagerPlan by its planKey and if it's of the type Class. Does not throw IncorrectPlanTypeException.
Should only be used when the type of the plan can not be known.
getPlanByKeyIfOfType in interface PlanManager
public <T extends Plan> T getPlanByKeyIfOfType(@NotNull
PlanKey planKey,
@NotNull
java.lang.Class<T> planType)
PlanManagerPlan by its planKey and if it's of the type Class. Does not throw IncorrectPlanTypeException.
Should only be used when the type of the plan can not be known.
getPlanByKeyIfOfType in interface PlanManagerplanKey - to search forplanType - the type of the plan to retrieve
public Plan getPlanByKey(@NotNull
PlanKey planKey)
throws IncorrectPlanTypeException
PlanManagerPlan by its PlanKey
getPlanByKey in interface PlanManagerplanKey - to search for
IncorrectPlanTypeException - if plan cannot be found with the correct type (should never happen)
public boolean assertPlanPermission(@NotNull
Plan plan)
PlanManager
assertPlanPermission in interface PlanManagerplan - to check the permissions of
public <T extends Plan> T getPlanByKey(@NotNull
PlanKey planKey,
java.lang.Class<T> planType)
throws IncorrectPlanTypeException
PlanManagerPlan by its PlanKey and Class
getPlanByKey in interface PlanManagerplanKey - to search forplanType - - the type of the plan to retrieve
IncorrectPlanTypeException - if plan cannot be found with the correct type
public Plan getPlanByResultKey(@NotNull
PlanResultKey planResultKey)
throws IncorrectPlanTypeException
PlanManagerPlan by a PlanResultKey
getPlanByResultKey in interface PlanManagerplanResultKey - to look for the parent plan
IncorrectPlanTypeException - if plan cannot be found with the correct type (should never happen)
public <T extends Plan> T getPlanByResultKey(@NotNull
PlanResultKey planResultKey,
java.lang.Class<T> planType)
throws IncorrectPlanTypeException
PlanManagerPlan from a PlanResultKey and Class
getPlanByResultKey in interface PlanManagerplanResultKey - to look for the parent planplanType - - the type of the plan to retrieve
IncorrectPlanTypeException - if plan cannot be found with the correct type
@Nullable
public <T extends Plan> T getPlanByName(@NotNull
java.lang.String projectKey,
@NotNull
java.lang.String planName,
java.lang.Class<T> planType)
throws IncorrectPlanTypeException
PlanManagerPlan from a project with the given plan name and Class
It is not possible to use this method if the planType parameter is a marker interface type such as Plan, Buildable or TopLevelPlan
since it is possible to have a Chain and a Job that share the same name.
getPlanByName in interface PlanManagerprojectKey - of the project to look for the plan inplanName - - name of the plan inside the project: this is just the plan component of the name (i.e does not include the project component)planType - - the type of the plan to retrieve
IncorrectPlanTypeException - if the result cannot be guaranteed to be unique
@Nullable
public <T extends Plan> T getPlanByPartialKeyAndName(@NotNull
PlanKey partialPlanKey,
@NotNull
java.lang.String planName,
java.lang.Class<T> planType)
throws IncorrectPlanTypeException
PlanManagerPlan that matches the start of the given PlanKey and the full plan name
getPlanByPartialKeyAndName in interface PlanManagerpartialPlanKey - - the start of the plan keyplanName - - name of the plan to search for: this is just the plan component of the name (i.e does not include the project component)planType - - the type of the plan to retrieve
IncorrectPlanTypeException - if plan cannot be found with the correct type@NotNull public java.util.List<TopLevelPlan> getAllPlans()
PlanManagerTopLevelPlan's
getAllPlans in interface PlanManager@NotNull public java.util.List<TopLevelPlan> getAllPlansUnrestricted()
PlanManagerTopLevelPlan's ignoring permissions
getAllPlansUnrestricted in interface PlanManager@NotNull public <T extends Plan> java.util.List<T> getAllPlans(java.lang.Class<T> planType)
PlanManagerPlan's filtered by Class
getAllPlans in interface PlanManagerplanType - - the type of the plan to retrieve
Plan.getName()@NotNull public <T extends Plan> java.util.List<T> getAllPlansForClone(java.lang.Class<T> planType)
PlanManagerPlan's filtered by Class
Return list filtered to show only plans the current user is allowed to clone.
getAllPlansForClone in interface PlanManagerplanType - the class type of the plans you want returned
@NotNull public java.util.List<TopLevelPlan> getPlansByProject(Project project)
PlanManagerTopLevelPlan's filtered by Project
getPlansByProject in interface PlanManagerproject - - that the plans will belong to
TopLevelPlan plans contained within the given project
@NotNull
public <T extends Plan> java.util.List<T> getPlansByProject(Project project,
java.lang.Class<T> planType)
PlanManagerPlan's filtered by Project and Class
getPlansByProject in interface PlanManagerproject - - that the plans will belong toplanType - - the type of the plan to retrieve
@NotNull
public <T extends Plan> java.util.List<T> getAllPlansByProject(Project project,
java.lang.Class<T> planType)
PlanManagerPlan's filtered by Project and Class, including the plans
marked for deletion.
getAllPlansByProject in interface PlanManagerproject - - that the plans will belong toplanType - - the type of the plan to retrieve
@NotNull
public <T extends Plan> java.util.Map<Project,java.util.Collection<T>> getProjectPlanMap(java.lang.Class<T> planType,
boolean includeEmptyProjects)
PlanManagerProject to Plan of given type
getProjectPlanMap in interface PlanManagerplanType - type of plan to be selected from DBincludeEmptyProjects - should empty projects be included in result
Project to Plan of given typepublic int getPlanCount()
getPlanCount in interface PlanManagerBuildable's existspublic <T extends Plan> int getPlanCount(java.lang.Class<T> planType)
PlanManagerClass currently exist
getPlanCount in interface PlanManagerplanType - - the type of the plan to retrieve
public void savePlan(@NotNull
Plan plan)
PlanManagerPlan
savePlan in interface PlanManagerplan - to be saved
public void createPlan(@NotNull
Plan plan)
PlanManager
createPlan in interface PlanManager
public void setPlanSuspendedState(Plan originalPlan,
boolean newState)
PlanManager
setPlanSuspendedState in interface PlanManageroriginalPlan - to be suspended/resumed
public void updateLatestVcsKey(@NotNull
Plan plan,
@NotNull
java.lang.String vcsRevisionKey)
PlanManager
updateLatestVcsKey in interface PlanManagerplan - - Plan keyvcsRevisionKey - - revision key
public java.lang.String updateVcsRevisionKey(@NotNull
BuildContext buildContext)
PlanManager
updateVcsRevisionKey in interface PlanManagerbuildContext - containing the plan and vcs information to be persisted to the db.
public java.lang.String revertVcsRevisionKey(@NotNull
java.lang.String buildKey,
@NotNull
java.lang.String revisionForBuild,
@Nullable
java.lang.String previousRevision)
PlanManager
revertVcsRevisionKey in interface PlanManagerbuildKey - - plan to revertrevisionForBuild - - the revision number that the build should be before reverting (used to see if another build
may have started since this one.)previousRevision - - the revision that the build should be reverted to if above conditions met
public boolean isPlanCreationAllowed()
isPlanCreationAllowed in interface PlanManager
public void updateNamesAndDescription(@NotNull
java.lang.String projectName,
@NotNull
java.lang.String buildName,
@Nullable
java.lang.String description,
@NotNull
Plan plan)
PlanManager
updateNamesAndDescription in interface PlanManagerprojectName - new name of the projectbuildName - new name of the plandescription - new plan descriptionplan - to update the details of
public void deletePlan(@NotNull
Plan plan)
PlanManager
deletePlan in interface PlanManagerplan - to delete.
public java.util.Map<PlanKey,PlanKey> movePlanToProject(Plan plan,
Project project,
java.lang.String newPlanKey,
java.lang.String newBuildName)
PlanManager
movePlanToProject in interface PlanManagerplan - - plan to be moved/renamedproject - - project plan should be moved tonewPlanKey - - new key for the plan (not a full key)newBuildName - - new name for the plan
@NotNull public <T extends Plan> java.util.Collection<T> getAllPlansMarkedForDeletion(java.lang.Class<T> planType)
PlanManagerPlans that are com.atlassian.bamboo.plan.Plan#markForDeletion() for the given type
getAllPlansMarkedForDeletion in interface PlanManager
@NotNull
public java.util.Set<TopLevelPlan> filterFavouritedPlans(@NotNull
java.util.Collection<TopLevelPlan> plans,
@NotNull
com.atlassian.user.User user)
PlanManagerBuilds that are a subset of the given TopLevelPlans collection that are favourited by the User
filterFavouritedPlans in interface PlanManagerplans - to filteruser - to return the favourites of
Builds that are a subset of the given TopLevelPlans collection that are favourited by the User
public java.util.Set<TopLevelPlan> getFavouritePlans(@NotNull
com.atlassian.user.User user)
getFavouritePlans in interface PlanManager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||