Package com.atlassian.bamboo.repository
Class RepositoryDefinitionHibernateDao
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<E,R>
com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectWithOidDao<RepositoryDataEntity,Object>
com.atlassian.bamboo.repository.RepositoryDefinitionHibernateDao
- All Implemented Interfaces:
BambooObjectDao<RepositoryDataEntity>
,BambooObjectWithOidDao<RepositoryDataEntity>
,RepositoryDefinitionDao
,org.springframework.beans.factory.InitializingBean
public class RepositoryDefinitionHibernateDao
extends BambooHibernateVersionAwareObjectWithOidDao<RepositoryDataEntity,Object>
implements RepositoryDefinitionDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
ConstructorDescriptionRepositoryDefinitionHibernateDao
(@NotNull TransactionAndHibernateTemplate bambooTransactionHibernateTemplate, @NotNull BambooClusterSettings bambooClusterSettings) -
Method Summary
Modifier and TypeMethodDescriptionlong
countAll()
long
countAllByParent
(@Nullable Long parentId) @NotNull Long
Count project, non-deleted repositories.long
countRepositoriesByPluginKey
(@NotNull String pluginKey) long
Count global, non-deleted repositories without any parent repository.void
delete
(@NotNull RepositoryDataEntity repositoryDataEntity) Removes the given entity from the database@NotNull Collection<? extends RepositoryDataEntity>
findAll()
@NotNull List<RepositoryDataEntity>
findAll
(boolean includeMarkedForDeletion) @NotNull Collection<? extends RepositoryDataEntity>
findAll
(int firstResult, int maxResults) @NotNull Collection<? extends RepositoryDataEntity>
findAllByParent
(@Nullable Long parentId, int firstResult, int maxResults) Get IDs of all projects which are using project repositories.findAllRepositoryIds
(boolean includeMarkedForDeletion) Get ids of all repositories that doesn't have parent repository (are either linked or are created on plan level)@Nullable RepositoryDataEntityImpl
findById
(long id) @Nullable RepositoryDataEntity
findLinkedRepositoryByName
(@NotNull String name) Find a linked repository by name;@Nullable RepositoryDataEntity
findProjectRepositoryByName
(@NotNull String name, @NotNull Long projectId) Find a project repository by name in project associated with given projectId.@NotNull List<RepositoryDataEntity>
findRepositoriesByPluginKey
(@NotNull String pluginKey) @NotNull List<RepositoryDataEntity>
findRepositoriesByPluginKey
(@NotNull String pluginKey, int firstResult, int maxResults) @NotNull List<RepositoryDataEntity>
protected @NotNull Optional<VersioningSupplement<RepositoryDataEntity>>
@Nullable BambooEntityOid
getMaxRepositoryOid
(int serverKey) Returns the maxBambooEntityOid
that's currently in use ofBambooEntityType.REPOSITORY
type, with the given server key.@NotNull Collection<RepositoryDataEntity>
@NotNull List<RepositoryDataEntity>
getProjectRepositoryDefinitions
(Long projectId) Get all project repositories associated with given projectId.@NotNull List<RepositoryDataEntity>
getTopLevelGlobalRepositories
(int firstResult, int maxResults) Return a list of global, non-deleted repositories without any parent repository.void
markForDeletionByParentId
(long parentId) Mark all direct children of repository with given id for deletion.void
markForDeletionByProjectId
(long projectId) Mark all project repositories with given projectId for deletion.void
removeRepositoryIfUnused
(RepositoryDataEntity repositoryDataEntity) void
void
save
(@NotNull RepositoryDataEntity repositoryDataEntity) Saves the given entity.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectWithOidDao
findByOid
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao
deleteAll, getRootVersioningSupplement, 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, deleteAll, findAll, findById, merge, saveAll
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectWithOidDao
findByOid
-
Constructor Details
-
RepositoryDefinitionHibernateDao
public RepositoryDefinitionHibernateDao(@NotNull @NotNull TransactionAndHibernateTemplate bambooTransactionHibernateTemplate, @NotNull @NotNull BambooClusterSettings bambooClusterSettings)
-
-
Method Details
-
getMainVersioningSupplement
@NotNull protected @NotNull Optional<VersioningSupplement<RepositoryDataEntity>> getMainVersioningSupplement()- Overrides:
getMainVersioningSupplement
in classBambooHibernateVersionAwareObjectDao<RepositoryDataEntity,
Object>
-
findById
- Specified by:
findById
in interfaceRepositoryDefinitionDao
-
findAll
- Specified by:
findAll
in interfaceRepositoryDefinitionDao
-
findAll
@NotNull public @NotNull Collection<? extends RepositoryDataEntity> findAll(int firstResult, int maxResults) - Specified by:
findAll
in interfaceRepositoryDefinitionDao
-
findAllByParent
@NotNull public @NotNull Collection<? extends RepositoryDataEntity> findAllByParent(@Nullable @Nullable Long parentId, int firstResult, int maxResults) - Specified by:
findAllByParent
in interfaceRepositoryDefinitionDao
-
countAll
public long countAll()- Specified by:
countAll
in interfaceRepositoryDefinitionDao
-
countAllByParent
- Specified by:
countAllByParent
in interfaceRepositoryDefinitionDao
-
countTopLevelGlobalRepositories
public long countTopLevelGlobalRepositories()Description copied from interface:RepositoryDefinitionDao
Count global, non-deleted repositories without any parent repository.- Specified by:
countTopLevelGlobalRepositories
in interfaceRepositoryDefinitionDao
-
getTopLevelGlobalRepositories
@NotNull public @NotNull List<RepositoryDataEntity> getTopLevelGlobalRepositories(int firstResult, int maxResults) Description copied from interface:RepositoryDefinitionDao
Return a list of global, non-deleted repositories without any parent repository.- Specified by:
getTopLevelGlobalRepositories
in interfaceRepositoryDefinitionDao
-
countRepositoriesByPluginKey
-
findRepositoriesByPluginKey
@NotNull public @NotNull List<RepositoryDataEntity> findRepositoriesByPluginKey(@NotNull @NotNull String pluginKey) - Specified by:
findRepositoriesByPluginKey
in interfaceRepositoryDefinitionDao
-
findRepositoriesByPluginKey
@NotNull public @NotNull List<RepositoryDataEntity> findRepositoriesByPluginKey(@NotNull @NotNull String pluginKey, int firstResult, int maxResults) -
getGlobalRepositoryDefinitions
- Specified by:
getGlobalRepositoryDefinitions
in interfaceRepositoryDefinitionDao
-
getProjectRepositoryDefinitions
Description copied from interface:RepositoryDefinitionDao
Get all project repositories associated with given projectId.- Specified by:
getProjectRepositoryDefinitions
in interfaceRepositoryDefinitionDao
- Returns:
- List of RepositoryDataEntity which are project repositories associated with given projectId
-
countAllProjectsRepositories
Description copied from interface:RepositoryDefinitionDao
Count project, non-deleted repositories.- Specified by:
countAllProjectsRepositories
in interfaceRepositoryDefinitionDao
-
findAllProjectsIdsUsingProjectRepositories
Description copied from interface:RepositoryDefinitionDao
Get IDs of all projects which are using project repositories.- Specified by:
findAllProjectsIdsUsingProjectRepositories
in interfaceRepositoryDefinitionDao
- Returns:
- a list of IDs of all projects which are using project repositories.
-
getPrivateRepositoryDefinitionsByPlan
@NotNull public @NotNull Collection<RepositoryDataEntity> getPrivateRepositoryDefinitionsByPlan(Plan plan) - Specified by:
getPrivateRepositoryDefinitionsByPlan
in interfaceRepositoryDefinitionDao
-
removeRepositoryIfUnused
- Specified by:
removeRepositoryIfUnused
in interfaceRepositoryDefinitionDao
-
delete
Description copied from interface:BambooObjectDao
Removes the given entity from the database- Specified by:
delete
in interfaceBambooObjectDao<RepositoryDataEntity>
- Overrides:
delete
in classBambooHibernateVersionAwareObjectDao<RepositoryDataEntity,
Object> - Parameters:
repositoryDataEntity
- entity to be removed
-
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<RepositoryDataEntity>
- Overrides:
save
in classBambooHibernateVersionAwareObjectDao<RepositoryDataEntity,
Object> - Parameters:
repositoryDataEntity
- entity to be saved
-
removeUnusedRepositories
public void removeUnusedRepositories()- Specified by:
removeUnusedRepositories
in interfaceRepositoryDefinitionDao
-
findAllRepositoryIds
- Specified by:
findAllRepositoryIds
in interfaceRepositoryDefinitionDao
-
findAllRepositoryIds
- Specified by:
findAllRepositoryIds
in interfaceRepositoryDefinitionDao
-
findAll
- Specified by:
findAll
in interfaceRepositoryDefinitionDao
-
findAllTopLevelRepositoriesIds
Description copied from interface:RepositoryDefinitionDao
Get ids of all repositories that doesn't have parent repository (are either linked or are created on plan level)- Specified by:
findAllTopLevelRepositoriesIds
in interfaceRepositoryDefinitionDao
-
getMaxRepositoryOid
Description copied from interface:RepositoryDefinitionDao
Returns the maxBambooEntityOid
that's currently in use ofBambooEntityType.REPOSITORY
type, with the given server key. Returns null if no OIDs are in use of this type with the given server key.- Specified by:
getMaxRepositoryOid
in interfaceRepositoryDefinitionDao
-
findLinkedRepositoryByName
@Nullable public @Nullable RepositoryDataEntity findLinkedRepositoryByName(@NotNull @NotNull String name) Description copied from interface:RepositoryDefinitionDao
Find a linked repository by name;- Specified by:
findLinkedRepositoryByName
in interfaceRepositoryDefinitionDao
- Returns:
-
markForDeletionByParentId
public void markForDeletionByParentId(long parentId) Description copied from interface:RepositoryDefinitionDao
Mark all direct children of repository with given id for deletion.- Specified by:
markForDeletionByParentId
in interfaceRepositoryDefinitionDao
-
markForDeletionByProjectId
public void markForDeletionByProjectId(long projectId) Description copied from interface:RepositoryDefinitionDao
Mark all project repositories with given projectId for deletion.- Specified by:
markForDeletionByProjectId
in interfaceRepositoryDefinitionDao
-
findProjectRepositoryByName
@Nullable public @Nullable RepositoryDataEntity findProjectRepositoryByName(@NotNull @NotNull String name, @NotNull @NotNull Long projectId) Description copied from interface:RepositoryDefinitionDao
Find a project repository by name in project associated with given projectId.- Specified by:
findProjectRepositoryByName
in interfaceRepositoryDefinitionDao
- Returns:
- RepositoryDataEntity if repository exists otherwise null.
-