Package com.atlassian.bamboo.author
Class AuthorHibernateDao
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.orm.hibernate5.support.HibernateDaoSupport
-
- com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
-
- com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<ExtendedAuthor>
-
- com.atlassian.bamboo.author.AuthorHibernateDao
-
- All Implemented Interfaces:
AuthorDao
,BambooObjectDao<ExtendedAuthor>
,org.springframework.beans.factory.InitializingBean
public class AuthorHibernateDao extends BambooHibernateObjectDao<ExtendedAuthor> implements AuthorDao
-
-
Constructor Summary
Constructors Constructor Description AuthorHibernateDao(PlanDiscriminatorRegistry planDiscriminatorRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Collection<? extends ExtendedAuthor>
findAll()
Get allExtendedAuthor
entities@NotNull List<Author>
findAuthorsByLinkedUser(@NotNull String userSearchString)
Performs a case insensitive search for authors by their linkedUserName.@NotNull List<Author>
findAuthorsByName(@NotNull String authorSearchString)
Performs a case insensitive search for authors by their author name.@NotNull List<Author>
findAuthorsThatStartWith(@NotNull String authorSearchString, boolean unlinkedOnly)
Performs a case insensitive search for authors by their author name.ExtendedAuthor
findById(long id)
Find anExtendedAuthor
object of a given id.@NotNull Set<ExtendedAuthor>
getAllUnlinkedAuthors()
@Nullable ExtendedAuthor
getAuthorByName(String name)
@NotNull Set<Author>
getAuthorsByResultSummary(@NotNull ResultsSummary resultsSummary)
Retrieve unique set of authors that contributed to commits related to a given ResultsSummary@NotNull List<ResultsSummary>
getBuildResultsBrokenByAuthor(ExtendedAuthor author, int maxResultCount)
@NotNull List<ResultsSummary>
getBuildResultsFailedByAuthor(ExtendedAuthor author, int maxResultCount)
@NotNull List<ResultsSummary>
getBuildResultsFixedByAuthor(ExtendedAuthor author, int maxResultCount)
@NotNull List<ResultsSummary>
getBuildResultsSuccessfulByAuthor(ExtendedAuthor author, int maxResultCount)
@NotNull List<ResultsSummary>
getBuildResultsTriggeredByAuthor(ExtendedAuthor author, int maxResultCount)
@NotNull 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)
@NotNull List<ResultsSummary>
getRecentResultsTriggeredByAuthors(List<ExtendedAuthor> authors, int daysToFilter)
Retrieve all build results triggered by the author in the last X daysvoid
unlinkLinkedAuthors(@NotNull String username)
Removes all links between a user and author entities.void
updateLinkedAuthors(@NotNull com.atlassian.user.User user, @NotNull List<Long> authorIds)
Updates list of Authors linked to a User.-
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, delete, deleteAll, executeCountQuery, findAll, findById, merge, save, saveAll
-
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.author.AuthorDao
unlinkLinkedAuthors
-
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
countAll, countWithRestriction, delete, deleteAll, findAll, findById, merge, save, saveAll
-
-
-
-
Constructor Detail
-
AuthorHibernateDao
public AuthorHibernateDao(PlanDiscriminatorRegistry planDiscriminatorRegistry)
-
-
Method Detail
-
findById
public ExtendedAuthor findById(long id)
Description copied from interface:AuthorDao
Find anExtendedAuthor
object of a given id.- Specified by:
findById
in interfaceAuthorDao
- Parameters:
id
- id ofAuthor
to be found- Returns:
ExtendedAuthor
object or null if not found
-
findAll
@NotNull public @NotNull Collection<? extends ExtendedAuthor> findAll()
Description copied from interface:AuthorDao
Get allExtendedAuthor
entities- Specified by:
findAll
in interfaceAuthorDao
- Returns:
- Collection of
ExtendedAuthor
-
getAuthorByName
@Nullable public @Nullable ExtendedAuthor getAuthorByName(String name)
- Specified by:
getAuthorByName
in interfaceAuthorDao
- Returns:
- a
ExtendedAuthor
object given an author name
-
getBuildResultsFailedByAuthor
@NotNull public @NotNull List<ResultsSummary> getBuildResultsFailedByAuthor(ExtendedAuthor author, int maxResultCount)
- Specified by:
getBuildResultsFailedByAuthor
in interfaceAuthorDao
- Returns:
List
ofBuildResultsSummary
triggered by author and failed
-
getBuildResultsSuccessfulByAuthor
@NotNull public @NotNull List<ResultsSummary> getBuildResultsSuccessfulByAuthor(ExtendedAuthor author, int maxResultCount)
- Specified by:
getBuildResultsSuccessfulByAuthor
in interfaceAuthorDao
- Returns:
List
ofBuildResultsSummary
triggered by author and succesful
-
getBuildResultsBrokenByAuthor
@NotNull public @NotNull List<ResultsSummary> getBuildResultsBrokenByAuthor(ExtendedAuthor author, int maxResultCount)
- Specified by:
getBuildResultsBrokenByAuthor
in interfaceAuthorDao
- Returns:
List
ofBuildResultsSummary
broken by author
-
getBuildResultsFixedByAuthor
@NotNull public @NotNull List<ResultsSummary> getBuildResultsFixedByAuthor(ExtendedAuthor author, int maxResultCount)
- Specified by:
getBuildResultsFixedByAuthor
in interfaceAuthorDao
- Returns:
List
ofBuildResultsSummary
fixed by author
-
getNumberOfFailedBuildsByAuthor
public int getNumberOfFailedBuildsByAuthor(ExtendedAuthor author)
- Specified by:
getNumberOfFailedBuildsByAuthor
in interfaceAuthorDao
- Returns:
- int
-
getNumberOfSuccessfulBuildsByAuthor
public int getNumberOfSuccessfulBuildsByAuthor(ExtendedAuthor author)
- Specified by:
getNumberOfSuccessfulBuildsByAuthor
in interfaceAuthorDao
- Returns:
- int
-
getNumberOfBuildFixedByAuthor
public int getNumberOfBuildFixedByAuthor(ExtendedAuthor author)
- Specified by:
getNumberOfBuildFixedByAuthor
in interfaceAuthorDao
- Returns:
- int
-
getNumberOfBuildBrokenByAuthor
public int getNumberOfBuildBrokenByAuthor(ExtendedAuthor author)
- Specified by:
getNumberOfBuildBrokenByAuthor
in interfaceAuthorDao
- Returns:
- int
-
getAllUnlinkedAuthors
@NotNull public @NotNull Set<ExtendedAuthor> getAllUnlinkedAuthors()
- Specified by:
getAllUnlinkedAuthors
in interfaceAuthorDao
- Returns:
Set
ofExtendedAuthor
which are not yet linked to any user.
-
getLinkedAuthorsForUser
@NotNull public @NotNull List<ExtendedAuthor> getLinkedAuthorsForUser(com.atlassian.user.User user)
- Specified by:
getLinkedAuthorsForUser
in interfaceAuthorDao
- Returns:
List
ofExtendedAuthor
which are linked to a given user.
-
getBuildResultsTriggeredByAuthor
@NotNull public @NotNull List<ResultsSummary> getBuildResultsTriggeredByAuthor(ExtendedAuthor author, int maxResultCount)
- Specified by:
getBuildResultsTriggeredByAuthor
in interfaceAuthorDao
- Returns:
List
ofBuildResultsSummary
triggered by author
-
getRecentResultsTriggeredByAuthors
@NotNull public @NotNull List<ResultsSummary> getRecentResultsTriggeredByAuthors(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 interfaceAuthorDao
- Parameters:
authors
- the builds will be triggered bydaysToFilter
- 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 interfaceAuthorDao
- Returns:
- int
-
unlinkLinkedAuthors
public void unlinkLinkedAuthors(@NotNull @NotNull String username)
Description copied from interface:AuthorDao
Removes all links between a user and author entities.- Specified by:
unlinkLinkedAuthors
in interfaceAuthorDao
- Parameters:
username
- name of the user
-
updateLinkedAuthors
public void updateLinkedAuthors(@NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull List<Long> authorIds)
Description copied from interface:AuthorDao
Updates list of Authors linked to a User. As a result of this operation onlyAuthor
s with id listed in authorIds will be linked to user- Specified by:
updateLinkedAuthors
in interfaceAuthorDao
- Parameters:
user
- userauthorIds
- list ofAuthor
id that should be linked to user
-
findAuthorsByLinkedUser
@NotNull public @NotNull List<Author> findAuthorsByLinkedUser(@NotNull @NotNull String userSearchString)
Description copied from interface:AuthorDao
Performs a case insensitive search for authors by their linkedUserName. userSearchString can appear anywhere in the linked user name.- Specified by:
findAuthorsByLinkedUser
in interfaceAuthorDao
- Parameters:
userSearchString
- string to search for- Returns:
- any authors who's linkedusername match the given string.
-
findAuthorsByName
@NotNull public @NotNull List<Author> findAuthorsByName(@NotNull @NotNull String authorSearchString)
Description copied from interface:AuthorDao
Performs a case insensitive search for authors by their author name. AuthorSearchString can appear anywhere in the authors name.- Specified by:
findAuthorsByName
in interfaceAuthorDao
- Parameters:
authorSearchString
- string to search for- Returns:
- any authors who's author name match the given string.
-
findAuthorsThatStartWith
@NotNull public @NotNull List<Author> findAuthorsThatStartWith(@NotNull @NotNull String authorSearchString, boolean unlinkedOnly)
Description copied from interface:AuthorDao
Performs a case insensitive search for authors by their author name.- Specified by:
findAuthorsThatStartWith
in interfaceAuthorDao
- Parameters:
authorSearchString
- string to search forunlinkedOnly
- if true will only return users which have not been linked with a user already- Returns:
- any authors who's author name match the given string.
-
getAuthorsByResultSummary
@NotNull public @NotNull Set<Author> getAuthorsByResultSummary(@NotNull @NotNull ResultsSummary resultsSummary)
Description copied from interface:AuthorDao
Retrieve unique set of authors that contributed to commits related to a given ResultsSummary- Specified by:
getAuthorsByResultSummary
in interfaceAuthorDao
- Parameters:
resultsSummary
- ResultsSummary- Returns:
- list of authors
-
-