com.atlassian.bamboo.artifact
Class ArtifactHibernateDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
              extended by 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
ArtifactHibernateDao(TransactionAndHibernateTemplate transactionTemplate)
           
 
Method Summary
 List<MutableArtifact> findAll()
          Find all MutableArtifact
 Map<String,Long> findArtifactUsedStorageByLinkType()
          Find how much space artifacts use by link type, e.g.
 MutableArtifact findById(long id)
          Find MutableArtifact by id.
 List<MutableArtifact> findOrphanedArtifacts()
          Find all artifacts that are no longer referenced by any result or version.
 List<MutableArtifact> findPlanArtifactsReferencedByVersion(PlanKey planKey)
          Find all artifacts that belong to a plan are part of a deployment version.
 List<MutableArtifact> findPlanResultArtifactsReferencedByVersion(PlanResultKey planResultKey)
          Find all artifacts that belong to a build result are part of a deployment version.
 boolean isReferencedByVersion(long artifactId)
           
 void removeAll(Collection<MutableArtifact> artifacts)
          Remove all artifacts in the collection
 void removeById(long id)
          Remove artifact.
 void removeByPlanKey(PlanKey planKey)
          Remove all artifacts that belong to a plan and are not part of a deployment version.
 void removeByPlanResultKey(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(PlanKey originalPlanKey, 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.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, 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
 

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 interface ArtifactDao

findAll

public List<MutableArtifact> findAll()
Description copied from interface: ArtifactDao
Find all MutableArtifact

Specified by:
findAll in interface ArtifactDao
Returns:

findById

@Nullable
public MutableArtifact findById(long id)
Description copied from interface: ArtifactDao
Find MutableArtifact by id.

Specified by:
findById in interface ArtifactDao
Returns:

isReferencedByVersion

public boolean isReferencedByVersion(long artifactId)
Specified by:
isReferencedByVersion in interface ArtifactDao
Returns:
true iff artifact is a part of a deployment verison

findPlanResultArtifactsReferencedByVersion

public List<MutableArtifact> findPlanResultArtifactsReferencedByVersion(@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 interface ArtifactDao
Returns:

findPlanArtifactsReferencedByVersion

public List<MutableArtifact> findPlanArtifactsReferencedByVersion(@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 interface ArtifactDao
Returns:

removeById

public void removeById(long id)
Description copied from interface: ArtifactDao
Remove artifact.

Specified by:
removeById in interface ArtifactDao

removeByPlanKey

public void removeByPlanKey(@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 interface ArtifactDao

removeByPlanResultKey

public void removeByPlanResultKey(@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 interface ArtifactDao

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 interface ArtifactDao
Returns:

removeAll

public void removeAll(@NotNull
                      Collection<MutableArtifact> artifacts)
Description copied from interface: ArtifactDao
Remove all artifacts in the collection

Specified by:
removeAll in interface ArtifactDao

updatePlanKey

public void updatePlanKey(@NotNull
                          PlanKey originalPlanKey,
                          @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 interface ArtifactDao
Parameters:
originalPlanKey - original PlanKey
newPlanKey - new PlanKey

findArtifactUsedStorageByLinkType

@NotNull
public 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 interface ArtifactDao
Returns:
artifact link type -> artifacts size in bytes


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.