public class LabelManagerImpl extends Object implements 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 and Description |
---|
LabelManagerImpl(LabelDao labelDao,
BuildResultsIndexer buildResultsIndexer,
PlanManager planManager,
ResultsSummaryManager resultsSummaryManager,
com.atlassian.event.api.EventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
int |
addFavourite(Plan plan,
com.atlassian.user.User user)
Adds a build to a user as favourite.
|
int |
addLabel(String labelName,
PlanKey planKey,
com.atlassian.user.User user)
Creates a normal label for a plan
|
int |
addLabel(String labelName,
PlanResultKey planResultKey,
com.atlassian.user.User user)
Add a label against a build result.
|
protected int |
addLabel(String labelName,
String namespace,
Project project,
Plan plan,
PlanResultKey planResultKey,
String userName) |
boolean |
addLabels(List<String> labelNames,
PlanKey planKey,
com.atlassian.user.User user)
Creates multiple normal labels for a plan
|
List<ResultsSummary> |
findBuildResultsSummaryByLabel(String labelName)
Finds all
ResultsSummary labelled with given labelname |
List<LabelCount> |
findLabels(String namespace,
int maxResults,
Plan plan,
Project project)
Finds all labels in a given build, with namespace and maxResults.
|
Set<Label> |
getAllPlanLabels()
All labels used on a plan level
|
List<String> |
getFavouritesForPlan(ImmutablePlan plan)
Retrieves a list of usernames which have the given plan set as a favourite.
|
List<String> |
getFavouritesForPlan(Plan plan) |
Collection<Label> |
getLabelsByName(List<String> labelNames)
Gets list of labels based on label names
|
Set<Label> |
getPlanLabels(ImmutablePlan plan)
Get labels defined for a plan
|
boolean |
hasBuildResultsLabel(ResultsSummary buildResultsSummary,
String label)
Checks whether the build results summary has a particular label
|
boolean |
hasPlanLabel(Plan plan,
String label)
Checks whether the Plan has a particular label
|
boolean |
isFavourite(ImmutablePlan plan,
com.atlassian.user.User user)
Determines if the build is a user's favourite
Note that its more efficient to use
PlanManager.filterFavouritedPlans(java.util.Collection, com.atlassian.user.User)
if you are performing this operation over a collection of Plan s |
boolean |
isManuallyUnmarkedFavourite(Plan plan,
com.atlassian.user.User user)
Flag which determines if the user has manually unmarked this build as favourite.
|
int |
removeFavourite(Plan plan,
com.atlassian.user.User user)
Removes a build from a user's favourite.
|
int |
removeLabel(String labelName,
PlanKey planKey,
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.
|
protected int |
removeLabel(String labelName,
String namespace,
Project project,
ImmutablePlan plan,
PlanResultKey planResultKey,
String userName) |
void |
saveLabelling(Labelling labelling)
Saves a specific labelling - does not do any validation or checking.
|
public LabelManagerImpl(LabelDao labelDao, BuildResultsIndexer buildResultsIndexer, PlanManager planManager, ResultsSummaryManager resultsSummaryManager, com.atlassian.event.api.EventPublisher eventPublisher)
public void saveLabelling(Labelling labelling)
LabelManager
saveLabelling
in interface LabelManager
labelling
- to savepublic int addLabel(@Nullable String labelName, @Nullable PlanResultKey planResultKey, @Nullable com.atlassian.user.User user)
LabelManager
addLabel
in interface LabelManager
int
identifying result of add processpublic int addLabel(@Nullable String labelName, @Nullable PlanKey planKey, @Nullable com.atlassian.user.User user)
LabelManager
addLabel
in interface LabelManager
public boolean addLabels(List<String> labelNames, @Nullable PlanKey planKey, @Nullable com.atlassian.user.User user)
LabelManager
addLabels
in interface LabelManager
public int addFavourite(Plan plan, com.atlassian.user.User user)
LabelManager
addFavourite
in interface LabelManager
int
identifying result of add processpublic int removeLabel(String labelName, @Nullable PlanResultKey planResultKey, com.atlassian.user.User user)
LabelManager
removeLabel
in interface LabelManager
int
identifying result of delete processpublic int removeLabel(@Nullable String labelName, @Nullable PlanKey planKey, @Nullable com.atlassian.user.User user)
LabelManager
removeLabel
in interface LabelManager
@NotNull public Set<Label> getAllPlanLabels()
LabelManager
getAllPlanLabels
in interface LabelManager
Label
related to any plan@NotNull public Set<Label> getPlanLabels(@NotNull ImmutablePlan plan)
LabelManager
getPlanLabels
in interface LabelManager
plan
- Plan
to filter labels withLabel
related to the planpublic int removeFavourite(@NotNull Plan plan, @Nullable com.atlassian.user.User user)
LabelManager
removeFavourite
in interface LabelManager
int
identifying result of removal processpublic boolean hasBuildResultsLabel(@NotNull ResultsSummary buildResultsSummary, @NotNull String label)
LabelManager
hasBuildResultsLabel
in interface LabelManager
label
- . could be emptyResultsSummary
public boolean hasPlanLabel(@NotNull Plan plan, @NotNull String label)
LabelManager
hasPlanLabel
in interface LabelManager
label
- . could be emptyPlan
public Collection<Label> getLabelsByName(List<String> labelNames)
LabelManager
getLabelsByName
in interface LabelManager
@NotNull public List<ResultsSummary> findBuildResultsSummaryByLabel(@NotNull String labelName)
LabelManager
ResultsSummary
labelled with given labelnamefindBuildResultsSummaryByLabel
in interface LabelManager
List
of ResultsSummary
public boolean isFavourite(@NotNull ImmutablePlan plan, @Nullable com.atlassian.user.User user)
LabelManager
PlanManager.filterFavouritedPlans(java.util.Collection, com.atlassian.user.User)
if you are performing this operation over a collection of Plan
sisFavourite
in interface LabelManager
boolean
yes or nopublic boolean isManuallyUnmarkedFavourite(@NotNull Plan plan, @Nullable com.atlassian.user.User user)
LabelManager
isManuallyUnmarkedFavourite
in interface LabelManager
boolean
flagpublic List<String> getFavouritesForPlan(Plan plan)
getFavouritesForPlan
in interface LabelManager
@NotNull public List<String> getFavouritesForPlan(@NotNull ImmutablePlan plan)
LabelManager
getFavouritesForPlan
in interface LabelManager
@NotNull public List<LabelCount> findLabels(@NotNull String namespace, int maxResults, @Nullable Plan plan, @Nullable Project project)
LabelManager
findLabels
in interface LabelManager
project
- @return List
of LabelCount
objects, mapping (Label
to count of occurrences.protected int addLabel(@NotNull String labelName, String namespace, Project project, Plan plan, @Nullable PlanResultKey planResultKey, String userName)
protected int removeLabel(@NotNull String labelName, @NotNull String namespace, @NotNull Project project, @NotNull ImmutablePlan plan, @Nullable PlanResultKey planResultKey, @Nullable String userName)
Copyright © 2017 Atlassian Software Systems Pty Ltd. All rights reserved.