Class SuggestionBoxWebManager
- java.lang.Object
-
- org.silverpeas.components.suggestionbox.common.SuggestionBoxWebManager
-
@Service public class SuggestionBoxWebManager extends Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SuggestionBoxWebManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SuggestionEntity
approveSuggestion(SuggestionBox suggestionBox, Suggestion suggestion, String validationComment, org.silverpeas.core.admin.user.model.User fromUser)
Approves a suggestion.static void
assertSuggestionIsDefined(Suggestion suggestion)
Asserts the specified suggestion is well defined, otherwise an HTTP 404 error is sent back.List<SuggestionEntity>
asWebEntities(List<Suggestion> suggestions)
Converts the list of suggestion into list of suggestion web entities.SuggestionEntity
asWebEntity(Suggestion suggestion)
Converts the suggestion into its corresponding web entity.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.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.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.void
deleteSuggestion(SuggestionBox suggestionBox, Suggestion suggestion, org.silverpeas.core.admin.user.model.User fromUser)
Deletes a suggestion.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.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.List<SuggestionEntity>
getPublishedSuggestions(SuggestionBox suggestionBox)
Gets the list of suggestions that are published.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.List<SuggestionEntity>
getSuggestionsByCriteria(SuggestionCriteria criteria)
Gets the list of suggestions that match the specified criteria.List<SuggestionEntity>
getSuggestionsForValidation(SuggestionBox suggestionBox)
Gets the list of suggestions that are out of draft, awaiting their validation by a publisher.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.List<SuggestionEntity>
getSuggestionsInPendingValidation(SuggestionBox suggestionBox)
Gets the list of suggestions that are in pending validation and which.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.SuggestionEntity
publishSuggestion(SuggestionBox suggestionBox, Suggestion suggestion, org.silverpeas.core.admin.user.model.User fromUser)
Publishes a suggestion.SuggestionEntity
refuseSuggestion(SuggestionBox suggestionBox, Suggestion suggestion, String validationComment, org.silverpeas.core.admin.user.model.User fromUser)
Refuses a suggestion.
-
-
-
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)
-
getSuggestionsInPendingValidation
public List<SuggestionEntity> getSuggestionsInPendingValidation(SuggestionBox suggestionBox)
Gets the list of suggestions that are in pending validation and which.- Parameters:
suggestionBox
- the suggestion box the current user is working on.- Returns:
- the aimed suggestion entities.
- See Also:
SuggestionCollection.findPendingValidation()
-
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()
-
getPublishedSuggestions
public List<SuggestionEntity> getPublishedSuggestions(SuggestionBox suggestionBox)
Gets the list of suggestions that are published.- Parameters:
suggestionBox
- the suggestion box the current user is working on.- Returns:
- the published suggestion entities.
- 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)
-
approveSuggestion
public SuggestionEntity approveSuggestion(SuggestionBox suggestionBox, Suggestion suggestion, String validationComment, org.silverpeas.core.admin.user.model.User fromUser)
Approves a suggestion.- Parameters:
suggestionBox
- the suggestion box the current user is working on.suggestion
- the suggestion to approve.validationComment
- the comment associated to the approval.fromUser
- the current user.- Returns:
- the suggestion entity.
- See Also:
validateSuggestion(SuggestionBox, Suggestion, ContributionStatus, String, User)
-
refuseSuggestion
public SuggestionEntity refuseSuggestion(SuggestionBox suggestionBox, Suggestion suggestion, String validationComment, org.silverpeas.core.admin.user.model.User fromUser)
Refuses a suggestion.- Parameters:
suggestionBox
- the suggestion box the current user is working on.suggestion
- the suggestion to refuse.validationComment
- the comment associated to the refusal.fromUser
- the current user.- Returns:
- the suggestion entity.
- See Also:
validateSuggestion(SuggestionBox, Suggestion, ContributionStatus, String, User)
-
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.
-
-