Class LabelManagerImpl

  • All Implemented Interfaces:
    LabelManager

    public class LabelManagerImpl
    extends Object
    implements LabelManager
    This manager is not transactional but is thread safe
    • Method Detail

      • saveLabelling

        public void saveLabelling​(Labelling labelling)
        Description copied from interface: LabelManager
        Saves a specific labelling - does not do any validation or checking. If not sure - please use addLabel or addFavourite instead
        Specified by:
        saveLabelling in interface LabelManager
        Parameters:
        labelling - to save
      • addLabel

        public int addLabel​(@Nullable
                            @Nullable String labelName,
                            @Nullable
                            @Nullable PlanResultKey planResultKey,
                            @Nullable
                            @Nullable 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
      • addLabel

        public int addLabel​(@Nullable
                            @Nullable String labelName,
                            @Nullable
                            @Nullable PlanKey planKey,
                            @Nullable
                            @Nullable com.atlassian.user.User user)
        Description copied from interface: LabelManager
        Creates a normal label for a plan
        Specified by:
        addLabel in interface LabelManager
        Returns:
      • addLabels

        public boolean addLabels​(List<String> labelNames,
                                 @Nullable
                                 @Nullable PlanKey planKey,
                                 @Nullable
                                 @Nullable com.atlassian.user.User user)
        Description copied from interface: LabelManager
        Creates multiple normal labels for a plan
        Specified by:
        addLabels in interface LabelManager
        Returns:
      • addFavourite

        public int addFavourite​(Plan plan,
                                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
      • removeLabel

        public int removeLabel​(String labelName,
                               @Nullable
                               @Nullable PlanResultKey planResultKey,
                               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
      • removeLabel

        public int removeLabel​(@Nullable
                               @Nullable String labelName,
                               @Nullable
                               @Nullable PlanKey planKey,
                               @Nullable
                               @Nullable com.atlassian.user.User user)
        Description copied from interface: LabelManager
        Remove the standard label for a plan (not all the labels for that plan)
        Specified by:
        removeLabel in interface LabelManager
        Returns:
      • removeFavourite

        public int removeFavourite​(@NotNull
                                   @NotNull Plan plan,
                                   @Nullable
                                   @Nullable 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
      • hasBuildResultsLabel

        public boolean hasBuildResultsLabel​(@NotNull
                                            @NotNull ResultsSummary buildResultsSummary,
                                            @NotNull
                                            @NotNull String label)
        Description copied from interface: LabelManager
        Checks whether the build results summary has a particular label
        Specified by:
        hasBuildResultsLabel in interface LabelManager
        label - . could be empty
        Returns:
        Returns true if there is a label object within the correct namespace and a labelling for the ResultsSummary
      • hasPlanLabel

        public boolean hasPlanLabel​(@NotNull
                                    @NotNull Plan plan,
                                    @NotNull
                                    @NotNull String label)
        Description copied from interface: LabelManager
        Checks whether the Plan has a particular label
        Specified by:
        hasPlanLabel in interface LabelManager
        label - . could be empty
        Returns:
        Returns true if there is a label object within the correct namespace and a labelling for the Plan
      • isManuallyUnmarkedFavourite

        public boolean isManuallyUnmarkedFavourite​(@NotNull
                                                   @NotNull Plan plan,
                                                   @Nullable
                                                   @Nullable 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
      • getFavouritesForPlan

        @NotNull
        public @NotNull List<String> getFavouritesForPlan​(@NotNull
                                                          @NotNull ImmutablePlan plan)
        Description copied from interface: LabelManager
        Retrieves a list of usernames which have the given plan set as a favourite.
        Specified by:
        getFavouritesForPlan in interface LabelManager
        Returns:
        list of usernames (as Strings)
      • findLabels

        @NotNull
        public @NotNull List<LabelCount> findLabels​(@NotNull
                                                    @NotNull String namespace,
                                                    int maxResults,
                                                    @Nullable
                                                    @Nullable Plan plan,
                                                    @Nullable
                                                    @Nullable Project project)
        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 occurrences.
      • addLabel

        protected int addLabel​(@NotNull
                               @NotNull String labelName,
                               String namespace,
                               @Nullable
                               @Nullable Project project,
                               @Nullable
                               @Nullable Plan plan,
                               @Nullable
                               @Nullable ResultsSummary resultsSummary,
                               String userName)
      • removeLabel

        protected int removeLabel​(@NotNull
                                  @NotNull String labelName,
                                  @NotNull
                                  @NotNull String namespace,
                                  @NotNull
                                  @NotNull Project project,
                                  @Nullable
                                  @Nullable ImmutablePlan plan,
                                  @Nullable
                                  @Nullable ResultsSummary resultsSummary)