com.atlassian.bamboo.author
Class AuthorHibernateDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<ExtendedAuthor>
              extended by com.atlassian.bamboo.author.AuthorHibernateDao
All Implemented Interfaces:
AuthorDao, BambooObjectDao<ExtendedAuthor>, org.springframework.beans.factory.InitializingBean

public class AuthorHibernateDao
extends BambooHibernateObjectDao<ExtendedAuthor>
implements AuthorDao


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
AuthorHibernateDao(PlanDiscriminatorRegistry planDiscriminatorRegistry)
           
 
Method Summary
 java.util.Collection<? extends ExtendedAuthor> findAll()
          Get all ExtendedAuthor entities
 ExtendedAuthor findById(long id)
          Find an ExtendedAuthor object of a given id.
 java.util.Set<ExtendedAuthor> getAllUnlinkedAuthors()
           
 ExtendedAuthor getAuthorByName(java.lang.String name)
           
 java.util.List<ResultsSummary> getBuildResultsBrokenByAuthor(ExtendedAuthor author, int maxResultCount)
           
 java.util.List<ResultsSummary> getBuildResultsFailedByAuthor(ExtendedAuthor author, int maxResultCount)
           
 java.util.List<ResultsSummary> getBuildResultsFixedByAuthor(ExtendedAuthor author, int maxResultCount)
           
 java.util.List<ResultsSummary> getBuildResultsSuccessfulByAuthor(ExtendedAuthor author, int maxResultCount)
           
 java.util.List<ResultsSummary> getBuildResultsTriggeredByAuthor(ExtendedAuthor author, int maxResultCount)
           
 java.util.List<ExtendedAuthor> getLinkedAuthorsForUser(com.atlassian.user.User user)
           
 int getNumberOfBuildBrokenByAuthor(ExtendedAuthor author)
           
 int getNumberOfBuildFixedByAuthor(ExtendedAuthor author)
           
 int getNumberOfBuildsTriggeredByAuthor(ExtendedAuthor author)
           
 int getNumberOfFailedBuildsByAuthor(ExtendedAuthor author)
           
 int getNumberOfSuccessfulBuildsByAuthor(ExtendedAuthor author)
           
 java.util.List<ResultsSummary> getRecentResultsTriggeredByAuthors(java.util.List<ExtendedAuthor> authors, int daysToFilter)
          Retrieve all build results triggered by the author in the last X days
 void unlinkLinkedAuthors(com.atlassian.user.User user)
          Removes the link between User and all Author entities, User was linked to
 void updateLinkedAuthors(com.atlassian.user.User user, java.util.List<java.lang.Long> authorIds)
          Updates list of Authors linked to a User.
 
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
delete, deleteAll, executeReturnLong, findAll, findById, save, saveAll
 
Methods inherited from class org.springframework.orm.hibernate.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
 
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
delete, deleteAll, executeReturnLong, findAll, findById, save, saveAll
 

Constructor Detail

AuthorHibernateDao

public AuthorHibernateDao(PlanDiscriminatorRegistry planDiscriminatorRegistry)
Method Detail

findById

public ExtendedAuthor findById(long id)
Description copied from interface: AuthorDao
Find an ExtendedAuthor object of a given id.

Specified by:
findById in interface AuthorDao
Parameters:
id - id of Author to be found
Returns:
ExtendedAuthor object or null if not found

findAll

@NotNull
public java.util.Collection<? extends ExtendedAuthor> findAll()
Description copied from interface: AuthorDao
Get all ExtendedAuthor entities

Specified by:
findAll in interface AuthorDao
Returns:
Collection of ExtendedAuthor

getAuthorByName

public ExtendedAuthor getAuthorByName(java.lang.String name)
Specified by:
getAuthorByName in interface AuthorDao
Returns:
a ExtendedAuthor object given an author name

getBuildResultsFailedByAuthor

@NotNull
public java.util.List<ResultsSummary> getBuildResultsFailedByAuthor(ExtendedAuthor author,
                                                                            int maxResultCount)
Specified by:
getBuildResultsFailedByAuthor in interface AuthorDao
Returns:
List of BuildResultsSummary triggered by author and failed

getBuildResultsSuccessfulByAuthor

@NotNull
public java.util.List<ResultsSummary> getBuildResultsSuccessfulByAuthor(ExtendedAuthor author,
                                                                                int maxResultCount)
