Package org.silverpeas.components.suggestionbox.model

# 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:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Suggestion`
  `NONE`
  The NONE suggestion.
  `static final String`
  `TYPE`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `Suggestion()`
  ``
  `Suggestion(String title)`
  Constructs a new suggestion with the specified title.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Suggestion`
  `getById(String identifier)`
  Gets the suggestion with the specified unique identifier.
  `int`
  `getCommentCount()`
  Gets the count of comments on this suggestion.
  `String`
  `getComponentInstanceId()`
  Gets the identifier of the component instance which the suggestion is attached.
  `String`
  `getContent()`
  Gets the content of this suggestion.
  `String`
  `getContributionType()`
  `String`
  `getDescription()`
  `org.silverpeas.core.contribution.model.ContributionIdentifier`
  `getIdentifier()`
  `org.silverpeas.core.contribution.rating.model.ContributionRating`
  `getRating()`
  `SuggestionBox`
  `getSuggestionBox()`
  Gets the foreign suggestion box of the suggestion.
  `String`
  `getTitle()`
  Gets the title of this suggestion.
  `org.silverpeas.core.contribution.model.ContributionValidation`
  `getValidation()`
  `boolean`
  `isContentModified()`
  Is the content of this suggestion was modified?
  `boolean`
  `isDefined()`
  Is this suggestion defined?
  `boolean`
  `isIndexable()`
  `boolean`
  `isNotDefined()`
  Is this suggestion NONE?
  `boolean`
  `isPublishableBy(org.silverpeas.core.admin.user.model.User user)`
  Is this suggestion publishable by the specified user?
  `void`
  `save()`
  Saves the state of this suggestion so that is will persist over the current context of use.
  `void`
  `setCommentCount(int count)`
  Sets the number of comment that were posted on this suggestion.
  `void`
  `setContent(String content)`
  Sets the specified content to this suggestion.
  `Suggestion`
  `setId(String id)`
  Sets the identifier of this suggestion.
  `void`
  `setRating(org.silverpeas.core.contribution.rating.model.ContributionRating contributionRating)`
  Sets the rating on the suggestion.
  `protected void`
  `setSuggestionBox(SuggestionBox box)`
  Sets the suggestion box to which this suggestion belongs.
  `void`
  `setTitle(String newTitle)`
  Sets a new title to this suggestion.
  `String`
  `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, updatedBy`

  ### Methods inherited from class org.silverpeas.core.persistence.datasource.model.jpa.AbstractJpaEntity

  `getId, getNativeId, isPersisted`

  ### 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.Instance

  `getParent`

  ### Methods inherited from interface org.silverpeas.core.security.Securable

  `canBeDeletedBy, canBeFiledInBy, canBeModifiedBy`

  ### Methods inherited from interface org.silverpeas.core.contribution.model.SilverpeasContent

  `getId, getSilverpeasContentId`

  ### Methods inherited from interface org.silverpeas.core.SilverpeasResource

  `getCreationDate, getCreator, getLastUpdateDate, getLastUpdater`

- ## Field Details

  - ### 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 Details

  - ### Suggestion

    protected Suggestion()

  - ### Suggestion

    public Suggestion(String title)
    Constructs a new suggestion with the specified title.
    Parameters:
      `title` - the suggestion title.

- ## Method Details

  - ### 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:
      `getTitle` in interface `org.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:
      `getRating` in interface `org.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:
      `getValidation` in interface `org.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:
      `getComponentInstanceId` in interface `org.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:
      `getIdentifier` in interface `org.silverpeas.core.contribution.model.Contribution`
    Specified by:
      `getIdentifier` in interface `org.silverpeas.core.contribution.model.SilverpeasContent`
    Specified by:
      `getIdentifier` in interface `org.silverpeas.core.SilverpeasResource`

  - ### getDescription

    public String getDescription()
    Specified by:
      `getDescription` in interface `org.silverpeas.core.contribution.model.Contribution`
    Specified by:
      `getDescription` in interface `org.silverpeas.core.Nameable`

  - ### getContributionType

    public String getContributionType()
    Specified by:
      `getContributionType` in interface `org.silverpeas.core.contribution.model.Contribution`

  - ### isIndexable

    public boolean isIndexable()
    Specified by:
      `isIndexable` in interface `org.silverpeas.core.contribution.model.Contribution`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### setId

    public Suggestion setId(String id)
    Sets the identifier of this suggestion. This method is to be used internally to avoid reflection use.
    Overrides:
      `setId` in class `org.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.