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 theWysiwygControllerobject and it is not persisted into the database.- Author:
- Yohann Chastagnier
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static SuggestionNONEThe NONE suggestion.static StringTYPE
-
Constructor Summary
Constructors Modifier Constructor Description protectedSuggestion()Suggestion(String title)Constructs a new suggestion with the specified title.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SuggestiongetById(String identifier)Gets the suggestion with the specified unique identifier.intgetCommentCount()Gets the count of comments on this suggestion.StringgetComponentInstanceId()Gets the identifier of the component instance which the suggestion is attached.StringgetContent()Gets the content of this suggestion.StringgetContributionType()StringgetDescription()org.silverpeas.core.contribution.model.ContributionIdentifiergetIdentifier()org.silverpeas.core.contribution.rating.model.ContributionRatinggetRating()SuggestionBoxgetSuggestionBox()Gets the foreign suggestion box of the suggestion.StringgetTitle()Gets the title of this suggestion.org.silverpeas.core.contribution.model.ContributionValidationgetValidation()booleanisContentModified()Is the content of this suggestion was modified?booleanisDefined()Is this suggestion defined?booleanisIndexable()booleanisNotDefined()Is 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.voidsetRating(org.silverpeas.core.contribution.rating.model.ContributionRating contributionRating)Sets the rating on the suggestion.protected voidsetSuggestionBox(SuggestionBox box)Sets the suggestion box to which this suggestion belongs.voidsetTitle(String newTitle)Sets a new title to this suggestion.StringtoString()-
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, updatedBy
-
Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity
getId, getNativeId, isPersisted, setId
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.contribution.model.Contribution
canBeAccessedBy, getModel, getName, getResourcePath
-
Methods inherited from interface org.silverpeas.core.persistence.datasource.model.IdentifiableEntity
getId, isPersisted
-
Methods inherited from interface org.silverpeas.core.security.Securable
canBeDeletedBy, canBeFiledInBy, canBeModifiedBy
-
-
-
-
Field Detail
-
TYPE
public static final String TYPE
- See Also:
- Constant Field Values
-
NONE
public static final Suggestion NONE
The NONE suggestion. It represents no suggestions and it is dedicated to be used in place of null.
-
-
Constructor Detail
-
Suggestion
protected Suggestion()
-
Suggestion
public Suggestion(String title)
Constructs a new suggestion with the specified title.- Parameters:
title- the suggestion title.
-
-
Method Detail
-
getById
public static Suggestion getById(String identifier)
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
public SuggestionBox getSuggestionBox()
Gets the foreign suggestion box of the suggestion.- Returns:
- the suggestion box of the suggestion.
-
getTitle
public String getTitle()
Gets the title of this suggestion.- Specified by:
getTitlein interfaceorg.silverpeas.core.contribution.model.Contribution- Returns:
- the suggestion title.
-
setTitle
public void setTitle(String newTitle)
Sets a new title to this suggestion.- Parameters:
newTitle- the new title. Cannot be null or empty.
-
setContent
public void setContent(String content)
Sets the specified content to this suggestion.- Parameters:
content- the suggestion's content to set.
-
getContent
public String 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
protected void setSuggestionBox(SuggestionBox box)
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
public String 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
public String getDescription()
- Specified by:
getDescriptionin interfaceorg.silverpeas.core.contribution.model.Contribution- Specified by:
getDescriptionin interfaceorg.silverpeas.core.Nameable
-
getContributionType
public String getContributionType()
- Specified by:
getContributionTypein interfaceorg.silverpeas.core.contribution.model.Contribution
-
isIndexable
public boolean isIndexable()
- Specified by:
isIndexablein interfaceorg.silverpeas.core.contribution.model.Contribution
-
-