Class Suggestion
java.lang.Object
org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<E,I>
org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<Suggestion,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>
org.silverpeas.components.suggestionbox.model.Suggestion
- All Implemented Interfaces:
Serializable,org.silverpeas.core.contribution.model.Contribution,org.silverpeas.core.contribution.model.SilverpeasContent,org.silverpeas.core.contribution.rating.model.Rateable,org.silverpeas.core.contribution.ValidableContribution,org.silverpeas.core.Identifiable,org.silverpeas.core.Instance<org.silverpeas.core.contribution.model.Contribution>,org.silverpeas.core.Nameable,org.silverpeas.core.persistence.datasource.model.Entity<Suggestion,,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier> org.silverpeas.core.persistence.datasource.model.IdentifiableEntity,org.silverpeas.core.security.Securable,org.silverpeas.core.SilverpeasResource
@Entity
public class Suggestion
extends org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity<Suggestion,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier>
implements org.silverpeas.core.contribution.ValidableContribution, org.silverpeas.core.contribution.model.SilverpeasContent, org.silverpeas.core.contribution.rating.model.Rateable
This entity represents a suggestion associated to a suggestion box. A suggestion is described by
a title and by a rich content. The rich content is managed by the
WysiwygController
object and it is not persisted into the database.- Author:
- Yohann Chastagnier
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SuggestionThe NONE suggestion.static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSuggestion(String title) Constructs a new suggestion with the specified title. -
Method Summary
Modifier and TypeMethodDescriptionstatic SuggestionGets the suggestion with the specified unique identifier.intGets the count of comments on this suggestion.Gets the identifier of the component instance which the suggestion is attached.Gets the content of this suggestion.org.silverpeas.core.contribution.model.ContributionIdentifierorg.silverpeas.core.contribution.rating.model.ContributionRatingGets the foreign suggestion box of the suggestion.getTitle()Gets the title of this suggestion.org.silverpeas.core.contribution.model.ContributionValidationbooleanIs the content of this suggestion was modified?booleanIs this suggestion defined?booleanbooleanIs this suggestion NONE?booleanisPublishableBy(org.silverpeas.core.admin.user.model.User user) Is this suggestion publishable by the specified user?voidsave()Saves the state of this suggestion so that is will persist over the current context of use.voidsetCommentCount(int count) Sets the number of comment that were posted on this suggestion.voidsetContent(String content) Sets the specified content to this suggestion.Sets the identifier of this suggestion.voidsetRating(org.silverpeas.core.contribution.rating.model.ContributionRating contributionRating) Sets the rating on the suggestion.protected voidSets the suggestion box to which this suggestion belongs.voidSets a new title to this suggestion.toString()Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.SilverpeasJpaEntity
createdBy, createdBy, createdBy, equals, getCreationDate, getCreator, getCreatorId, getLastUpdateDate, getLastUpdater, getLastUpdaterId, getVersion, hasBeenModified, hashCode, lastUpdatedBy, markAsModified, performBeforePersist, performBeforeRemove, performBeforeUpdate, setCreationDate, setCreator, setLastUpdateDate, setLastUpdater, setVersion, updatedBy, updatedByMethods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersistedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.silverpeas.core.contribution.model.Contribution
canBeAccessedBy, getModel, getName, getResourcePathMethods inherited from interface org.silverpeas.core.persistence.datasource.model.IdentifiableEntity
getId, isPersistedMethods inherited from interface org.silverpeas.core.Instance
getParentMethods inherited from interface org.silverpeas.core.security.Securable
canBeDeletedBy, canBeFiledInBy, canBeModifiedByMethods inherited from interface org.silverpeas.core.contribution.model.SilverpeasContent
getId, getSilverpeasContentIdMethods inherited from interface org.silverpeas.core.SilverpeasResource
getCreationDate, getCreator, getLastUpdateDate, getLastUpdater
-
Field Details
-
TYPE
- See Also:
-
NONE
The NONE suggestion. It represents no suggestions and it is dedicated to be used in place of null.
-
-
Constructor Details
-
Suggestion
protected Suggestion() -
Suggestion
Constructs a new suggestion with the specified title.- Parameters:
title- the suggestion title.
-
-
Method Details
-
getById
Gets the suggestion with the specified unique identifier.- Parameters:
identifier- the unique identifier of a suggestion.- Returns:
- either NONE suggestion if it exists no suggestions with the specified identifier or the asked suggestion.
-
getSuggestionBox
Gets the foreign suggestion box of the suggestion.- Returns:
- the suggestion box of the suggestion.
-
getTitle
Gets the title of this suggestion.- Specified by:
getTitlein interfaceorg.silverpeas.core.contribution.model.Contribution- Returns:
- the suggestion title.
-
setTitle
Sets a new title to this suggestion.- Parameters:
newTitle- the new title. Cannot be null or empty.
-
setContent
Sets the specified content to this suggestion.- Parameters:
content- the suggestion's content to set.
-
getContent
Gets the content of this suggestion.- Returns:
- the suggestion's content.
-
setCommentCount
public void setCommentCount(int count) Sets the number of comment that were posted on this suggestion.- Parameters:
count- the number of comments.
-
getCommentCount
public int getCommentCount()Gets the count of comments on this suggestion.- Returns:
- the number of comments.
-
getRating
public org.silverpeas.core.contribution.rating.model.ContributionRating getRating()- Specified by:
getRatingin interfaceorg.silverpeas.core.contribution.rating.model.Rateable
-
setRating
public void setRating(org.silverpeas.core.contribution.rating.model.ContributionRating contributionRating) Sets the rating on the suggestion.- Parameters:
contributionRating- the rating of the suggestion.
-
getValidation
public org.silverpeas.core.contribution.model.ContributionValidation getValidation()- Specified by:
getValidationin interfaceorg.silverpeas.core.contribution.ValidableContribution
-
isDefined
public boolean isDefined()Is this suggestion defined? It is defined if and only if it isn't NONE.- Returns:
- true if this suggestion is defined and thus not NONE.
-
isNotDefined
public boolean isNotDefined()Is this suggestion NONE?- Returns:
- true if this suggestion isn't defined and thus it is NONE.
-
save
public void save()Saves the state of this suggestion so that is will persist over the current context of use. -
setSuggestionBox
Sets the suggestion box to which this suggestion belongs.- Parameters:
box- a suggestion box.
-
isContentModified
public boolean isContentModified()Is the content of this suggestion was modified?- Returns:
- true if the suggestion's content was modified.
-
isPublishableBy
public boolean isPublishableBy(org.silverpeas.core.admin.user.model.User user) Is this suggestion publishable by the specified user?- Parameters:
user- the aimed user.- Returns:
- true if the suggestion is publishable by the specified user, false otherwise.
-
getComponentInstanceId
Gets the identifier of the component instance which the suggestion is attached.- Specified by:
getComponentInstanceIdin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent- Returns:
- the identifier of the component instance which the suggestion is attached.
-
getIdentifier
public org.silverpeas.core.contribution.model.ContributionIdentifier getIdentifier()- Specified by:
getIdentifierin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
getIdentifierin interfaceorg.silverpeas.core.contribution.model.SilverpeasContent- Specified by:
getIdentifierin interfaceorg.silverpeas.core.SilverpeasResource
-
getDescription
- Specified by:
getDescriptionin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
getDescriptionin interfaceorg.silverpeas.core.Nameable
-
getContributionType
- Specified by:
getContributionTypein interfaceorg.silverpeas.core.contribution.model.Contribution
-
isIndexable
public boolean isIndexable()- Specified by:
isIndexablein interfaceorg.silverpeas.core.contribution.model.Contribution
-
toString
-
setId
Sets the identifier of this suggestion. This method is to be used internally to avoid reflection use.- Overrides:
setIdin classorg.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity<Suggestion,org.silverpeas.core.persistence.datasource.model.identifier.UuidIdentifier> - Parameters:
id- the new unique identifier of the entity.- Returns:
- itself.
-