com.atlassian.bamboo.author
Class HibernateAuthorManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.author.HibernateAuthorManagerImpl
All Implemented Interfaces:
AuthorManager, ExtendedAuthorManager

public class HibernateAuthorManagerImpl
extends Object
implements ExtendedAuthorManager


Constructor Summary
HibernateAuthorManagerImpl(AuthorDao authorDao, BambooUserManager bambooUserManager)
           
 
Method Summary
 void createAndSaveAuthor(Author author)
          Creates and saves author given author, if bamboo user with the same username exists the new author will be linked to that user.
 List<Author> findAuthorsByName(String authorSearchString)
          Performs a case insensitive search for authors by their author name.
 List<Author> findAuthorsByUser(String userSearchString)
          Performs a case insensitive search for authors by their linkedUserName.
 List<Author> findAuthorsThatStartWith(String authorSearchString, boolean unlinkedOnly)
          Performs a case insensitive search for authors by their author name.
 List<ResultsSummary> findBuildResultsBrokenByAuthor(ExtendedAuthor author, int maxResultCount)
           
 List<ResultsSummary> findBuildResultsFailedByAuthor(ExtendedAuthor author, int maxResultCount)
           
 List<ResultsSummary> findBuildResultsFixedByAuthor(ExtendedAuthor author, int maxResultCount)
           
 List<ResultsSummary> findBuildResultsSuccessfulByAuthor(ExtendedAuthor author, int maxResultCount)
           
 List<ResultsSummary> findBuildResultsTriggeredByAuthor(ExtendedAuthor author, int maxResultCount)
           
 Collection<ResultsSummary> findLatestBuildBrokenByAuthorInEachPlan(ExtendedAuthor author)
          Retrieves the last build broken by author for all the plans.
 int findNumberOfBuildBrokenByAuthor(ExtendedAuthor author)
           
 int findNumberOfBuildFixedByAuthor(ExtendedAuthor author)
           
 int findNumberOfBuildsTriggeredByAuthor(ExtendedAuthor author)
           
 int findNumberOfFailedBuildsByAuthor(ExtendedAuthor author)
           
 int findNumberOfSuccessfulBuildsByAuthor(ExtendedAuthor author)
           
 List<ResultsSummary> findRecentResultsTriggeredByAuthors(List<ExtendedAuthor> authors, int maxDays)
          Retrieve all build results triggered by the author in the last X days
 Set getAllAuthors()
           
 Set<ExtendedAuthor> getAllUnlinkedAuthors()
           
 ExtendedAuthor getAuthorById(long id)
           
 Author getAuthorByName(String name)
           
 Set<Author> getAuthorsByResultSummary(ResultsSummary resultsSummary)
          Retrieve unique set of authors that contributed to commits related to a given ResultsSummary
 List<ExtendedAuthor> getAvailableAuthors(com.atlassian.user.User user)
          Get authors available for a user.
 ExtendedAuthor getExtendedAuthorByName(String name)
          Get Author information by author name.
 List<ExtendedAuthor> getLinkedAuthorForUser(com.atlassian.user.User user)
           
 void relinkUnlinkedAuthors()
          Attempt to link any authors that currently aren't linked with a user.
 void removeAuthor(ExtendedAuthor extendedAuthor)
          removes an author
 void saveAuthor(ExtendedAuthor author)
          Save the author
 void unlinkAllAuthors()
          Remove all author links.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateAuthorManagerImpl

public HibernateAuthorManagerImpl(AuthorDao authorDao,
                                  BambooUserManager bambooUserManager)
Method Detail

createAndSaveAuthor

public void createAndSaveAuthor(@NotNull
                                Author author)
Description copied from interface: ExtendedAuthorManager
Creates and saves author given author, if bamboo user with the same username exists the new author will be linked to that user.

Specified by:
createAndSaveAuthor in interface ExtendedAuthorManager

getAllAuthors

public Set getAllAuthors()
Specified by:
getAllAuthors in interface AuthorManager
Returns:
Set of all Author

unlinkAllAuthors

public void unlinkAllAuthors()
Description copied from interface: ExtendedAuthorManager
Remove all author links. Useful if you have changed user management systems

