Class EnvironmentDaoImpl
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<T>
com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao<MutableEnvironment,Object>
com.atlassian.bamboo.deployments.environments.persistence.EnvironmentDaoImpl
- All Implemented Interfaces:
EnvironmentDao,BambooObjectDao<MutableEnvironment>,org.springframework.beans.factory.InitializingBean
public class EnvironmentDaoImpl
extends BambooHibernateVersionAwareObjectDao<MutableEnvironment,Object>
implements EnvironmentDao
-
Field Summary
FieldsFields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcountAll()@NotNull MutableEnvironmentvoiddelete(@NotNull MutableEnvironment environment) Removes the given entity from the databasefindAll()List<? extends MutableEnvironment>findAll(int firstResult, int maxResults) findAllByIds(Collection<Long> ids) Returns a list of Environments which id values are in the ids collectionfindAllInternalEnvironments(int firstResult, int maxResults) @NotNull List<EnvironmentStub>findAllStubs(int firstResult, int maxResults) @Nullable MutableEnvironmentfindEnvironmentByName(long deploymentProjectId, String name) Find environment with specified name in a deployment project@NotNull List<Pair<Requirement,Long>> findEnvironmentIdsByRequirementKey(@NotNull String requirementKey) Get requirements to environment id mapping by requirement key.@NotNull List<Pair<Requirement,MutableEnvironment>> findEnvironmentsByRequirementKey(@NotNull String requirementKey) Get requirements to environment mapping by requirement key.@Nullable InternalEnvironmentfindInternalEnvironmentByName(long deploymentProjectId, @NotNull String name) findInternalEnvironmentsByIds(@NotNull List<Long> ids) Returns a list ofInternalEnvironmentwhich id values are in the ids collection@Nullable MutableEnvironmentgetEnvironment(long environmentId) Gets specific Environment by ID@Nullable MutableEnvironmentgetEnvironment(@NotNull DeploymentKey environmentKey) Gets specific Environment by keyintintgetEnvironmentCountForProject(long deploymentProjectId) getEnvironmentIdsForDeploymentProject(long deploymentProjectId) Retrieve a list of environment IDs for a specific deployment project.@NotNull List<MutableEnvironment>getEnvironmentsForDeploymentProject(long deploymentProjectId) Retrieve all environments for a Deployment Project@NotNull List<EnvironmentStub>getEnvironmentStubsForDeploymentProject(long deploymentProjectId) Retrieve all environment stubs for a Deployment Project.intgetFirstEnvironmentPosition(long deploymentProjectId) @NotNull List<InternalEnvironment>getInternalEnvironmentsForDeploymentProject(long deploymentProjectId) intgetLastEnvironmentPosition(long deploymentProjectId) protected @NotNull Optional<VersioningSupplement<MutableEnvironment>>getNextEnvironment(long deploymentProjectId, int position) getPaginatedDeploymentsWithEnvironmentsOnlyIdsAndRequirementSets(int start, int limit, String filter) Retrieve paginated pairs of deployment project and environment ids together with the environment requirements, sorted by project ids and environment positions, matching the filter string anywhere within the name of the project or environment@NotNull List<MutableEnvironment>getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, String filter) Retrieve part of environments for a Deployment Project ordered by positiongetPreviousEnvironment(long deploymentProjectId, int position) booleanisEnvironmentNameConflicting(@NotNull MutableDeploymentProject deploymentProject, @NotNull String name) Check if there is currently an environment with the given name in the given deployment Project.voidsave(@NotNull MutableEnvironment environment) Saves the given entity.voidsetBambooClusterSettings(BambooClusterSettings bambooClusterSettings) voidshiftDownEnvPosition(int fromPosition, int toPosition, long deploymentProjectId) Decrement by one all environments positions for given deployment project for environments which have position greater than fromPosition and lower than toPosition.voidshiftUpEnvPosition(int fromPosition, int toPosition, long deploymentProjectId) Increment by one all environments positions for given deployment project for environments which have position greater than fromPosition and lower than toPosition.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao
deleteAll, getRootVersioningSupplement, incrementMainVersion, incrementMainVersion, incrementRootVersion, incrementRootVersion, saveAllMethods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, executeCountQuery, findAll, findById, mergeMethods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDaoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.bamboo.deployments.environments.persistence.EnvironmentDao
saveAll
-
Field Details
-
DEPLOYMENT_PROJECT
- See Also:
-
-
Constructor Details
-
EnvironmentDaoImpl
public EnvironmentDaoImpl()
-
-
Method Details
-
getMainVersioningSupplement
@NotNull protected @NotNull Optional<VersioningSupplement<MutableEnvironment>> getMainVersioningSupplement()- Overrides:
getMainVersioningSupplementin classBambooHibernateVersionAwareObjectDao<MutableEnvironment,Object>
-
getEnvironment
Description copied from interface:EnvironmentDaoGets specific Environment by ID- Specified by:
getEnvironmentin interfaceEnvironmentDao- Parameters:
environmentId- ID of the environment your looking for.- Returns:
- environment with given id or null if one with that ID could not be found.
-
save
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<MutableEnvironment>- Specified by:
savein interfaceEnvironmentDao- Overrides:
savein classBambooHibernateVersionAwareObjectDao<MutableEnvironment,Object> - Parameters:
environment- entity to be saved
-
delete
Description copied from interface:BambooObjectDaoRemoves the given entity from the database- Specified by:
deletein interfaceBambooObjectDao<MutableEnvironment>- Specified by:
deletein interfaceEnvironmentDao- Overrides:
deletein classBambooHibernateVersionAwareObjectDao<MutableEnvironment,Object> - Parameters:
environment- entity to be removed
-
getEnvironment
@Nullable public @Nullable MutableEnvironment getEnvironment(@NotNull @NotNull DeploymentKey environmentKey) Description copied from interface:EnvironmentDaoGets specific Environment by key- Specified by:
getEnvironmentin interfaceEnvironmentDao- Parameters:
environmentKey- ket of the environment to find- Returns:
- Deployment Environment with given key or null if one with that key could not be found
-
getEnvironmentsForDeploymentProject
@NotNull public @NotNull List<MutableEnvironment> getEnvironmentsForDeploymentProject(long deploymentProjectId) Description copied from interface:EnvironmentDaoRetrieve all environments for a Deployment Project- Specified by:
getEnvironmentsForDeploymentProjectin interfaceEnvironmentDao- Parameters:
deploymentProjectId- of the Deployment Project- Returns:
- List of all environments in a Deployment Project
-
getEnvironmentStubsForDeploymentProject
@NotNull public @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId) Description copied from interface:EnvironmentDaoRetrieve all environment stubs for a Deployment Project. Environment stubs contain only the data that is required for the UI.- Specified by:
getEnvironmentStubsForDeploymentProjectin interfaceEnvironmentDao- Parameters:
deploymentProjectId- of the Deployment Project- Returns:
- List of all environments in a Deployment Project
-
getEnvironmentIdsForDeploymentProject
Description copied from interface:EnvironmentDaoRetrieve a list of environment IDs for a specific deployment project.- Specified by:
getEnvironmentIdsForDeploymentProjectin interfaceEnvironmentDao- Parameters:
deploymentProjectId- the ID of the deployment project- Returns:
- a list of environment IDs associated with the specified deployment project
-
isEnvironmentNameConflicting
public boolean isEnvironmentNameConflicting(@NotNull @NotNull MutableDeploymentProject deploymentProject, @NotNull @NotNull String name) Description copied from interface:EnvironmentDaoCheck if there is currently an environment with the given name in the given deployment Project.- Specified by:
isEnvironmentNameConflictingin interfaceEnvironmentDao- Parameters:
deploymentProject- the project to check environments ofname- to check for conflict- Returns:
- true if the name is already being used by an environment in the project, false if not.
-
findEnvironmentByName
@Nullable public @Nullable MutableEnvironment findEnvironmentByName(long deploymentProjectId, String name) Description copied from interface:EnvironmentDaoFind environment with specified name in a deployment project- Specified by:
findEnvironmentByNamein interfaceEnvironmentDao
-
findAll
- Specified by:
findAllin interfaceEnvironmentDao
-
getLastEnvironmentPosition
public int getLastEnvironmentPosition(long deploymentProjectId) - Specified by:
getLastEnvironmentPositionin interfaceEnvironmentDao- Returns:
- position of the last environment associated with a deployment project or -1 if none.
-
getFirstEnvironmentPosition
public int getFirstEnvironmentPosition(long deploymentProjectId) - Specified by:
getFirstEnvironmentPositionin interfaceEnvironmentDao- Returns:
- position of the first environment associated with a deployment project or -1 if none.
-
getEnvironmentCount
public int getEnvironmentCount()- Specified by:
getEnvironmentCountin interfaceEnvironmentDao- Returns:
- number of all
Environments
-
getEnvironmentCountForProject
public int getEnvironmentCountForProject(long deploymentProjectId) - Specified by:
getEnvironmentCountForProjectin interfaceEnvironmentDao- Returns:
- number of
Environmentdefined for the project
-
countAll
public long countAll()- Specified by:
countAllin interfaceEnvironmentDao
-
findAll
- Specified by:
findAllin interfaceEnvironmentDao
-
findAllInternalEnvironments
- Specified by:
findAllInternalEnvironmentsin interfaceEnvironmentDao
-
getInternalEnvironmentsForDeploymentProject
@NotNull public @NotNull List<InternalEnvironment> getInternalEnvironmentsForDeploymentProject(long deploymentProjectId) - Specified by:
getInternalEnvironmentsForDeploymentProjectin interfaceEnvironmentDao
-
findInternalEnvironmentByName
@Nullable public @Nullable InternalEnvironment findInternalEnvironmentByName(long deploymentProjectId, @NotNull @NotNull String name) - Specified by:
findInternalEnvironmentByNamein interfaceEnvironmentDao
-
findAllStubs
- Specified by:
findAllStubsin interfaceEnvironmentDao
-
findEnvironmentsByRequirementKey
@NotNull public @NotNull List<Pair<Requirement,MutableEnvironment>> findEnvironmentsByRequirementKey(@NotNull @NotNull String requirementKey) Description copied from interface:EnvironmentDaoGet requirements to environment mapping by requirement key.- Specified by:
findEnvironmentsByRequirementKeyin interfaceEnvironmentDao- Parameters:
requirementKey- on which environments rely- Returns:
- pairs of environments or empty list
-
findEnvironmentIdsByRequirementKey
@NotNull public @NotNull List<Pair<Requirement,Long>> findEnvironmentIdsByRequirementKey(@NotNull @NotNull String requirementKey) Description copied from interface:EnvironmentDaoGet requirements to environment id mapping by requirement key.- Specified by:
findEnvironmentIdsByRequirementKeyin interfaceEnvironmentDao- Parameters:
requirementKey- on which environments rely- Returns:
- pairs of environments or empty list
-
createNewEnvironmentInstance
- Specified by:
createNewEnvironmentInstancein interfaceEnvironmentDao
-
getPaginatedEnvironmentsForDeploymentProject
@NotNull public @NotNull List<MutableEnvironment> getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, String filter) Description copied from interface:EnvironmentDaoRetrieve part of environments for a Deployment Project ordered by position- Specified by:
getPaginatedEnvironmentsForDeploymentProjectin interfaceEnvironmentDao- Parameters:
deploymentProjectId- of the Deployment Projectstart- startlimit- max size of result- Returns:
- List of environments in a Deployment Project no more than limit
-
getPaginatedDeploymentsWithEnvironmentsOnlyIdsAndRequirementSets
public List<EnvironmentWithProjectAndRequirementsDto> getPaginatedDeploymentsWithEnvironmentsOnlyIdsAndRequirementSets(int start, int limit, String filter) Description copied from interface:EnvironmentDaoRetrieve paginated pairs of deployment project and environment ids together with the environment requirements, sorted by project ids and environment positions, matching the filter string anywhere within the name of the project or environment- Specified by:
getPaginatedDeploymentsWithEnvironmentsOnlyIdsAndRequirementSetsin interfaceEnvironmentDao- Parameters:
start- startlimit- max size of resultfilter- string by which the names of project and environments will be filtered- Returns:
- List of id pairs and requirement sets
-
shiftUpEnvPosition
public void shiftUpEnvPosition(int fromPosition, int toPosition, long deploymentProjectId) Description copied from interface:EnvironmentDaoIncrement by one all environments positions for given deployment project for environments which have position greater than fromPosition and lower than toPosition. Position for environments which position is equal to fromPosition or toPosition won't be change.- Specified by:
shiftUpEnvPositionin interfaceEnvironmentDao
-
shiftDownEnvPosition
public void shiftDownEnvPosition(int fromPosition, int toPosition, long deploymentProjectId) Description copied from interface:EnvironmentDaoDecrement by one all environments positions for given deployment project for environments which have position greater than fromPosition and lower than toPosition. Position for environments which position is equal to fromPosition or toPosition won't be change.- Specified by:
shiftDownEnvPositionin interfaceEnvironmentDao
-
getNextEnvironment
- Specified by:
getNextEnvironmentin interfaceEnvironmentDao- Returns:
- sorted first
MutableEnvironmentin deploymentProject which has greater position than position
-
getPreviousEnvironment
- Specified by:
getPreviousEnvironmentin interfaceEnvironmentDao- Returns:
- sorted first
MutableEnvironmentin deploymentProject which has lower position than position
-
findAllByIds
Description copied from interface:EnvironmentDaoReturns a list of Environments which id values are in the ids collection- Specified by:
findAllByIdsin interfaceEnvironmentDao- Parameters:
ids- list of id values- Returns:
- list of Environments
-
findInternalEnvironmentsByIds
Description copied from interface:EnvironmentDaoReturns a list ofInternalEnvironmentwhich id values are in the ids collection- Specified by:
findInternalEnvironmentsByIdsin interfaceEnvironmentDao
-
setBambooClusterSettings
-