public class PlanHibernateDao<T extends Plan> extends BambooHibernateObjectWithOidDao<Plan> implements PlanDao
| Constructor and Description |
|---|
PlanHibernateDao(TransactionAndHibernateTemplate transactionTemplate) |
| Modifier and Type | Method and Description |
|---|---|
List<ImmutableChain> |
filterFavouritedPlans(Collection<? extends ImmutableChain> plans,
com.atlassian.user.User user)
Return a collection of
TopLevelPlans that are a subset of the given Plans collection that are favourited by the User |
<T extends Plan> |
findAllPlans(Class<T> planType)
Return a
Plan collection for specified plan type. |
<T extends Plan> |
findAllPlans(Class<T> planType,
int firstResult,
int maxResults)
Return a
Plan collection for specified plan type. |
<T extends Plan> |
findAllPlansByProject(Project project,
Class<T> planType)
|
<E extends Plan> |
findById(long id,
Class<E> aClass)
Find an entity by its id
|
<T extends Plan> |
findPlansByProject(Project project,
Class<T> planType)
|
<T extends Plan> |
getAllPlanKeys(Class<T> planType)
Returns all plan keys of a particular type, including the plans marked for deletion.
|
<T extends Plan> |
getAllPlansMarkedForDeletion(Class<T> planType)
Returns a list of
Plans that are ImmutableDeletable.isMarkedForDeletion() for the given type |
int |
getBranchCount(ImmutablePlan plan)
Returns the number of branches that exist for the given plan
|
List<Pair<Number,Number>> |
getBranchesCount()
Returns the number of branches that exist for master plans in Bamboo.
|
List<ChainBranch> |
getBranchesForChain(ImmutableChain chain)
Returns all branches which have the given chain as their master
|
Collection<Job> |
getBranchesForJob(Job job) |
List<ChainBranchIdentifier> |
getBranchIdentifiersForChain(PlanIdentifier plan)
Returns minimal data about all branches which have the given chain as their master
|
List<PlanKey> |
getJobKeys(PlanKey chainKey)
Return all plan keys of Jobs that belong to a Chain
|
BambooEntityOid |
getMaxPlanOid(int serverKey,
BambooEntityType entityType)
Returns the max
BambooEntityOid that's currently in use of the specified entity type, with the
given server key. |
<T extends Plan> |
getPlanByKey(PlanKey planKey,
Class<T> aClass)
Return a
Plan that matches the given key |
<T extends Plan> |
getPlanByKey(String planKey,
Class<T> aClass)
Return a
Plan that matches the given key |
<T extends Plan> |
getPlanByPartialKeyAndName(PlanKey partialPlanKey,
String planName,
Class<T> planType)
|
Class<? extends Plan> |
getPlanClass(PlanKey planKey) |
<T extends Plan> |
getPlanCount(Class<T> planType)
How many plans filtered by
Class currently exist |
int |
getPlanCount(ProjectIdentifier projectIdentifier)
How many plans currently exist in a
project. |
PlanIdentifier |
getPlanIdentifierForPermissionCheckingByKey(String planKey)
Return a
Plan 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 |
<T extends Plan> |
getPlanIdentifiersForProject(ProjectIdentifier project,
Class<T> planType,
boolean includeMarkedForDeletion)
Returns minimal data about all plans in the given project
|
<T extends Plan> |
getPlanKeys(Class<T> planType)
Returns all plan keys of a particular type, NOT including the plans marked for deletion.
|
boolean |
isChainNameConflicting(String projectKey,
long idOfChainBeingVerified,
String planName)
Verifies whether a
Chain name is unique with the given project |
boolean |
isPlanKeyConflicting(PlanKey planKey)
Verifies whether a
Plan key is unique within whole Bamboo installation |
boolean |
isPlanKeyConflicting(PlanKey planKey,
long idOfChainBeingVerified)
Verifies whether a
Plan key is unique within whole Bamboo installation |
void |
markPlanForDeletion(PlanKey planKey)
Efficiently marks a plan to be deleted
|
void |
save(Plan plan)
Saves the given entity.
|
void |
setPlanDiscriminatorRegistry(PlanDiscriminatorRegistry planDiscriminatorRegistry) |
void |
syncDeletionStatusOfChainBranches()
Performs a cleanup task to mark
ChainBranch objects that have a master Plan that is marked
to be deleted, but is not marked as deleted. |
void |
syncDeletionStatusOfJobs()
Performs a cleanup task to mark
Job objects that have a Plan or ChainStage that
is marked to be deleted, but it itself was not marked as deleted. |
findByOidcountAll, countWithRestriction, delete, deleteAll, executeCountQuery, findAll, merge, saveAllgetCacheAwareHibernateTemplatecheckDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitfindByOidcountAll, countWithRestriction, delete, deleteAll, findAll, merge, saveAllpublic PlanHibernateDao(TransactionAndHibernateTemplate transactionTemplate)
public <T extends Plan> T getPlanByKey(@NotNull PlanKey planKey, Class<T> aClass)
PlanDaoPlan that matches the given keygetPlanByKey in interface PlanDaopublic <T extends Plan> T getPlanByKey(@NotNull String planKey, Class<T> aClass)
PlanDaoPlan that matches the given keygetPlanByKey in interface PlanDao@Nullable public PlanIdentifier getPlanIdentifierForPermissionCheckingByKey(@NotNull String planKey)
PlanDaoPlan 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 TopLevelPlansgetPlanIdentifierForPermissionCheckingByKey in interface PlanDaopublic Class<? extends Plan> getPlanClass(@NotNull PlanKey planKey)
getPlanClass in interface PlanDaopublic <E extends Plan> E findById(long id, @NotNull Class<E> aClass)
BambooObjectDaofindById in interface BambooObjectDao<Plan>findById in class BambooHibernateObjectDao<Plan>id - id of entityaClass - class of entitypublic boolean isChainNameConflicting(@NotNull
String projectKey,
long idOfChainBeingVerified,
@NotNull
String planName)
PlanDaoChain name is unique with the given project
isChainNameConflicting in interface PlanDaoprojectKey - of the project to look for the plan inidOfChainBeingVerified - the id of the plan that has to be ignored during lookup (when you're saving a Plan, you should supply the plan id here)planName - - name of the plan inside the project: this is just the plan component of the name (i.e does
not include the project component)public boolean isPlanKeyConflicting(@NotNull
PlanKey planKey)
PlanDaoPlan key is unique within whole Bamboo installationisPlanKeyConflicting in interface PlanDaoplanKey - key of the plan to be searched for in the databasepublic boolean isPlanKeyConflicting(@NotNull
PlanKey planKey,
long idOfChainBeingVerified)
PlanDaoPlan key is unique within whole Bamboo installationisPlanKeyConflicting in interface PlanDaoplanKey - key of the plan to be searched for in the databaseidOfChainBeingVerified - id of plan that is verified (i.e. if that plan uses the key, it's not a duplicate key)@Nullable public <T extends Plan> T getPlanByPartialKeyAndName(@NotNull PlanKey partialPlanKey, @NotNull String planName, Class<T> planType)
PlanDaogetPlanByPartialKeyAndName in interface PlanDaopublic <T extends Plan> int getPlanCount(Class<T> planType)
PlanDaoClass currently existgetPlanCount in interface PlanDaopublic int getPlanCount(@NotNull
ProjectIdentifier projectIdentifier)
PlanDaoproject.getPlanCount in interface PlanDaoprojectIdentifier - identifier of the project@NotNull public <T extends Plan> List<PlanKey> getPlanKeys(Class<T> planType)
PlanDaogetPlanKeys in interface PlanDao@NotNull public <T extends Plan> List<PlanKey> getAllPlanKeys(Class<T> planType)
PlanDaogetAllPlanKeys in interface PlanDao@NotNull public List<PlanKey> getJobKeys(@NotNull PlanKey chainKey)
PlanDaogetJobKeys in interface PlanDaochainKey - key of a Chain@NotNull public <T extends Plan> List<T> findPlansByProject(@NotNull Project project, Class<T> planType)
PlanDaofindPlansByProject in interface PlanDao@NotNull public <T extends Plan> List<T> findAllPlansByProject(@NotNull Project project, Class<T> planType)
PlanDaofindAllPlansByProject in interface PlanDao@NotNull public <T extends Plan> List<T> findAllPlans(Class<T> planType)
PlanDaoPlan collection for specified plan type. Does not include plans marked for deletion.findAllPlans in interface PlanDaoplanType - type of plan to be selected from DBPlan collection for specified plan type@NotNull public <T extends Plan> List<T> findAllPlans(Class<T> planType, int firstResult, int maxResults)
PlanDaoPlan collection for specified plan type. Does not include plans marked for deletion.findAllPlans in interface PlanDaoplanType - type of plan to be selected from DBfirstResult - firstResult for a paginated resultsmaxResults - maximum number of results to returnPlan collection for specified plan typepublic void setPlanDiscriminatorRegistry(PlanDiscriminatorRegistry planDiscriminatorRegistry)
public List<ImmutableChain> filterFavouritedPlans(@NotNull Collection<? extends ImmutableChain> plans, @NotNull com.atlassian.user.User user)
PlanDaoTopLevelPlans that are a subset of the given Plans collection that are favourited by the UserfilterFavouritedPlans in interface PlanDao@NotNull public <T extends Plan> Collection<T> getAllPlansMarkedForDeletion(Class<T> planType)
PlanDaoPlans that are ImmutableDeletable.isMarkedForDeletion() for the given typegetAllPlansMarkedForDeletion in interface PlanDaopublic void save(@NotNull
Plan plan)
BambooObjectDaoEntityObject this method will:
- update EntityObject.getLastModificationDate()
- set EntityObject.getCreationDate() if the object has not been savedsave in interface BambooObjectDao<Plan>save in class BambooHibernateObjectDao<Plan>plan - entity to be saved@NotNull public List<ChainBranch> getBranchesForChain(ImmutableChain chain)
PlanDaogetBranchesForChain in interface PlanDaochain - master planpublic Collection<Job> getBranchesForJob(Job job)
getBranchesForJob in interface PlanDao@NotNull public List<ChainBranchIdentifier> getBranchIdentifiersForChain(@NotNull PlanIdentifier plan)
PlanDaogetBranchIdentifiersForChain in interface PlanDaoplan - master@NotNull public <T extends Plan> List<PlanIdentifier> getPlanIdentifiersForProject(@NotNull ProjectIdentifier project, @NotNull Class<T> planType, boolean includeMarkedForDeletion)
PlanDaogetPlanIdentifiersForProject in interface PlanDaoproject - - to get plans forplanType - to filter plans byincludeMarkedForDeletion - - true if you want to include any results currently marked for deletionpublic int getBranchCount(@NotNull
ImmutablePlan plan)
PlanDaogetBranchCount in interface PlanDaoplan - to count branches ofpublic List<Pair<Number,Number>> getBranchesCount()
PlanDaogetBranchesCount in interface PlanDaopublic void markPlanForDeletion(PlanKey planKey)
PlanDaomarkPlanForDeletion in interface PlanDaopublic void syncDeletionStatusOfJobs()
PlanDaoJob objects that have a Plan or ChainStage that
is marked to be deleted, but it itself was not marked as deleted.syncDeletionStatusOfJobs in interface PlanDaopublic void syncDeletionStatusOfChainBranches()
PlanDaoChainBranch objects that have a master Plan that is marked
to be deleted, but is not marked as deleted.syncDeletionStatusOfChainBranches in interface PlanDao@Nullable public BambooEntityOid getMaxPlanOid(int serverKey, @NotNull BambooEntityType entityType)
PlanDaoBambooEntityOid that's currently in use of the specified entity type, with the
given server key.
Allowed entity types:
- BambooEntityType.CHAIN
- BambooEntityType.JOB
- BambooEntityType.CHAIN_BRANCH
- BambooEntityType.JOB_BRANCH
Returns null if no OIDs are in use of the specified type with the given server key.getMaxPlanOid in interface PlanDaoCopyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.