Specified by:
unlinkAllAuthors in interface ExtendedAuthorManager

relinkUnlinkedAuthors

public void relinkUnlinkedAuthors()
Description copied from interface: ExtendedAuthorManager
Attempt to link any authors that currently aren't linked with a user. Currently only checks for direct author/username matches

Specified by:
relinkUnlinkedAuthors in interface ExtendedAuthorManager

getAuthorByName

public Author getAuthorByName(String name)
Specified by:
getAuthorByName in interface AuthorManager
Returns:
Author with given name.

getAllUnlinkedAuthors

@NotNull
public Set<ExtendedAuthor> getAllUnlinkedAuthors()
Specified by:
getAllUnlinkedAuthors in interface ExtendedAuthorManager
Returns:
Set of ExtendedAuthor objects not linked to users

getExtendedAuthorByName

public ExtendedAuthor getExtendedAuthorByName(String name)
Description copied from interface: ExtendedAuthorManager
Get Author information by author name. Author names in DB are kept trimmed, make sure that name param is trimmed as well

Specified by:
getExtendedAuthorByName in interface ExtendedAuthorManager
Parameters:
name - trimmed author name
Returns:
ExtendedAuthor with given name (assuming unique)

findBuildResultsTriggeredByAuthor

@NotNull
public List<ResultsSummary> findBuildResultsTriggeredByAuthor(ExtendedAuthor author,
                                                                      int maxResultCount)
Specified by:
findBuildResultsTriggeredByAuthor in interface ExtendedAuthorManager
maxResultCount - if <= 0 all the results are returned
Returns:
List of BuildResultsSummary triggered by author

findRecentResultsTriggeredByAuthors

public List<ResultsSummary> findRecentResultsTriggeredByAuthors(List<ExtendedAuthor> authors,
                                                                int maxDays)
Description copied from interface: ExtendedAuthorManager
Retrieve all build results triggered by the author in the last X days

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

findBuildResultsFailedByAuthor

@NotNull
public List<ResultsSummary> findBuildResultsFailedByAuthor(ExtendedAuthor author,
                                                                   int maxResultCount)
Specified by:
findBuildResultsFailedByAuthor in interface ExtendedAuthorManager
maxResultCount - if <= 0 all the results are returned
Returns:
List of BuildResultsSummary triggered by author and failed

findBuildResultsSuccessfulByAuthor

@NotNull
public List<ResultsSummary> findBuildResultsSuccessfulByAuthor(ExtendedAuthor author,
                                                                       int maxResultCount)
Specified by:
findBuildResultsSuccessfulByAuthor in interface ExtendedAuthorManager
maxResultCount - if <= 0 all the results are returned
Returns:
List of BuildResultsSummary triggered by author and successful

findBuildResultsBrokenByAuthor

@NotNull
public List<ResultsSummary> findBuildResultsBrokenByAuthor(ExtendedAuthor author,
                                                                   int maxResultCount)
Specified by:
findBuildResultsBrokenByAuthor in interface ExtendedAuthorManager
maxResultCount - if <= 0 all the results are returned
Returns:
List of BuildResultsSummary broken by author

findLatestBuildBrokenByAuthorInEachPlan

@NotNull
public Collection<ResultsSummary> findLatestBuildBrokenByAuthorInEachPlan(ExtendedAuthor author)
Description copied from interface: ExtendedAuthorManager
Retrieves the last build broken by author for all the plans.

Specified by:
findLatestBuildBrokenByAuthorInEachPlan in interface ExtendedAuthorManager
Returns:
List of BuildResultsSummary broken by author

findBuildResultsFixedByAuthor

@NotNull
public List<ResultsSummary> findBuildResultsFixedByAuthor(ExtendedAuthor author,
                                                                  int maxResultCount)
Specified by:
findBuildResultsFixedByAuthor in interface ExtendedAuthorManager
maxResultCount - if <= 0 all the results are returned
Returns:
List of BuildResultsSummary fixed by author

findNumberOfBuildsTriggeredByAuthor

public int findNumberOfBuildsTriggeredByAuthor(ExtendedAuthor author)
Specified by:
findNumberOfBuildsTriggeredByAuthor in interface ExtendedAuthorManager
Returns:
int

