Package com.atlassian.bamboo.labels
Interface LabelManager
-
- All Known Implementing Classes:
LabelManagerImpl
public interface LabelManager
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUILDRESULT_LABEL_NAMESPACE
Not really accurately named.static int
DEFAULT_MAX_RESULTS
static String
FAVOURITE_LABEL_NAME
static String
FAVOURITE_UNMARK_LABEL_NAME
static int
LABEL_ADDED_TO_BUILD_RESULT
static int
LABEL_CREATED
static int
LABEL_DELETED
static int
LABEL_REMOVED_FROM_BUILD_RESULT
static int
NO_CHANGE
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description int
addFavourite(Plan plan, com.atlassian.user.User user)
Adds a build to a user as favourite.int
addLabel(@Nullable String labelName, @Nullable PlanKey planKey, @Nullable com.atlassian.user.User user)
Creates a normal label for a planint
addLabel(@Nullable String labelName, @Nullable PlanResultKey planResultKey, @Nullable com.atlassian.user.User user)
Add a label against a build result.boolean
addLabels(List<String> labelNames, @Nullable PlanKey planKey, @Nullable com.atlassian.user.User user)
Creates multiple normal labels for a plan@NotNull List<ResultsSummary>
findBuildResultsSummaryByLabel(String labelName)
Finds allResultsSummary
labelled with given labelname@NotNull List<LabelCount>
findLabels(@NotNull String namespace, int maxResults, @Nullable Plan plan, @Nullable Project project)
Finds all labels in a given build, with namespace and maxResults.@NotNull Set<Label>
getAllPlanLabels()
All labels used on a plan levelList<String>
getFavouritesForPlan(ImmutablePlan plan)
Retrieves a list of usernames which have the given plan set as a favourite.List<String>
getFavouritesForPlan(Plan plan)
Deprecated.since 5.4 usegetFavouritesForPlan(com.atlassian.bamboo.plan.cache.ImmutablePlan)
insteadCollection<Label>
getLabelsByName(List<String> labelNames)
Gets list of labels based on label namesSet<Label>
getPlanLabels(@NotNull ImmutablePlan plan)
Get labels defined for a planboolean
hasBuildResultsLabel(ResultsSummary buildResultsSummary, String label)
Checks whether the build results summary has a particular labelboolean
hasPlanLabel(Plan plan, String label)
Checks whether the Plan has a particular labelboolean
isFavourite(ImmutablePlan plan, com.atlassian.user.User user)
Determines if the build is a user's favourite Note that its more efficient to usePlanManager.filterFavouritedPlans(java.util.Collection, com.atlassian.user.User)
if you are performing this operation over a collection ofPlan
sboolean
isManuallyUnmarkedFavourite(@NotNull Plan plan, @Nullable com.atlassian.user.User user)
Flag which determines if the user has manually unmarked this build as favourite.int
removeFavourite(@NotNull Plan plan, @Nullable com.atlassian.user.User user)
Removes a build from a user's favourite.int
removeLabel(@Nullable String labelName, @Nullable PlanKey planKey, @Nullable com.atlassian.user.User user)
Remove the standard label for a plan (not all the labels for that plan)int
removeLabel(String labelName, PlanResultKey planResultKey, com.atlassian.user.User user)
Removes a label against a build result.void
saveLabelling(Labelling labelling)
Saves a specific labelling - does not do any validation or checking.
-
-
-
Field Detail
-
NO_CHANGE
static final int NO_CHANGE
- See Also:
- Constant Field Values
-
LABEL_CREATED
static final int LABEL_CREATED
- See Also:
- Constant Field Values
-
LABEL_ADDED_TO_BUILD_RESULT
static final int LABEL_ADDED_TO_BUILD_RESULT
- See Also:
- Constant Field Values
-
LABEL_DELETED
static final int LABEL_DELETED
- See Also:
- Constant Field Values
-
LABEL_REMOVED_FROM_BUILD_RESULT
static final int LABEL_REMOVED_FROM_BUILD_RESULT
- See Also:
- Constant Field Values
-
BUILDRESULT_LABEL_NAMESPACE
static final String BUILDRESULT_LABEL_NAMESPACE
Not really accurately named. Used for all labels types- See Also:
- Constant Field Values
-
FAVOURITE_LABEL_NAME
static final String FAVOURITE_LABEL_NAME
- See Also:
- Constant Field Values
-
FAVOURITE_UNMARK_LABEL_NAME
static final String FAVOURITE_UNMARK_LABEL_NAME
- See Also:
- Constant Field Values
-
DEFAULT_MAX_RESULTS
static final int DEFAULT_MAX_RESULTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
addLabel
int addLabel(@Nullable @Nullable String labelName, @Nullable @Nullable PlanResultKey planResultKey, @Nullable @Nullable com.atlassian.user.User user)
Add a label against a build result.- Parameters:
labelName
-planResultKey
-user
-- Returns:
- an
int
identifying result of add process
-
removeLabel
int removeLabel(String labelName, PlanResultKey planResultKey, com.atlassian.user.User user)
Removes a label against a build result. Will delete the Label entity if there are no more build results tied to it.- Parameters:
labelName
-planResultKey
-user
-- Returns:
- an
int
identifying result of delete process
-
findBuildResultsSummaryByLabel
@NotNull @NotNull List<ResultsSummary> findBuildResultsSummaryByLabel(String labelName)
Finds allResultsSummary
labelled with given labelname- Parameters:
labelName
-- Returns:
List
ofResultsSummary
-
findLabels
@NotNull @NotNull List<LabelCount> findLabels(@NotNull @NotNull String namespace, int maxResults, @Nullable @Nullable Plan plan, @Nullable @Nullable Project project)
Finds all labels in a given build, with namespace and maxResults.- Parameters:
namespace
-maxResults
-plan
-project
-- Returns:
List
ofLabelCount
objects, mapping (Label
to count of occurrences.
-
addFavourite
int addFavourite(Plan plan, com.atlassian.user.User user)
Adds a build to a user as favourite. Adds a label to the build, with namespace = user name, and label name = ":favourite".- Parameters:
plan
-user
-- Returns:
- an
int
identifying result of add process
-
removeFavourite
int removeFavourite(@NotNull @NotNull Plan plan, @Nullable @Nullable com.atlassian.user.User user)
Removes a build from a user's favourite. Removes labelling object, where namespace = user name, and label name=":favourite".- Parameters:
plan
-user
-- Returns:
- an
int
identifying result of removal process
-
isFavourite
boolean isFavourite(ImmutablePlan plan, com.atlassian.user.User user)
Determines if the build is a user's favourite Note that its more efficient to usePlanManager.filterFavouritedPlans(java.util.Collection, com.atlassian.user.User)
if you are performing this operation over a collection ofPlan
s- Parameters:
plan
-user
-- Returns:
boolean
yes or no
-
isManuallyUnmarkedFavourite
boolean isManuallyUnmarkedFavourite(@NotNull @NotNull Plan plan, @Nullable @Nullable com.atlassian.user.User user)
Flag which determines if the user has manually unmarked this build as favourite.- Parameters:
plan
-user
-- Returns:
boolean
flag
-
getFavouritesForPlan
List<String> getFavouritesForPlan(ImmutablePlan plan)
Retrieves a list of usernames which have the given plan set as a favourite.- Parameters:
plan
-- Returns:
- list of usernames (as Strings)
-
getFavouritesForPlan
@Deprecated List<String> getFavouritesForPlan(Plan plan)
Deprecated.since 5.4 usegetFavouritesForPlan(com.atlassian.bamboo.plan.cache.ImmutablePlan)
instead
-
hasBuildResultsLabel
boolean hasBuildResultsLabel(ResultsSummary buildResultsSummary, String label)
Checks whether the build results summary has a particular label- Parameters:
buildResultsSummary
-label
- . could be empty- Returns:
- Returns true if there is a label object within the correct namespace and a labelling for the
ResultsSummary
-
hasPlanLabel
boolean hasPlanLabel(Plan plan, String label)
Checks whether the Plan has a particular label- Parameters:
plan
-label
- . could be empty- Returns:
- Returns true if there is a label object within the correct namespace and a labelling for the
Plan
-
getLabelsByName
Collection<Label> getLabelsByName(List<String> labelNames)
Gets list of labels based on label names- Parameters:
labelNames
-- Returns:
- list of labels for all existing labels specified in parameter
-
saveLabelling
void saveLabelling(Labelling labelling)
Saves a specific labelling - does not do any validation or checking. If not sure - please use addLabel or addFavourite instead- Parameters:
labelling
- to save
-
addLabel
int addLabel(@Nullable @Nullable String labelName, @Nullable @Nullable PlanKey planKey, @Nullable @Nullable com.atlassian.user.User user)
Creates a normal label for a plan- Parameters:
labelName
-planKey
-user
-- Returns:
-
addLabels
boolean addLabels(List<String> labelNames, @Nullable @Nullable PlanKey planKey, @Nullable @Nullable com.atlassian.user.User user)
Creates multiple normal labels for a plan- Parameters:
labelNames
-planKey
-user
-- Returns:
-
removeLabel
int removeLabel(@Nullable @Nullable String labelName, @Nullable @Nullable PlanKey planKey, @Nullable @Nullable com.atlassian.user.User user)
Remove the standard label for a plan (not all the labels for that plan)- Parameters:
labelName
-planKey
-user
-- Returns:
-
getAllPlanLabels
@NotNull @NotNull Set<Label> getAllPlanLabels()
All labels used on a plan level- Returns:
- Set of
Label
related to any plan
-
getPlanLabels
Set<Label> getPlanLabels(@NotNull @NotNull ImmutablePlan plan)
Get labels defined for a plan
-
-