com.atlassian.bamboo.labels
Class LabelManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.labels.LabelManagerImpl
All Implemented Interfaces:
LabelManager

public class LabelManagerImpl
extends java.lang.Object
implements LabelManager


Field Summary
 
Fields inherited from interface com.atlassian.bamboo.labels.LabelManager
BUILDRESULT_LABEL_NAMESPACE, DEFAULT_MAX_RESULTS, FAVOURITE_LABEL_NAME, FAVOURITE_UNMARK_LABEL_NAME, LABEL_ADDED_TO_BUILD_RESULT, LABEL_CREATED, LABEL_DELETED, LABEL_REMOVED_FROM_BUILD_RESULT, NO_CHANGE
 
Constructor Summary
LabelManagerImpl(org.springframework.transaction.PlatformTransactionManager transactionManager)
           
 
Method Summary
 int addFavourite(Build build, com.atlassian.user.User user)
          Adds a build to a user as favourite.
 int addLabel(java.lang.String labelName, BuildResults buildResults, com.atlassian.user.User user)
          Add a label against a build result.
protected  int addLabel(java.lang.String labelName, java.lang.String namespace, Project project, Build build, BuildResults buildResults, java.lang.String userName)
           
 java.util.List findBuildResultsSummaryByLabel(java.lang.String labelName)
          Finds all BuildResultsSummary labelled with given labelname
 java.util.List findLabels()
          Finds all labels with namespace = 'label', and maxResults set to 200
 java.util.List findLabels(java.lang.String namespace, int maxResults)
          Finds all labels given namespace, and maxResults
 java.util.List findLabels(java.lang.String namespace, int maxResults, Build build)
          Finds all labels in a given build, with namespace and maxResults.
 java.util.List findLabels(java.lang.String namespace, int maxResults, Project project)
          Finds all labels in a given project, with namespace and maxResults.
 java.util.List getFavouritesForBuild(Build build)
          Retrieves a list of usernames which have the given build set as a favourite.
 boolean hasBuildResultsLabel(BuildResultsSummary buildResultsSummary, java.lang.String label)
          Checks whether the build results summary has a particular label
 boolean isFavourite(Build build, com.atlassian.user.User user)
          Determins if the build is a user's favourite
 boolean isManuallyUnmarkedFavourite(Build build, com.atlassian.user.User user)
          Flag which determines if the user has manually unmarked this build as favourite.
 int removeFavourite(Build build, com.atlassian.user.User user)
          Removes a build from a user's favourite.
 int removeLabel(java.lang.String labelName, BuildResults buildResults, com.atlassian.user.User user)
          Removes a label against a build result.
protected  int removeLabel(java.lang.String labelName, java.lang.String namespace, Project project, Build build, BuildResults buildResults, java.lang.String userName)
           
 void setBuildResultsIndexer(BuildResultsIndexer buildResultsIndexer)
           
 void setLabelDao(LabelDao labelDao)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelManagerImpl

public LabelManagerImpl(org.springframework.transaction.PlatformTransactionManager transactionManager)
Method Detail

hasBuildResultsLabel

public boolean hasBuildResultsLabel(BuildResultsSummary buildResultsSummary,
                                    java.lang.String label)
Description copied from interface: LabelManager
Checks whether the build results summary has a particular label

Specified by:
hasBuildResultsLabel in interface LabelManager
Parameters:
buildResultsSummary - @NotNull
label - @NotNull . could be empty
Returns:
Returns true if there is a label object within the correct namespace and a labelling for the BuildResultsSummary

addLabel

public int addLabel(java.lang.String labelName,
                    BuildResults buildResults,
                    com.atlassian.user.User user)
Description copied from interface: LabelManager
Add a label against a build result.

Specified by:
addLabel in interface LabelManager
Returns:
an int identifying result of add process

removeLabel

public int removeLabel(java.lang.String labelName,
                       BuildResults buildResults,
                       com.atlassian.user.User user)