Specified by:
getBuildResultsSuccessfulByAuthor in interface AuthorDao
Returns:
List of BuildResultsSummary triggered by author and succesful

getBuildResultsBrokenByAuthor

@NotNull
public java.util.List<ResultsSummary> getBuildResultsBrokenByAuthor(ExtendedAuthor author,
                                                                            int maxResultCount)
Specified by:
getBuildResultsBrokenByAuthor in interface AuthorDao
Returns:
List of BuildResultsSummary broken by author

getBuildResultsFixedByAuthor

@NotNull
public java.util.List<ResultsSummary> getBuildResultsFixedByAuthor(ExtendedAuthor author,
                                                                           int maxResultCount)
Specified by:
getBuildResultsFixedByAuthor in interface AuthorDao
Returns:
List of BuildResultsSummary fixed by author

getNumberOfFailedBuildsByAuthor

public int getNumberOfFailedBuildsByAuthor(ExtendedAuthor author)
Specified by:
getNumberOfFailedBuildsByAuthor in interface AuthorDao
Returns:
int

getNumberOfSuccessfulBuildsByAuthor

public int getNumberOfSuccessfulBuildsByAuthor(ExtendedAuthor author)
Specified by:
getNumberOfSuccessfulBuildsByAuthor in interface AuthorDao
Returns:
int

getNumberOfBuildFixedByAuthor

public int getNumberOfBuildFixedByAuthor(ExtendedAuthor author)
Specified by:
getNumberOfBuildFixedByAuthor in interface AuthorDao
Returns:
int

getNumberOfBuildBrokenByAuthor

public int getNumberOfBuildBrokenByAuthor(ExtendedAuthor author)
Specified by:
getNumberOfBuildBrokenByAuthor in interface AuthorDao
Returns:
int

getAllUnlinkedAuthors

@NotNull
public java.util.Set<ExtendedAuthor> getAllUnlinkedAuthors()
Specified by:
getAllUnlinkedAuthors in interface AuthorDao
Returns:
Set of ExtendedAuthor which are not yet linked to any user.

getLinkedAuthorsForUser

@NotNull
public java.util.List<ExtendedAuthor> getLinkedAuthorsForUser(com.atlassian.user.User user)
Specified by:
getLinkedAuthorsForUser in interface AuthorDao
Returns:
List of ExtendedAuthor which are linked to a given user.

getBuildResultsTriggeredByAuthor

@NotNull
public java.util.List<ResultsSummary> getBuildResultsTriggeredByAuthor(ExtendedAuthor author,
                                                                               int maxResultCount)
Specified by:
getBuildResultsTriggeredByAuthor in interface AuthorDao
Returns:
List of BuildResultsSummary triggered by author

getRecentResultsTriggeredByAuthors

@NotNull
public java.util.List<ResultsSummary> getRecentResultsTriggeredByAuthors(java.util.List<ExtendedAuthor> authors,
                                                                                 int daysToFilter)
Description copied from interface: AuthorDao
Retrieve all build results triggered by the author in the last X days

Specified by:
getRecentResultsTriggeredByAuthors in interface AuthorDao
Parameters:
authors - the builds will be triggered by
daysToFilter - number of days to look back in history
Returns:
all build results triggered by the author in the last X days

getNumberOfBuildsTriggeredByAuthor

public int getNumberOfBuildsTriggeredByAuthor(ExtendedAuthor author)
Specified by:
getNumberOfBuildsTriggeredByAuthor in interface AuthorDao
Returns:
int

unlinkLinkedAuthors

public void unlinkLinkedAuthors(@NotNull
                                com.atlassian.user.User user)
Description copied from interface: AuthorDao
Removes the link between User and all Author entities, User was linked to

Specified by:
unlinkLinkedAuthors in interface AuthorDao
Parameters:
user - user

updateLinkedAuthors

public void updateLinkedAuthors(@NotNull
                                com.atlassian.user.User user,
                                @NotNull
                                java.util.List<java.lang.Long> authorIds)
Description copied from interface: AuthorDao
Updates list of Authors linked to a User. As a result of this operation only Authors with id listed in authorIds will be linked to user

Specified by:
updateLinkedAuthors in interface AuthorDao
Parameters:
user - user
authorIds - list of Author id that should be linked to user


Copyright © 2012 Atlassian. All Rights Reserved.