Class PlanFavouriteServiceImpl

    • Constructor Detail

      • PlanFavouriteServiceImpl

        public PlanFavouriteServiceImpl​(LabelManager labelManager)
    • Method Detail

      • isFavourite

        public boolean isFavourite​(@NotNull
                                   @NotNull ImmutablePlan plan,
                                   @Nullable
                                   @Nullable com.atlassian.user.User user)
        Description copied from interface: PlanFavouriteService
        Test if plan is set as favourite for a user.
        Specified by:
        isFavourite in interface PlanFavouriteService
        Parameters:
        plan - Plan to be tested
        user - User whose favourite plans would be examined
        Returns:
        True if plan is marked as favourite for a user, false otherwise.
      • addFavourite

        public int addFavourite​(@NotNull
                                @NotNull Plan plan,
                                @Nullable
                                @Nullable com.atlassian.user.User user,
                                boolean honourManuallyUnmarked)
        Description copied from interface: PlanFavouriteService
        Mark plan as a favourite for a user. If the honourManuallyUnmarked flag is set, plan is verified if it is not "manually marked not favourite". If the latter is true then plan is not marked favourite.
        Specified by:
        addFavourite in interface PlanFavouriteService
        Parameters:
        plan - Plan to be marked as a favourite
        user - User whose favourites will be modified
        honourManuallyUnmarked - If this flag is set then additional check is per
        Returns:
        Status of operation as specified in LabelManager
      • removeFavourite

        public int removeFavourite​(@NotNull
                                   @NotNull Plan plan,
                                   @Nullable
                                   @Nullable com.atlassian.user.User user)
        Description copied from interface: PlanFavouriteService
        Remove plan from the user's favourite list and mark it "manually marked not favourite"
        Specified by:
        removeFavourite in interface PlanFavouriteService
        Parameters:
        plan - Plan to be marked as a favourite
        user - User whose favourites will be modified
        Returns:
        Status of operation as specified in LabelManager
      • toggleFavourite

        public int toggleFavourite​(@NotNull
                                   @NotNull Plan plan,
                                   @Nullable
                                   @Nullable com.atlassian.user.User user)
        Description copied from interface: PlanFavouriteService
        Toggle the plan's favourite status for a user. Depending on the current 'favourite' status either addFavourite or removeFavourite is executed internally. This operation was pulled to this service to make it atomic.
        Specified by:
        toggleFavourite in interface PlanFavouriteService
        Parameters:
        plan - Plan which favourite status will be set/cleared
        user - User whose favourites will be modified
        Returns:
        Status of operation as specified in LabelManager