Package com.atlassian.bamboo.artifact
Class ArtifactHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.artifact.ArtifactHibernateDao
- All Implemented Interfaces:
ArtifactDao
,org.springframework.beans.factory.InitializingBean
public class ArtifactHibernateDao
extends StatelessSessionHibernateDaoSupport
implements ArtifactDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindAll()
Find allMutableArtifact
Find how much space artifacts use by link type, e.g.@Nullable MutableArtifact
findById
(long id) FindMutableArtifact
by id.Find all artifacts that are no longer referenced by any result or version.findOrphanedArtifactsByIds
(@NotNull List<Long> artifactIds) Find all artifacts which id is on the list and that are no longer referenced by any result or version.findPlanArtifactsReferencedByVersion
(@NotNull PlanKey planKey) Find all artifacts that belong to a plan are part of a deployment version.findPlanResultArtifactsReferencedByVersion
(@NotNull PlanResultKey planResultKey) Find all artifacts that belong to a build result are part of a deployment version.boolean
isReferencedByVersion
(long artifactId) void
removeAll
(@NotNull Collection<MutableArtifact> artifacts) Remove all artifacts in the collectionvoid
removeAllByIds
(@NotNull Collection<Long> artifactIds) void
removeById
(long id) Remove artifact.void
removeByPlanKey
(@NotNull PlanKey planKey) Remove all artifacts that belong to a plan and are not part of a deployment version.void
removeByPlanResultKey
(@NotNull PlanResultKey planResultKey) Remove all artifacts that belong to a build result and are not part of a deployment version.void
save
(MutableArtifact artifact) Save artifact.void
updatePlanKey
(@NotNull PlanKey originalPlanKey, @NotNull PlanKey newPlanKey) Update planKey in Artifact entities when plan key has changed (ie after moving plan)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
-
Constructor Details
-
ArtifactHibernateDao
-
-
Method Details
-
save
Description copied from interface:ArtifactDao
Save artifact.- Specified by:
save
in interfaceArtifactDao
-
findAll
Description copied from interface:ArtifactDao
Find allMutableArtifact
- Specified by:
findAll
in interfaceArtifactDao
- Returns:
-
findById
Description copied from interface:ArtifactDao
FindMutableArtifact
by id.- Specified by:
findById
in interfaceArtifactDao
- Returns:
-
isReferencedByVersion
public boolean isReferencedByVersion(long artifactId) - Specified by:
isReferencedByVersion
in interfaceArtifactDao
- Returns:
- true iff artifact is a part of a deployment verison
-
findPlanResultArtifactsReferencedByVersion
public List<MutableArtifact> findPlanResultArtifactsReferencedByVersion(@NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:ArtifactDao
Find all artifacts that belong to a build result are part of a deployment version.- Specified by:
findPlanResultArtifactsReferencedByVersion
in interfaceArtifactDao
- Returns:
-
findPlanArtifactsReferencedByVersion
public List<MutableArtifact> findPlanArtifactsReferencedByVersion(@NotNull @NotNull PlanKey planKey) Description copied from interface:ArtifactDao
Find all artifacts that belong to a plan are part of a deployment version.- Specified by:
findPlanArtifactsReferencedByVersion
in interfaceArtifactDao
- Returns:
-
removeById
public void removeById(long id) Description copied from interface:ArtifactDao
Remove artifact.- Specified by:
removeById
in interfaceArtifactDao
-
removeByPlanKey
Description copied from interface:ArtifactDao
Remove all artifacts that belong to a plan and are not part of a deployment version.- Specified by:
removeByPlanKey
in interfaceArtifactDao
-
removeByPlanResultKey
Description copied from interface:ArtifactDao
Remove all artifacts that belong to a build result and are not part of a deployment version.- Specified by:
removeByPlanResultKey
in interfaceArtifactDao
-
findOrphanedArtifacts
Description copied from interface:ArtifactDao
Find all artifacts that are no longer referenced by any result or version.- Specified by:
findOrphanedArtifacts
in interfaceArtifactDao
- Returns:
-
findOrphanedArtifactsByIds
Description copied from interface:ArtifactDao
Find all artifacts which id is on the list and that are no longer referenced by any result or version.- Specified by:
findOrphanedArtifactsByIds
in interfaceArtifactDao
-
removeAll
Description copied from interface:ArtifactDao
Remove all artifacts in the collection- Specified by:
removeAll
in interfaceArtifactDao
-
removeAllByIds
- Specified by:
removeAllByIds
in interfaceArtifactDao
-
updatePlanKey
public void updatePlanKey(@NotNull @NotNull PlanKey originalPlanKey, @NotNull @NotNull PlanKey newPlanKey) Description copied from interface:ArtifactDao
Update planKey in Artifact entities when plan key has changed (ie after moving plan)- Specified by:
updatePlanKey
in interfaceArtifactDao
- Parameters:
originalPlanKey
- original PlanKeynewPlanKey
- new PlanKey
-
findArtifactUsedStorageByLinkType
Description copied from interface:ArtifactDao
Find how much space artifacts use by link type, e.g. local storage, AWS, agent side etc- Specified by:
findArtifactUsedStorageByLinkType
in interfaceArtifactDao
- Returns:
- artifact link type -> artifacts size in bytes
-