ccc.domain
Class RevisionEntity<T>

java.lang.Object
  extended by ccc.domain.Entity
      extended by ccc.domain.RevisionEntity<T>
Type Parameters:
T -
All Implemented Interfaces:
Jsonable, java.io.Serializable
Direct Known Subclasses:
FileRevision, PageRevision, TemplateRevision

public abstract class RevisionEntity<T>
extends Entity

Abstract implementation of a resource revision.

Author:
Civic Computing Ltd.
See Also:
Serialized Form

Constructor Summary
protected RevisionEntity()
          Constructor: for persistence only.
protected RevisionEntity(java.util.Date timestamp, UserEntity actor, boolean majorChange, java.lang.String comment)
          Constructor.
 
Method Summary
protected abstract  T delta()
          Retrieve the revision's state.
 UserEntity getActor()
          Accessor.
 java.lang.String getComment()
          Accessor.
 java.util.Date getTimestamp()
          Accessor.
 boolean isMajorChange()
          Accessor.
 Revision mapRevision(int index)
          Create a DTO for a revision.
static java.util.List<Revision> mapRevisions(java.util.Map<java.lang.Integer,? extends RevisionEntity<?>> revisions)
          Create DTOs for a collection of revisions.
 
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

RevisionEntity

protected RevisionEntity()
Constructor: for persistence only.


RevisionEntity

protected RevisionEntity(java.util.Date timestamp,
                         UserEntity actor,
                         boolean majorChange,
                         java.lang.String comment)
Constructor.

Parameters:
timestamp - The timestamp of the revision.
actor - The user causing the change.
majorChange - The boolean flag of the major change.
comment - The comment of the revision.
Method Detail

getTimestamp

public final java.util.Date getTimestamp()
Accessor.

Returns:
Returns the timestamp.

getActor

public final UserEntity getActor()
Accessor.

Returns:
Returns the actor.

isMajorChange

public final boolean isMajorChange()
Accessor.

Returns:
Returns true if the version was a major change, false otherwise.

getComment

public final java.lang.String getComment()
Accessor.

Returns:
Returns the comment.

delta

protected abstract T delta()
Retrieve the revision's state.

Returns:
A delta describing this revision's state.

mapRevision

public Revision mapRevision(int index)
Create a DTO for a revision.

Parameters:
index - The revision's index.
Returns:
A corresponding summary.

mapRevisions

public static java.util.List<Revision> mapRevisions(java.util.Map<java.lang.Integer,? extends RevisionEntity<?>> revisions)
Create DTOs for a collection of revisions.

Parameters:
revisions - The revisions.
Returns:
The corresponding summaries.


Copyright © 2010. All Rights Reserved.