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
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
ConstructorDescriptionVariableDefinitionHibernateDao
(TransactionAndHibernateTemplate transactionTemplate, BambooClusterSettings bambooClusterSettings) -
Method Summary
Modifier and TypeMethodDescriptionlong
countAll()
@NotNull Long
Count all project variables.int
countVariablesByEnvironmentId
(long environmentId) Count variables associated with deployment environmentint
deleteByDeploymentVersion
(@NotNull DeletionSQLAdapter deletionAdapter) Delete VariableDefinitions related to DeploymentVersions.int
deleteByEnvironment
(@NotNull DeletionSQLAdapter deletionAdapter) Delete VariableDefinitions related to Environments.int
deleteByPlan
(long planId) Delete VariableDefinitions related to a plan.int
deleteByProjectId
(long projectId) Delete VariableDefinitions related to a project.@NotNull Collection<? extends VariableDefinition>
findAll()
Find all variable definitionsfindById
(long id) Find variable definition of specified idfindGlobalVariableByKey
(@NotNull String key) Find global variable by its key@NotNull List<VariableDefinition>
Find global variable definitions.findPlanVariableByKey
(@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>>
void
save
(@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 org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
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 Details
-
VariableDefinitionHibernateDao
public VariableDefinitionHibernateDao(TransactionAndHibernateTemplate transactionTemplate, BambooClusterSettings bambooClusterSettings)
-
-
Method Details
-
getRootVersioningSupplement
- Overrides:
getRootVersioningSupplement
in classBambooHibernateVersionAwareObjectDao<VariableDefinition,
Plan>
-
findById
Description copied from interface:VariableDefinitionDao
Find variable definition of specified id- Specified by:
findById
in interfaceVariableDefinitionDao
- Parameters:
id
- id of variable definition- Returns:
- variable definition of specified id or null if not found
-
findGlobalVariables
Description copied from interface:VariableDefinitionDao
Find global variable definitions.- Specified by:
findGlobalVariables
in interfaceVariableDefinitionDao
- Returns:
- global variable definition collection
-
findAllProjectIdsUsingProjectVariables
- Specified by:
findAllProjectIdsUsingProjectVariables
in interfaceVariableDefinitionDao
- Returns:
- all project variables definitions collection
-
countAllProjectVariables
Description copied from interface:VariableDefinitionDao
Count all project variables.- Specified by:
countAllProjectVariables
in interfaceVariableDefinitionDao
- Returns:
- Long count of project variables.
-
save
Description copied from interface:BambooObjectDao
Saves the given entity. If the entity implementation is an instance ofEntityObject
this method will: - updateEntityObject.getLastModificationDate()
- setEntityObject.getCreationDate()
if the object has not been saved- Specified by:
save
in interfaceBambooObjectDao<VariableDefinition>
- Overrides:
save
in classBambooHibernateVersionAwareObjectDao<VariableDefinition,
Plan> - Parameters:
variableDefinition
- entity to be saved
-
findVariablesByPlan
@NotNull public @NotNull List<VariableDefinition> findVariablesByPlan(@NotNull @NotNull PlanIdentifier plan) Description copied from interface:VariableDefinitionDao
Find plan variable definitions for a given plan- Specified by:
findVariablesByPlan
in 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:
findVariablesByPlan
in interfaceVariableDefinitionDao
-
countVariablesByEnvironmentId
public int countVariablesByEnvironmentId(long environmentId) Description copied from interface:VariableDefinitionDao
Count variables associated with deployment environment- Specified by:
countVariablesByEnvironmentId
in 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:VariableDefinitionDao
Find variables associated with deployment environment- Specified by:
findVariablesByEnvironmentId
in 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:VariableDefinitionDao
Find variables associated with deployment version- Specified by:
findVariablesByVersionId
in interfaceVariableDefinitionDao
- Parameters:
deploymentVersionId
- id of a deployment version- Returns:
- list of variables found
-
findVariablesByProjectId
Description copied from interface:VariableDefinitionDao
Find variables associated with a project- Specified by:
findVariablesByProjectId
in interfaceVariableDefinitionDao
- Parameters:
projectId
- id of a project- Returns:
- list of variables found
-
deleteByEnvironment
Description copied from interface:VariableDefinitionDao
Delete VariableDefinitions related to Environments.- Specified by:
deleteByEnvironment
in interfaceVariableDefinitionDao
- Parameters:
deletionAdapter
-DeletionSQLAdapter.getInClause()
- Returns:
-
deleteByDeploymentVersion
Description copied from interface:VariableDefinitionDao
Delete VariableDefinitions related to DeploymentVersions.- Specified by:
deleteByDeploymentVersion
in interfaceVariableDefinitionDao
-
deleteByPlan
public int deleteByPlan(long planId) Description copied from interface:VariableDefinitionDao
Delete VariableDefinitions related to a plan.- Specified by:
deleteByPlan
in interfaceVariableDefinitionDao
- Returns:
- deleted rows count
-
deleteByProjectId
public int deleteByProjectId(long projectId) Description copied from interface:VariableDefinitionDao
Delete VariableDefinitions related to a project.- Specified by:
deleteByProjectId
in interfaceVariableDefinitionDao
- Returns:
- deleted rows count
-
findPlanVariableByKey
public VariableDefinition findPlanVariableByKey(@NotNull @NotNull PlanIdentifier plan, @NotNull @NotNull String key) Description copied from interface:VariableDefinitionDao
Find plan variable by its key- Specified by:
findPlanVariableByKey
in interfaceVariableDefinitionDao
- Parameters:
plan
- plan used to filter variableskey
- key which identifies plan variable definition- Returns:
- variable definition or null if not found
-
findGlobalVariableByKey
Description copied from interface:VariableDefinitionDao
Find global variable by its key- Specified by:
findGlobalVariableByKey
in interfaceVariableDefinitionDao
- Parameters:
key
- key which identifies global variable definition- Returns:
- variable definition or null if not found
-
findAll
Description copied from interface:VariableDefinitionDao
Find all variable definitions- Specified by:
findAll
in interfaceVariableDefinitionDao
- Returns:
- Collection of all variable definitions
-
countAll
public long countAll()- Specified by:
countAll
in interfaceVariableDefinitionDao
-