Package com.atlassian.bamboo.oid
Class IdGeneratorDaoImpl
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.oid.IdGeneratorDaoImpl
- All Implemented Interfaces:
IdGeneratorDao
,org.springframework.beans.factory.InitializingBean
public class IdGeneratorDaoImpl
extends org.springframework.orm.hibernate5.support.HibernateDaoSupport
implements IdGeneratorDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull List<IdGenerator>
findAll()
Get all generators id.@NotNull com.google.common.collect.Range<Long>
nextIdRange
(@NotNull BambooEntityType entityType) Reserve new range of ids for given entityvoid
resetId
(@NotNull BambooEntityOid lastOid) Reset forward next id value in generator for given entity.void
saveNextId
(String name, long nextId) Saves next id value for given name.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
-
Constructor Details
-
IdGeneratorDaoImpl
public IdGeneratorDaoImpl()
-
-
Method Details
-
nextIdRange
@NotNull public @NotNull com.google.common.collect.Range<Long> nextIdRange(@NotNull @NotNull BambooEntityType entityType) Description copied from interface:IdGeneratorDao
Reserve new range of ids for given entity- Specified by:
nextIdRange
in interfaceIdGeneratorDao
- Parameters:
entityType
- entity type- Returns:
- id range
-
resetId
Description copied from interface:IdGeneratorDao
Reset forward next id value in generator for given entity. Should be called after some external changes that would generate entities without using generator. New value will be set only if it's bigger than old one.- Specified by:
resetId
in interfaceIdGeneratorDao
- Parameters:
lastOid
- current biggest oid; next id generator for it's type will be updated
-
findAll
Description copied from interface:IdGeneratorDao
Get all generators id. Used for data export. Avoid using for other reasons.- Specified by:
findAll
in interfaceIdGeneratorDao
-
saveNextId
Description copied from interface:IdGeneratorDao
Saves next id value for given name. Used during data import. Avoid using for other reasons.- Specified by:
saveNextId
in interfaceIdGeneratorDao
-