Package com.atlassian.bamboo.variable
Class VariableDefinitionHibernateDao
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.orm.hibernate5.support.HibernateDaoSupport
-
- com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
-
- com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<T>
-
- com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao<VariableDefinition,Plan>
-
- com.atlassian.bamboo.variable.VariableDefinitionHibernateDao
-
- All Implemented Interfaces:
BambooObjectDao<VariableDefinition>,VariableDefinitionDao,org.springframework.beans.factory.InitializingBean
public class VariableDefinitionHibernateDao extends BambooHibernateVersionAwareObjectDao<VariableDefinition,Plan> implements VariableDefinitionDao
-
-
Constructor Summary
Constructors Constructor Description VariableDefinitionHibernateDao(TransactionAndHibernateTemplate transactionTemplate, BambooClusterSettings bambooClusterSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcountAll()@NotNull LongcountAllProjectVariables()Count all project variables.intcountVariablesByEnvironmentId(long environmentId)Count variables associated with deployment environmentintdeleteByDeploymentVersion(@NotNull DeletionSQLAdapter deletionAdapter)Delete VariableDefinitions related to DeploymentVersions.intdeleteByEnvironment(@NotNull DeletionSQLAdapter deletionAdapter)Delete VariableDefinitions related to Environments.intdeleteByPlan(long planId)Delete VariableDefinitions related to a plan.intdeleteByProjectId(long projectId)Delete VariableDefinitions related to a project.@NotNull Collection<? extends VariableDefinition>findAll()Find all variable definitions@NotNull List<Long>findAllProjectIdsUsingProjectVariables()VariableDefinitionfindById(long id)Find variable definition of specified idVariableDefinitionfindGlobalVariableByKey(@NotNull String key)Find global variable by its key@NotNull List<VariableDefinition>findGlobalVariables()Find global variable definitions.VariableDefinitionfindPlanVariableByKey(@NotNull PlanIdentifier plan, @NotNull String key)Find plan variable by its key@NotNull Iterable<VariableDefinition>findVariablesByEnvironmentId(long environmentId)Find variables associated with deployment environment@NotNull List<VariableDefinition>findVariablesByPlan(@org.jetbrains.annotations.NotNull long planId)@NotNull List<VariableDefinition>findVariablesByPlan(@NotNull PlanIdentifier plan)Find plan variable definitions for a given plan@NotNull List<VariableDefinition>findVariablesByProjectId(long projectId)Find variables associated with a project@NotNull Iterable<VariableDefinition>findVariablesByVersionId(long deploymentVersionId)Find variables associated with deployment versionprotected @NotNull Optional<VersioningSupplement<Plan>>getRootVersioningSupplement()voidsave(@NotNull VariableDefinition variableDefinition)Saves the given entity.-
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao
delete, deleteAll, getMainVersioningSupplement, incrementMainVersion, incrementMainVersion, incrementRootVersion, incrementRootVersion, saveAll
-
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, executeCountQuery, findAll, findById, merge
-
Methods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
-
Methods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactory
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
countAll, countWithRestriction, delete, deleteAll, findAll, findById, merge, saveAll
-
-
-
-
Constructor Detail
-
VariableDefinitionHibernateDao
public VariableDefinitionHibernateDao(TransactionAndHibernateTemplate transactionTemplate, BambooClusterSettings bambooClusterSettings)
-
-
Method Detail
-
getRootVersioningSupplement
@NotNull protected @NotNull Optional<VersioningSupplement<Plan>> getRootVersioningSupplement()
- Overrides:
getRootVersioningSupplementin classBambooHibernateVersionAwareObjectDao<VariableDefinition,Plan>
-
findById
public VariableDefinition findById(long id)
Description copied from interface:VariableDefinitionDaoFind variable definition of specified id- Specified by:
findByIdin interfaceVariableDefinitionDao- Parameters:
id- id of variable definition- Returns:
- variable definition of specified id or null if not found
-
findGlobalVariables
@NotNull public @NotNull List<VariableDefinition> findGlobalVariables()
Description copied from interface:VariableDefinitionDaoFind global variable definitions.- Specified by:
findGlobalVariablesin interfaceVariableDefinitionDao- Returns:
- global variable definition collection
-
findAllProjectIdsUsingProjectVariables
@NotNull public @NotNull List<Long> findAllProjectIdsUsingProjectVariables()
- Specified by:
findAllProjectIdsUsingProjectVariablesin interfaceVariableDefinitionDao- Returns:
- all project variables definitions collection
-
countAllProjectVariables
@NotNull public @NotNull Long countAllProjectVariables()
Description copied from interface:VariableDefinitionDaoCount all project variables.- Specified by:
countAllProjectVariablesin interfaceVariableDefinitionDao- Returns:
- Long count of project variables.
-
save
public void save(@NotNull @NotNull VariableDefinition variableDefinition)Description copied from interface:BambooObjectDaoSaves the given entity. If the entity implementation is an instance ofEntityObjectthis method will: - updateEntityObject.getLastModificationDate()- setEntityObject.getCreationDate()if the object has not been saved- Specified by:
savein interfaceBambooObjectDao<VariableDefinition>- Overrides:
savein classBambooHibernateVersionAwareObjectDao<VariableDefinition,Plan>- Parameters:
variableDefinition- entity to be saved
-
findVariablesByPlan
@NotNull public @NotNull List<VariableDefinition> findVariablesByPlan(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:VariableDefinitionDaoFind plan variable definitions for a given plan- Specified by:
findVariablesByPlanin interfaceVariableDefinitionDao- Parameters:
plan- plan which associated variable definition should be retrieved- Returns:
- variable definition matching plan or empty collection if not found
-
findVariablesByPlan
@NotNull public @NotNull List<VariableDefinition> findVariablesByPlan(@NotNull @org.jetbrains.annotations.NotNull long planId)
- Specified by:
findVariablesByPlanin interfaceVariableDefinitionDao
-
countVariablesByEnvironmentId
public int countVariablesByEnvironmentId(long environmentId)
Description copied from interface:VariableDefinitionDaoCount variables associated with deployment environment- Specified by:
countVariablesByEnvironmentIdin interfaceVariableDefinitionDao- Parameters:
environmentId- id of a deployment environment- Returns:
- number of variables found
-
findVariablesByEnvironmentId
@NotNull public @NotNull Iterable<VariableDefinition> findVariablesByEnvironmentId(long environmentId)
Description copied from interface:VariableDefinitionDaoFind variables associated with deployment environment- Specified by:
findVariablesByEnvironmentIdin interfaceVariableDefinitionDao- Parameters:
environmentId- id of a deployment environment- Returns:
- list of variables found
-
findVariablesByVersionId
@NotNull public @NotNull Iterable<VariableDefinition> findVariablesByVersionId(long deploymentVersionId)
Description copied from interface:VariableDefinitionDaoFind variables associated with deployment version- Specified by:
findVariablesByVersionIdin interfaceVariableDefinitionDao- Parameters:
deploymentVersionId- id of a deployment version- Returns:
- list of variables found
-
findVariablesByProjectId
@NotNull public @NotNull List<VariableDefinition> findVariablesByProjectId(long projectId)
Description copied from interface:VariableDefinitionDaoFind variables associated with a project- Specified by:
findVariablesByProjectIdin interfaceVariableDefinitionDao- Parameters:
projectId- id of a project- Returns:
- list of variables found
-
deleteByEnvironment
public int deleteByEnvironment(@NotNull @NotNull DeletionSQLAdapter deletionAdapter)Description copied from interface:VariableDefinitionDaoDelete VariableDefinitions related to Environments.- Specified by:
deleteByEnvironmentin interfaceVariableDefinitionDao- Parameters:
deletionAdapter-DeletionSQLAdapter.getInClause()- Returns:
-
deleteByDeploymentVersion
public int deleteByDeploymentVersion(@NotNull @NotNull DeletionSQLAdapter deletionAdapter)Description copied from interface:VariableDefinitionDaoDelete VariableDefinitions related to DeploymentVersions.- Specified by:
deleteByDeploymentVersionin interfaceVariableDefinitionDao
-
deleteByPlan
public int deleteByPlan(long planId)
Description copied from interface:VariableDefinitionDaoDelete VariableDefinitions related to a plan.- Specified by:
deleteByPlanin interfaceVariableDefinitionDao- Returns:
- deleted rows count
-
deleteByProjectId
public int deleteByProjectId(long projectId)
Description copied from interface:VariableDefinitionDaoDelete VariableDefinitions related to a project.- Specified by:
deleteByProjectIdin interfaceVariableDefinitionDao- Returns:
- deleted rows count
-
findPlanVariableByKey
public VariableDefinition findPlanVariableByKey(@NotNull @NotNull PlanIdentifier plan, @NotNull @NotNull String key)
Description copied from interface:VariableDefinitionDaoFind plan variable by its key- Specified by:
findPlanVariableByKeyin interfaceVariableDefinitionDao- Parameters:
plan- plan used to filter variableskey- key which identifies plan variable definition- Returns:
- variable definition or null if not found
-
findGlobalVariableByKey
public VariableDefinition findGlobalVariableByKey(@NotNull @NotNull String key)
Description copied from interface:VariableDefinitionDaoFind global variable by its key- Specified by:
findGlobalVariableByKeyin interfaceVariableDefinitionDao- Parameters:
key- key which identifies global variable definition- Returns:
- variable definition or null if not found
-
findAll
@NotNull public @NotNull Collection<? extends VariableDefinition> findAll()
Description copied from interface:VariableDefinitionDaoFind all variable definitions- Specified by:
findAllin interfaceVariableDefinitionDao- Returns:
- Collection of all variable definitions
-
countAll
public long countAll()
- Specified by:
countAllin interfaceVariableDefinitionDao
-
-