Class BambooHibernateObjectDao<T extends BambooObject>

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>
All Implemented Interfaces:
BambooObjectDao<T>, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
AgentBuildResultsSummaryHibernateDao, AgentCipherHibernateDao, ArtifactSubscriptionHibernateDao, AuditLogHibernateDao, AuthorHibernateDao, BambooHibernateObjectWithOidDao, BambooHibernateVersionAwareObjectDao, BambooTrustedApplicationsHibernateDao, BranchCommitInformationHibernateDao, BuildNumberExportHibernateDao, BuildResultsSummaryHibernateDao, BuildResultWarningSummaryDaoImpl, CapabilityDaoImpl, CommentHibernateDao, CommitHibernateDao, ConsumedSubscriptionHibernateDao, CrowdDeletedEntityHibernateDao, ElasticTunnelDefinitionDaoImpl, EnvironmentDaoImpl, EnvironmentRepositoryLinkHibernateDao, EphemeralAgentTemplateHibernateDao, HibernateAccessTokenDao, LinkedJiraIssueHibernateDao, LoginInformationHibernateDao, MergeResultSummaryDaoImpl, PerAgentTokenHibernateDao, PlanVcsRevisionHistoryHibernateStandaloneDao, QuickFilterHibernateDao, QuickFilterRuleHibernateDao, QuickSearchItemDaoImpl, RemoteAgentAuthenticationHibernateDao, RepositoryChangesetHibernateDao, ScriptDaoImpl, TestCaseHibernateDao, TestCaseResultHibernateDao, TestResultsHibernateDao, TestsHibernateDao, TrustedKeyHibernateDaoImpl, VariableContextBaselineHibernateDao, VcsBranchHibernateDao, VcsPullRequestHibernateDao, VcsTagDaoImpl, WebhookResponseHibernateDao, WebhookTemplateHibernateDao

public abstract class BambooHibernateObjectDao<T extends BambooObject> extends StatelessSessionHibernateDaoSupport implements BambooObjectDao<T>
  • Field Summary

    Fields inherited from class org.springframework.dao.support.DaoSupport

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
     
    <E extends T>
    long
    countAll(@NotNull Class<E> aClass)
    Finds the count of all entities that implement the given Class
    <E extends T>
    long
    countWithRestriction(@NotNull Class<E> aClass, @NotNull org.hibernate.criterion.Criterion restriction)
    Finds the count of all entities that implement the given class and satisfy the provided restriction
    void
    delete(T t)
    Removes the given entity from the database
    <E extends T>
    void
    deleteAll(@NotNull Collection<E> entities)
    Remove all elements in the collection from database
    long
    executeCountQuery(@NotNull String queryName)
    Execute count-type query and returns result
    <E extends T>
    @NotNull Collection<E>
    findAll(@NotNull Class<E> aClass)
    Finds all the entities that implement the given Class
    <E extends T>
    E
    findById(long id, @NotNull Class<E> aClass)
    Find an entity by its id
    merge(T unmanagedEntity, @NotNull Class<? extends T> entityClass)
    Merges the state of the given unmanaged entity.
    void
    save(T t)
    Saves the given entity.
    <E extends T>
    void
    saveAll(@NotNull Collection<E> entities)
    Save all entities in the collection to the database

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BambooHibernateObjectDao

      public BambooHibernateObjectDao()
  • Method Details

    • save

      public void save(@NotNull T t)
      Description copied from interface: BambooObjectDao
      Saves the given entity. If the entity implementation is an instance of EntityObject this method will: - update EntityObject.getLastModificationDate() - set EntityObject.getCreationDate() if the object has not been saved
      Specified by:
      save in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      t - entity to be saved
    • saveAll

      public <E extends T> void saveAll(@NotNull @NotNull Collection<E> entities)
      Description copied from interface: BambooObjectDao
      Save all entities in the collection to the database
      Specified by:
      saveAll in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      entities - entities to be saved to database
    • merge

      @NotNull public T merge(@NotNull T unmanagedEntity, @NotNull @NotNull Class<? extends T> entityClass)
      Description copied from interface: BambooObjectDao
      Merges the state of the given unmanaged entity.

      This method should only be used with entities which are not currently managed by Hibernate, otherwise BambooObjectDao.save(BambooObject) should be called.

      If the entity implementation is an interface of EntityObject, the EntityObject.getCreationDate() and EntityObject.getLastModificationDate() properties will be updated accordingly (the former only if a new database object is created).

      Specified by:
      merge in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      unmanagedEntity - entity not managed by Hibernate to merge
      entityClass - class of the entity
      Returns:
      managed entity as a result of merging and persisting the data - may be either a newly created or updated database object
    • delete

      public void delete(@NotNull T t)
      Description copied from interface: BambooObjectDao
      Removes the given entity from the database
      Specified by:
      delete in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      t - entity to be removed
    • deleteAll

      public <E extends T> void deleteAll(@NotNull @NotNull Collection<E> entities)
      Description copied from interface: BambooObjectDao
      Remove all elements in the collection from database
      Specified by:
      deleteAll in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      entities - elements to be removed from database
    • findAll

      @NotNull public <E extends T> @NotNull Collection<E> findAll(@NotNull @NotNull Class<E> aClass)
      Description copied from interface: BambooObjectDao
      Finds all the entities that implement the given Class
      Specified by:
      findAll in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      aClass - class of entity
      Returns:
      entities
    • countAll

      public <E extends T> long countAll(@NotNull @NotNull Class<E> aClass)
      Description copied from interface: BambooObjectDao
      Finds the count of all entities that implement the given Class
      Specified by:
      countAll in interface BambooObjectDao<T extends BambooObject>
    • countWithRestriction

      public <E extends T> long countWithRestriction(@NotNull @NotNull Class<E> aClass, @NotNull @NotNull org.hibernate.criterion.Criterion restriction)
      Description copied from interface: BambooObjectDao
      Finds the count of all entities that implement the given class and satisfy the provided restriction
      Specified by:
      countWithRestriction in interface BambooObjectDao<T extends BambooObject>
    • findById

      @Nullable public <E extends T> E findById(long id, @NotNull @NotNull Class<E> aClass)
      Description copied from interface: BambooObjectDao
      Find an entity by its id
      Specified by:
      findById in interface BambooObjectDao<T extends BambooObject>
      Parameters:
      id - id of entity
      aClass - class of entity
      Returns:
      entity
    • executeCountQuery

      public long executeCountQuery(@NotNull @NotNull String queryName)
      Execute count-type query and returns result
      Parameters:
      queryName - name of the named query to execute
      Returns:
      value returned by query
    • convertSearchTermToLikeExpression

      protected String convertSearchTermToLikeExpression(@Nullable @Nullable String searchTerm)