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 MutableArtifactfindById(long id)FindMutableArtifactby 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.booleanisReferencedByVersion(long artifactId)voidremoveAll(@NotNull Collection<MutableArtifact> artifacts)Remove all artifacts in the collectionvoidremoveAllByIds(@NotNull Collection<Long> artifactIds)voidremoveById(long id)Remove artifact.voidremoveByPlanKey(@NotNull PlanKey planKey)Remove all artifacts that belong to a plan and are not part of a deployment version.voidremoveByPlanResultKey(@NotNull PlanResultKey planResultKey)Remove all artifacts that belong to a build result and are not part of a deployment version.voidsave(MutableArtifact artifact)Save artifact.voidupdatePlanKey(@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:ArtifactDaoSave artifact.- Specified by:
savein interfaceArtifactDao
-
findAll
public List<MutableArtifact> findAll()
Description copied from interface:ArtifactDaoFind allMutableArtifact- Specified by:
findAllin interfaceArtifactDao- Returns:
-
findById
@Nullable public @Nullable MutableArtifact findById(long id)
Description copied from interface:ArtifactDaoFindMutableArtifactby id.- Specified by:
findByIdin interfaceArtifactDao- Returns:
-
isReferencedByVersion
public boolean isReferencedByVersion(long artifactId)
- Specified by:
isReferencedByVersionin 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:ArtifactDaoFind all artifacts that belong to a build result are part of a deployment version.- Specified by:
findPlanResultArtifactsReferencedByVersionin interfaceArtifactDao- Returns:
-
findPlanArtifactsReferencedByVersion
public List<MutableArtifact> findPlanArtifactsReferencedByVersion(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ArtifactDaoFind all artifacts that belong to a plan are part of a deployment version.- Specified by:
findPlanArtifactsReferencedByVersionin interfaceArtifactDao- Returns:
-
removeById
public void removeById(long id)
Description copied from interface:ArtifactDaoRemove artifact.- Specified by:
removeByIdin interfaceArtifactDao
-
removeByPlanKey
public void removeByPlanKey(@NotNull @NotNull PlanKey planKey)Description copied from interface:ArtifactDaoRemove all artifacts that belong to a plan and are not part of a deployment version.- Specified by:
removeByPlanKeyin interfaceArtifactDao
-
removeByPlanResultKey
public void removeByPlanResultKey(@NotNull @NotNull PlanResultKey planResultKey)Description copied from interface:ArtifactDaoRemove all artifacts that belong to a build result and are not part of a deployment version.- Specified by:
removeByPlanResultKeyin interfaceArtifactDao
-
findOrphanedArtifacts
public List<MutableArtifact> findOrphanedArtifacts()
Description copied from interface:ArtifactDaoFind all artifacts that are no longer referenced by any result or version.- Specified by:
findOrphanedArtifactsin interfaceArtifactDao- Returns:
-
findOrphanedArtifactsByIds
public List<MutableArtifact> findOrphanedArtifactsByIds(@NotNull @NotNull List<Long> artifactIds)
Description copied from interface:ArtifactDaoFind all artifacts which id is on the list and that are no longer referenced by any result or version.- Specified by:
findOrphanedArtifactsByIdsin interfaceArtifactDao
-
removeAll
public void removeAll(@NotNull @NotNull Collection<MutableArtifact> artifacts)Description copied from interface:ArtifactDaoRemove all artifacts in the collection- Specified by:
removeAllin interfaceArtifactDao
-
removeAllByIds
public void removeAllByIds(@NotNull @NotNull Collection<Long> artifactIds)- Specified by:
removeAllByIdsin interfaceArtifactDao
-
updatePlanKey
public void updatePlanKey(@NotNull @NotNull PlanKey originalPlanKey, @NotNull @NotNull PlanKey newPlanKey)Description copied from interface:ArtifactDaoUpdate planKey in Artifact entities when plan key has changed (ie after moving plan)- Specified by:
updatePlanKeyin interfaceArtifactDao- Parameters:
originalPlanKey- original PlanKeynewPlanKey- new PlanKey
-
findArtifactUsedStorageByLinkType
@NotNull public @NotNull Map<String,Long> findArtifactUsedStorageByLinkType()
Description copied from interface:ArtifactDaoFind how much space artifacts use by link type, e.g. local storage, AWS, agent side etc- Specified by:
findArtifactUsedStorageByLinkTypein interfaceArtifactDao- Returns:
- artifact link type -> artifacts size in bytes
-
-