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
-
-
Constructor Summary
Constructors Constructor Description ArtifactHibernateDao(TransactionAndHibernateTemplate transactionTemplate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<MutableArtifact>
findAll()
Find allMutableArtifact
@NotNull Map<String,Long>
findArtifactUsedStorageByLinkType()
Find how much space artifacts use by link type, e.g.@Nullable MutableArtifact
findById(long id)
FindMutableArtifact
by id.List<MutableArtifact>
findOrphanedArtifacts()
Find all artifacts that are no longer referenced by any result or version.List<MutableArtifact>
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.List<MutableArtifact>
findPlanArtifactsReferencedByVersion(@NotNull PlanKey planKey)
Find all artifacts that belong to a plan are part of a deployment version.List<MutableArtifact>
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
-
-
-
-
Constructor Detail
-
ArtifactHibernateDao
public ArtifactHibernateDao(TransactionAndHibernateTemplate transactionTemplate)
-
-
Method Detail
-
save
public void save(MutableArtifact artifact)
Description copied from interface:ArtifactDao
Save artifact.- Specified by:
save
in interfaceArtifactDao
-
findAll
public List<MutableArtifact> findAll()
Description copied from interface:ArtifactDao
Find allMutableArtifact
- Specified by:
findAll
in interfaceArtifactDao
- Returns:
-
findById
@Nullable public @Nullable MutableArtifact findById(long id)
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
public void removeByPlanKey(@NotNull @NotNull PlanKey planKey)
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
public void removeByPlanResultKey(@NotNull @NotNull PlanResultKey planResultKey)
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
public List<MutableArtifact> 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
public List<MutableArtifact> findOrphanedArtifactsByIds(@NotNull @NotNull List<Long> artifactIds)
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
public void removeAll(@NotNull @NotNull Collection<MutableArtifact> artifacts)
Description copied from interface:ArtifactDao
Remove all artifacts in the collection- Specified by:
removeAll
in interfaceArtifactDao
-
removeAllByIds
public void removeAllByIds(@NotNull @NotNull Collection<Long> artifactIds)
- 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
@NotNull public @NotNull Map<String,Long> 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
-
-