com.atlassian.bamboo.deployments.environments.persistence
Class EnvironmentDaoImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
              extended by com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<MutableEnvironment>
                  extended by com.atlassian.bamboo.deployments.environments.persistence.EnvironmentDaoImpl
All Implemented Interfaces:
EnvironmentDao, BambooObjectDao<MutableEnvironment>, org.springframework.beans.factory.InitializingBean

public class EnvironmentDaoImpl
extends BambooHibernateObjectDao<MutableEnvironment>
implements EnvironmentDao


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
EnvironmentDaoImpl()
           
 
Method Summary
 void delete(MutableEnvironment environment)
          Removes the given entity from the database
 java.util.List<MutableEnvironment> findAll()
           
 MutableEnvironment getEnvironment(DeploymentKey environmentKey)
          Gets specific Environment by key
 MutableEnvironment getEnvironment(long environmentId)
          Gets specific Environment by ID
 java.util.List<MutableEnvironment> getEnvironmentsForDeploymentProject(long deploymentProjectId)
          Retrieve all environments for a Deployment Project
 int getLastEnvironmentPosition(long deploymentProjectId)
           
 boolean isEnvironmentNameConflicting(MutableDeploymentProject deploymentProject, java.lang.String name)
          Check if there is currently an environment with the given name in the given deployment Project.
 void save(MutableEnvironment environment)
          Saves the given entity.
 
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
deleteAll, execute, executeCountQuery, executeFind, executeReturnLong, findAll, findById, saveAll
 
Methods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, 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.deployments.environments.persistence.EnvironmentDao
saveAll
 

Constructor Detail

EnvironmentDaoImpl

public EnvironmentDaoImpl()
Method Detail

getEnvironment

@Nullable
public MutableEnvironment getEnvironment(long environmentId)
Description copied from interface: EnvironmentDao
Gets specific Environment by ID

Specified by:
getEnvironment in interface EnvironmentDao
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

public void save(@NotNull
                 MutableEnvironment environment)
Description copied from interface: BambooObjectDao
Saves the given entity. If the entity implementation is an instance of BambooEntityObject this method will: - update EntityObject.getLastModificationDate() - set EntityObject.getCreationDate() if the object has not been saved

Specified by:
save in interface EnvironmentDao
Specified by:
save in interface BambooObjectDao<MutableEnvironment>
Overrides:
save in class BambooHibernateObjectDao<MutableEnvironment>
Parameters:
environment - entity to be saved

delete

public void delete(@NotNull
                   MutableEnvironment environment)
Description copied from interface: BambooObjectDao
Removes the given entity from the database

Specified by:
delete in interface EnvironmentDao
Specified by:
delete in interface BambooObjectDao<MutableEnvironment>
Overrides:
delete in class BambooHibernateObjectDao<MutableEnvironment>
Parameters:
environment - entity to be removed

getEnvironment

@Nullable
public MutableEnvironment getEnvironment(@NotNull
                                                  DeploymentKey environmentKey)
Description copied from interface: EnvironmentDao
Gets specific Environment by key

Specified by:
getEnvironment in interface EnvironmentDao
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 java.util.List<MutableEnvironment> getEnvironmentsForDeploymentProject(long deploymentProjectId)
Description copied from interface: EnvironmentDao
Retrieve all environments for a Deployment Project

Specified by:
getEnvironmentsForDeploymentProject in interface EnvironmentDao
Parameters:
deploymentProjectId - of the Deployment Project
Returns:
List of all environments in a Deployment Project

isEnvironmentNameConflicting

public boolean isEnvironmentNameConflicting(@NotNull
                                            MutableDeploymentProject deploymentProject,
                                            @NotNull
                                            java.lang.String name)
Description copied from interface: EnvironmentDao
Check if there is currently an environment with the given name in the given deployment Project.

Specified by:
isEnvironmentNameConflicting in interface EnvironmentDao
Parameters:
deploymentProject - the project to check environments of
name - to check for conflict
Returns:
true if the name is already being used by an environment in the project, false if not.

findAll

public java.util.List<MutableEnvironment> findAll()
Specified by:
findAll in interface EnvironmentDao

getLastEnvironmentPosition

public int getLastEnvironmentPosition(long deploymentProjectId)
Specified by:
getLastEnvironmentPosition in interface EnvironmentDao
Returns:
position of the last environment associated with a deployment project or -1 if none.


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.