Class SuggestionBoxWebManager


  • @Service
    public class SuggestionBoxWebManager
    extends Object
    • Constructor Detail

      • SuggestionBoxWebManager

        protected SuggestionBoxWebManager()
    • Method Detail

      • getSuggestionsInDraftFor

        public List<SuggestionEntity> getSuggestionsInDraftFor​(SuggestionBox suggestionBox,
                                                               org.silverpeas.core.admin.user.model.User creator)
        Gets the list of suggestions that are in draft or refused and which the creator is those specified.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        creator - the user that must be the creator of the returned suggestions.
        Returns:
        the aimed suggestion entities.
        See Also:
        SuggestionCollection.findInDraftFor(User)
      • getSuggestionsOutOfDraftFor

        public List<SuggestionEntity> getSuggestionsOutOfDraftFor​(SuggestionBox suggestionBox,
                                                                  org.silverpeas.core.admin.user.model.User creator)
        Gets the list of suggestions that are out of draft and which the creator is those specified.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        creator - the user that must be the creator of the returned suggestions.
        Returns:
        the aimed suggestion entities.
        See Also:
        SuggestionCollection.findOutOfDraftFor(User)
      • getPublishedSuggestionsFor

        public List<SuggestionEntity> getPublishedSuggestionsFor​(SuggestionBox suggestionBox,
                                                                 org.silverpeas.core.admin.user.model.User creator)
        Gets the list of suggestions that are published and which the creator is those specified.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        creator - the user that must be the creator of the returned suggestions.
        Returns:
        the aimed suggestion entities.
        See Also:
        SuggestionCollection.findPublishedFor(User)
      • getAllSuggestionsProposedBy

        public List<SuggestionEntity> getAllSuggestionsProposedBy​(SuggestionBox suggestionBox,
                                                                  org.silverpeas.core.admin.user.model.User creator)
        Gets the list of all the suggestions in the specified suggestion box proposed by the specified creator.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        creator - the user that must be the creator of the returned suggestions.
        Returns:
        the asked suggestion entities.
        See Also:
        SuggestionCollection.findAllProposedBy(User)
      • getSuggestionsForValidation

        public List<SuggestionEntity> getSuggestionsForValidation​(SuggestionBox suggestionBox)
        Gets the list of suggestions that are out of draft, awaiting their validation by a publisher. These suggestions are made up of those in pending validation and those refused by a publisher.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        Returns:
        the aimed suggestion entities.
      • getSuggestionsByCriteria

        public List<SuggestionEntity> getSuggestionsByCriteria​(SuggestionCriteria criteria)
        Gets the list of suggestions that match the specified criteria. The criteria are applying in web level and aren't propagated downto the business level and hence the persistence level.

        The user asking for the suggestions is required in the criteria as some caching is performed for the given user for better performance.

        Parameters:
        criteria - the criteria the suggestions to return must match.
        Returns:
        the published suggestion entities matching the specified criteria.
        See Also:
        SuggestionCollection.findPublished()
      • getAllSuggestionsFor

        public List<SuggestionEntity> getAllSuggestionsFor​(SuggestionBox suggestionBox,
                                                           org.silverpeas.core.admin.user.model.User user)
        Gets the list of all the suggestions in the specified suggestion box that a user can see.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        user - the user that requests for all suggestions.
        Returns:
        the asked suggestion entities.
        See Also:
        SuggestionCollection.findAllProposedBy(User)
      • deleteSuggestion

        public void deleteSuggestion​(SuggestionBox suggestionBox,
                                     Suggestion suggestion,
                                     org.silverpeas.core.admin.user.model.User fromUser)
        Deletes a suggestion.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        suggestion - the suggestion to delete.
        fromUser - the current user.
        See Also:
        SuggestionCollection.remove(Object)
      • publishSuggestion

        public SuggestionEntity publishSuggestion​(SuggestionBox suggestionBox,
                                                  Suggestion suggestion,
                                                  org.silverpeas.core.admin.user.model.User fromUser)
        Publishes a suggestion.
        Parameters:
        suggestionBox - the suggestion box the current user is working on.
        suggestion - the suggestion to publish.
        fromUser - the current user.
        Returns:
        the suggestion entity.
        See Also:
        SuggestionCollection.publish(Suggestion)
      • assertSuggestionIsDefined

        public static void assertSuggestionIsDefined​(Suggestion suggestion)
        Asserts the specified suggestion is well defined, otherwise an HTTP 404 error is sent back.
        Parameters:
        suggestion - the suggestion to check.
      • checkAdminAccessOrUserIsCreator

        public static void checkAdminAccessOrUserIsCreator​(org.silverpeas.core.admin.user.model.User user,
                                                           Suggestion suggestion)
        Centralization of checking if the specified user is the creator of the specified suggestion.
        Parameters:
        user - the user to verify.
        suggestion - the suggestion to check.
      • checkAdminAccessOrAdminRoleOrUserIsCreator

        public static void checkAdminAccessOrAdminRoleOrUserIsCreator​(org.silverpeas.core.admin.user.model.User user,
                                                                      Suggestion suggestion)
        Centralization of checking if the specified user is the creator of the specified suggestion.
        Parameters:
        user - the user to verify.
        suggestion - the suggestion to check.
      • checkAdminAccessOrUserIsModerator

        public static void checkAdminAccessOrUserIsModerator​(org.silverpeas.core.admin.user.model.User user,
                                                             SuggestionBox suggestionBox)
        Centralization of checking if the specified user is a moderator of the specified suggestion.
        Parameters:
        user - the user to verify.
        suggestionBox - the suggestion box the user is working on.
      • asWebEntities

        public List<SuggestionEntity> asWebEntities​(List<Suggestion> suggestions)
        Converts the list of suggestion into list of suggestion web entities.
        Parameters:
        suggestions - the suggestions to convert.
        Returns:
        the suggestion web entities.
      • asWebEntity

        public SuggestionEntity asWebEntity​(Suggestion suggestion)
        Converts the suggestion into its corresponding web entity. If the specified suggestion isn't defined, then an HTTP 404 error is sent back instead of the entity representation of the suggestion.
        Parameters:
        suggestion - the suggestion to convert.
        Returns:
        the corresponding suggestion entity.