Description copied from interface: LabelManager
Removes a label against a build result. Will delete the Label entity if there are no more build results tied to it.

Specified by:
removeLabel in interface LabelManager
Returns:
an int identifying result of delete process

findBuildResultsSummaryByLabel

public java.util.List findBuildResultsSummaryByLabel(java.lang.String labelName)
Description copied from interface: LabelManager
Finds all BuildResultsSummary labelled with given labelname

Specified by:
findBuildResultsSummaryByLabel in interface LabelManager
Returns:
List of BuildResultsSummary

isFavourite

public boolean isFavourite(Build build,
                           com.atlassian.user.User user)
Description copied from interface: LabelManager
Determins if the build is a user's favourite

Specified by:
isFavourite in interface LabelManager
Returns:
boolean yes or no

isManuallyUnmarkedFavourite

public boolean isManuallyUnmarkedFavourite(Build build,
                                           com.atlassian.user.User user)
Description copied from interface: LabelManager
Flag which determines if the user has manually unmarked this build as favourite.

Specified by:
isManuallyUnmarkedFavourite in interface LabelManager
Returns:
boolean flag

addFavourite

public int addFavourite(Build build,
                        com.atlassian.user.User user)
Description copied from interface: LabelManager
Adds a build to a user as favourite. Adds a label to the build, with namespace = user name, and label name = ":favourite".

Specified by:
addFavourite in interface LabelManager
Returns:
an int identifying result of add process

removeFavourite

public int removeFavourite(Build build,
                           com.atlassian.user.User user)
Description copied from interface: LabelManager
Removes a build from a user's favourite. Removes labelling object, where namespace = user name, and label name=":favourite".

Specified by:
removeFavourite in interface LabelManager
Returns:
an int identifying result of removal process

findLabels

public java.util.List findLabels()
Description copied from interface: LabelManager
Finds all labels with namespace = 'label', and maxResults set to 200

Specified by:
findLabels in interface LabelManager
Returns:
List of LabelCount objects, mapping a Label to count of occurances.

findLabels

public java.util.List findLabels(java.lang.String namespace,
                                 int maxResults)
Description copied from interface: LabelManager
Finds all labels given namespace, and maxResults

Specified by:
findLabels in interface LabelManager
Returns:
List of LabelCount objects, mapping a Label to count of occurances.

findLabels

public java.util.List findLabels(java.lang.String namespace,
                                 int maxResults,
                                 Build build)
Description copied from interface: LabelManager
Finds all labels in a given build, with namespace and maxResults.

Specified by:
findLabels in interface LabelManager
Returns:
List of LabelCount objects, mapping (Label to count of occurances.

findLabels

public java.util.List findLabels(java.lang.String namespace,
                                 int maxResults,
                                 Project project)
Description copied from interface: LabelManager
Finds all labels in a given project, with namespace and maxResults.

Specified by:
findLabels in interface LabelManager
Returns:
List of LabelCount objects, mapping (Label to count of occurances.

addLabel

protected int addLabel(java.lang.String labelName,
                       java.lang.String namespace,
                       Project project,
                       Build build,
                       BuildResults buildResults,
                       java.lang.String userName)

removeLabel

protected int removeLabel(java.lang.String labelName,
                          java.lang.String namespace,
                          Project project,
                          Build build,
                          BuildResults buildResults,
                          java.lang.String userName)

getFavouritesForBuild

public java.util.List getFavouritesForBuild(Build build)
Description copied from interface: LabelManager
Retrieves a list of usernames which have the given build set as a favourite.

Specified by:
getFavouritesForBuild in interface LabelManager
Returns:
list of usernames (as Strings)

setLabelDao

public void setLabelDao(LabelDao labelDao)

setBuildResultsIndexer

public void setBuildResultsIndexer(BuildResultsIndexer buildResultsIndexer)


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.