ccc.domain
Class CommentEntity

java.lang.Object
  extended by ccc.domain.Entity
      extended by ccc.domain.CommentEntity
All Implemented Interfaces:
Jsonable, java.io.Serializable

public class CommentEntity
extends Entity

A user comment. FIXME: email can be NULL.

Author:
Civic Computing Ltd.
See Also:
Serialized Form

Constructor Summary
protected CommentEntity()
          Constructor: for persistence only.
  CommentEntity(ResourceEntity resource, java.lang.String body, java.lang.String author)
          Constructor.
 
Method Summary
 Comment createDto()
          Create a DTO for this comment.
 java.lang.String getAuthor()
          Accessor.
 java.lang.String getBody()
          Accessor.
 EmailAddress getEmail()
          Accessor.
 ResourceEntity getResource()
          Accessor.
 CommentStatus getStatus()
          Accessor.
 java.util.Date getTimestamp()
          Accessor.
 java.net.URL getUrl()
          Accessor.
static java.util.List<Comment> map(java.util.List<CommentEntity> comments)
          Map a list of comments to a list of comment DTOs.
 void setAuthor(java.lang.String author)
          Mutator.
 void setBody(java.lang.String body)
          Mutator.
 void setEmail(EmailAddress email)
          Mutator.
 void setStatus(CommentStatus status)
          Mutator.
 void setUrl(java.net.URL url)
          Mutator.
 
Methods inherited from class ccc.domain.Entity
equals, getId, getVersion, hashCode, setId, toJson, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommentEntity

protected CommentEntity()
Constructor: for persistence only.


CommentEntity

public CommentEntity(ResourceEntity resource,
                     java.lang.String body,
                     java.lang.String author)
Constructor.

Parameters:
resource - The resource this comment refers to.
body - The comment's body content.
author - The comment's author.
Method Detail

getBody

public java.lang.String getBody()
Accessor.

Returns:
The comment's body, as a string.

setBody

public final void setBody(java.lang.String body)
Mutator.

Parameters:
body - The body to set.

getResource

public ResourceEntity getResource()
Accessor.

Returns:
The comment's resource.

getAuthor

public java.lang.String getAuthor()
Accessor.

Returns:
The comment's author.

setAuthor

public final void setAuthor(java.lang.String author)
Mutator.

Parameters:
author - The author to set.

setUrl

public void setUrl(java.net.URL url)
Mutator.

Parameters:
url - The comment's URL, the URL may be NULL.

getUrl

public java.net.URL getUrl()
Accessor.

Returns:
The comment's URL, the URL may be NULL.

getTimestamp

public java.util.Date getTimestamp()
Accessor.

Returns:
The comment's timestamp, as a date.

getStatus

public final CommentStatus getStatus()
Accessor.

Returns:
Returns the status.

setStatus

public final void setStatus(CommentStatus status)
Mutator.

Parameters:
status - The status to set.

getEmail

public final EmailAddress getEmail()
Accessor.

Returns:
Returns the email.

setEmail

public final void setEmail(EmailAddress email)
Mutator.

Parameters:
email - The email to set.

createDto

public Comment createDto()
Create a DTO for this comment.

Returns:
A DTO representing this comment.

map

public static java.util.List<Comment> map(java.util.List<CommentEntity> comments)
Map a list of comments to a list of comment DTOs.

Parameters:
comments - The comments to map.
Returns:
The corresponding DTOs.


Copyright © 2010. All Rights Reserved.