findNumberOfFailedBuildsByAuthor

public int findNumberOfFailedBuildsByAuthor(ExtendedAuthor author)
Specified by:
findNumberOfFailedBuildsByAuthor in interface ExtendedAuthorManager
Returns:
int

findNumberOfSuccessfulBuildsByAuthor

public int findNumberOfSuccessfulBuildsByAuthor(ExtendedAuthor author)
Specified by:
findNumberOfSuccessfulBuildsByAuthor in interface ExtendedAuthorManager
Returns:
int

findNumberOfBuildFixedByAuthor

public int findNumberOfBuildFixedByAuthor(ExtendedAuthor author)
Specified by:
findNumberOfBuildFixedByAuthor in interface ExtendedAuthorManager
Returns:
int

findNumberOfBuildBrokenByAuthor

public int findNumberOfBuildBrokenByAuthor(ExtendedAuthor author)
Specified by:
findNumberOfBuildBrokenByAuthor in interface ExtendedAuthorManager
Returns:
int

getAuthorById

public ExtendedAuthor getAuthorById(long id)
Specified by:
getAuthorById in interface ExtendedAuthorManager
Returns:
Author given id

getLinkedAuthorForUser

@NotNull
public List<ExtendedAuthor> getLinkedAuthorForUser(com.atlassian.user.User user)
Specified by:
getLinkedAuthorForUser in interface ExtendedAuthorManager
Returns:
List of ExtendedAuthor linked to the user.

getAvailableAuthors

@NotNull
public List<ExtendedAuthor> getAvailableAuthors(@Nullable
                                                        com.atlassian.user.User user)
Description copied from interface: ExtendedAuthorManager
Get authors available for a user. That includes all authors user is linked to and all unlinked authors.

Specified by:
getAvailableAuthors in interface ExtendedAuthorManager
Parameters:
user - user
Returns:
List of ExtendedAuthor

findAuthorsByName

@NotNull
public List<Author> findAuthorsByName(@NotNull
                                              String authorSearchString)
Description copied from interface: ExtendedAuthorManager
Performs a case insensitive search for authors by their author name. AuthorSearchString can appear anywhere in the authors name.

Specified by:
findAuthorsByName in interface ExtendedAuthorManager
Parameters:
authorSearchString - string to search for
Returns:
any authors who's author name match the given string.

findAuthorsThatStartWith

@NotNull
public List<Author> findAuthorsThatStartWith(@NotNull
                                                     String authorSearchString,
                                                     boolean unlinkedOnly)
Description copied from interface: ExtendedAuthorManager
Performs a case insensitive search for authors by their author name.

Specified by:
findAuthorsThatStartWith in interface ExtendedAuthorManager
Parameters:
authorSearchString - string to search for
unlinkedOnly - if true will only return users which have not been linked with an user already
Returns:
any authors who's author name match the given string.

findAuthorsByUser

@NotNull
public List<Author> findAuthorsByUser(@NotNull
                                              String userSearchString)
Description copied from interface: ExtendedAuthorManager
Performs a case insensitive search for authors by their linkedUserName. userSearchString can appear anywhere in the linked user name.

Specified by:
findAuthorsByUser in interface ExtendedAuthorManager
Parameters:
userSearchString - string to search for
Returns:
any authors who's linkedusername match the given string.

getAuthorsByResultSummary

@NotNull
public Set<Author> getAuthorsByResultSummary(@NotNull
                                                     ResultsSummary resultsSummary)
Description copied from interface: ExtendedAuthorManager
Retrieve unique set of authors that contributed to commits related to a given ResultsSummary

Specified by:
getAuthorsByResultSummary in interface ExtendedAuthorManager
Parameters:
resultsSummary - ResultsSummary
Returns:
list of authors

removeAuthor

public void removeAuthor(ExtendedAuthor extendedAuthor)
Description copied from interface: ExtendedAuthorManager
removes an author

Specified by:
removeAuthor in interface ExtendedAuthorManager

saveAuthor

public void saveAuthor(ExtendedAuthor author)
Description copied from interface: ExtendedAuthorManager
Save the author

Specified by:
saveAuthor in interface ExtendedAuthorManager


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