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
ConstructorsConstructorDescriptionRepositoryDefinitionHibernateDao(@NotNull TransactionAndHibernateTemplate bambooTransactionHibernateTemplate, @NotNull BambooClusterSettings bambooClusterSettings) -
Method Summary
Modifier and TypeMethodDescriptionlongcountAll()longcountAllByParent(@Nullable Long parentId) @NotNull LongCount project, non-deleted repositories.longcountRepositoriesByPluginKey(@NotNull String pluginKey) longCount global, non-deleted repositories without any parent repository.voiddelete(@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 RepositoryDataEntityImplfindById(long id) @Nullable RepositoryDataEntityfindLinkedRepositoryByName(@NotNull String name) Find a linked repository by name;@Nullable RepositoryDataEntityfindProjectRepositoryByName(@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 BambooEntityOidgetMaxRepositoryOid(int serverKey) Returns the maxBambooEntityOidthat's currently in use ofBambooEntityType.REPOSITORYtype, 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.voidmarkForDeletionByParentId(long parentId) Mark all direct children of repository with given id for deletion.voidmarkForDeletionByProjectId(long projectId) Mark all project repositories with given projectId for deletion.voidremoveRepositoryIfUnused(RepositoryDataEntity repositoryDataEntity) voidvoidsave(@NotNull RepositoryDataEntity repositoryDataEntity) Saves the given entity.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectWithOidDao
findByOidMethods 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 com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplateMethods 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.persistence3.BambooObjectDao
countAll, countWithRestriction, deleteAll, findAll, findById, merge, saveAllMethods 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:
getMainVersioningSupplementin classBambooHibernateVersionAwareObjectDao<RepositoryDataEntity,Object>
-
findById
- Specified by:
findByIdin interfaceRepositoryDefinitionDao
-
findAll
- Specified by:
findAllin interfaceRepositoryDefinitionDao
-
findAll
@NotNull public @NotNull Collection<? extends RepositoryDataEntity> findAll(int firstResult, int maxResults) - Specified by:
findAllin interfaceRepositoryDefinitionDao
-
findAllByParent
@NotNull public @NotNull Collection<? extends RepositoryDataEntity> findAllByParent(@Nullable @Nullable Long parentId, int firstResult, int maxResults) - Specified by:
findAllByParentin interfaceRepositoryDefinitionDao
-
countAll
public long countAll()- Specified by:
countAllin interfaceRepositoryDefinitionDao
-
countAllByParent
- Specified by:
countAllByParentin interfaceRepositoryDefinitionDao
-
countTopLevelGlobalRepositories
public long countTopLevelGlobalRepositories()Description copied from interface:RepositoryDefinitionDaoCount global, non-deleted repositories without any parent repository.- Specified by:
countTopLevelGlobalRepositoriesin interfaceRepositoryDefinitionDao
-
getTopLevelGlobalRepositories
@NotNull public @NotNull List<RepositoryDataEntity> getTopLevelGlobalRepositories(int firstResult, int maxResults) Description copied from interface:RepositoryDefinitionDaoReturn a list of global, non-deleted repositories without any parent repository.- Specified by:
getTopLevelGlobalRepositoriesin interfaceRepositoryDefinitionDao
-
countRepositoriesByPluginKey
-
findRepositoriesByPluginKey
@NotNull public @NotNull List<RepositoryDataEntity> findRepositoriesByPluginKey(@NotNull @NotNull String pluginKey) - Specified by:
findRepositoriesByPluginKeyin interfaceRepositoryDefinitionDao
-
findRepositoriesByPluginKey
@NotNull public @NotNull List<RepositoryDataEntity> findRepositoriesByPluginKey(@NotNull @NotNull String pluginKey, int firstResult, int maxResults) -
getGlobalRepositoryDefinitions
- Specified by:
getGlobalRepositoryDefinitionsin interfaceRepositoryDefinitionDao
-
getProjectRepositoryDefinitions
Description copied from interface:RepositoryDefinitionDaoGet all project repositories associated with given projectId.- Specified by:
getProjectRepositoryDefinitionsin interfaceRepositoryDefinitionDao- Returns:
- List of RepositoryDataEntity which are project repositories associated with given projectId
-
countAllProjectsRepositories
Description copied from interface:RepositoryDefinitionDaoCount project, non-deleted repositories.- Specified by:
countAllProjectsRepositoriesin interfaceRepositoryDefinitionDao
-
findAllProjectsIdsUsingProjectRepositories
Description copied from interface:RepositoryDefinitionDaoGet IDs of all projects which are using project repositories.- Specified by:
findAllProjectsIdsUsingProjectRepositoriesin 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:
getPrivateRepositoryDefinitionsByPlanin interfaceRepositoryDefinitionDao
-
removeRepositoryIfUnused
- Specified by:
removeRepositoryIfUnusedin interfaceRepositoryDefinitionDao
-
delete
Description copied from interface:BambooObjectDaoRemoves the given entity from the database- Specified by:
deletein interfaceBambooObjectDao<RepositoryDataEntity>- Overrides:
deletein classBambooHibernateVersionAwareObjectDao<RepositoryDataEntity,Object> - Parameters:
repositoryDataEntity- entity to be removed
-
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<RepositoryDataEntity>- Overrides:
savein classBambooHibernateVersionAwareObjectDao<RepositoryDataEntity,Object> - Parameters:
repositoryDataEntity- entity to be saved
-
removeUnusedRepositories
public void removeUnusedRepositories()- Specified by:
removeUnusedRepositoriesin interfaceRepositoryDefinitionDao
-
findAllRepositoryIds
- Specified by:
findAllRepositoryIdsin interfaceRepositoryDefinitionDao
-
findAllRepositoryIds
- Specified by:
findAllRepositoryIdsin interfaceRepositoryDefinitionDao
-
findAll
- Specified by:
findAllin interfaceRepositoryDefinitionDao
-
findAllTopLevelRepositoriesIds
Description copied from interface:RepositoryDefinitionDaoGet ids of all repositories that doesn't have parent repository (are either linked or are created on plan level)- Specified by:
findAllTopLevelRepositoriesIdsin interfaceRepositoryDefinitionDao
-
getMaxRepositoryOid
Description copied from interface:RepositoryDefinitionDaoReturns the maxBambooEntityOidthat's currently in use ofBambooEntityType.REPOSITORYtype, with the given server key. Returns null if no OIDs are in use of this type with the given server key.- Specified by:
getMaxRepositoryOidin interfaceRepositoryDefinitionDao
-
findLinkedRepositoryByName
@Nullable public @Nullable RepositoryDataEntity findLinkedRepositoryByName(@NotNull @NotNull String name) Description copied from interface:RepositoryDefinitionDaoFind a linked repository by name;- Specified by:
findLinkedRepositoryByNamein interfaceRepositoryDefinitionDao- Returns:
-
markForDeletionByParentId
public void markForDeletionByParentId(long parentId) Description copied from interface:RepositoryDefinitionDaoMark all direct children of repository with given id for deletion.- Specified by:
markForDeletionByParentIdin interfaceRepositoryDefinitionDao
-
markForDeletionByProjectId
public void markForDeletionByProjectId(long projectId) Description copied from interface:RepositoryDefinitionDaoMark all project repositories with given projectId for deletion.- Specified by:
markForDeletionByProjectIdin interfaceRepositoryDefinitionDao
-
findProjectRepositoryByName
@Nullable public @Nullable RepositoryDataEntity findProjectRepositoryByName(@NotNull @NotNull String name, @NotNull @NotNull Long projectId) Description copied from interface:RepositoryDefinitionDaoFind a project repository by name in project associated with given projectId.- Specified by:
findProjectRepositoryByNamein interfaceRepositoryDefinitionDao- Returns:
- RepositoryDataEntity if repository exists otherwise null.
-