ccc.domain
Class HistoricalResource<S,T extends RevisionEntity<S>>

java.lang.Object
  extended by ccc.domain.Entity
      extended by ccc.domain.ResourceEntity
          extended by ccc.domain.HistoricalResource<S,T>
Type Parameters:
T - The type of revision this class supports.
S - The type of delta the revision supports.
All Implemented Interfaces:
Lockable, SnapshotSupport<Resource>, Jsonable, java.io.Serializable
Direct Known Subclasses:
TemplateEntity, WorkingCopySupport

public abstract class HistoricalResource<S,T extends RevisionEntity<S>>
extends ResourceEntity

A resource that records each update made over time.

Author:
Civic Computing Ltd.
See Also:
Serialized Form

Constructor Summary
protected HistoricalResource()
          Constructor: for persistence only.
 
Method Summary
protected  void addRevision(T revision)
          Add a new revision for this resource.
 T currentRevision()
          Retrieve the current revision.
 int currentRevisionNo()
          Retrieve the current revision number.
 T revision(int i)
          Retrieve the specified revision.
 java.util.HashMap<java.lang.Integer,T> revisions()
          Accessor.
 void toJson(Json json)
          Convert to JSON.
 
Methods inherited from class ccc.domain.ResourceEntity
addGroupPermission, addMetadata, addMetadatum, addUserPermission, as, canUnlock, clearGroupAcl, clearMetadata, clearMetadatum, clearUserAcl, computeCache, computeMetadata, computeTemplate, confirmLock, delete, getAbsolutePath, getAcl, getCacheDuration, getChangedBy, getCreatedBy, getDateChanged, getDateCreated, getDescription, getGroupAcl, getIndex, getLockedBy, getMetadata, getMetadatum, getName, getParent, getPublishedBy, getRoot, getTags, getTemplate, getTitle, getType, getUserAcl, isDeleted, isIncludedInMainMenu, isIndexable, isLocked, isPublished, isReadableBy, isSecure, isVisible, isWriteableBy, lock, mapResource, mapResources, publish, setCacheDuration, setDateChanged, setDateCreated, setDescription, setDtoProps, setIncludedInMainMenu, setIndexPosition, setName, setTags, setTemplate, setTitle, undelete, unlock, unpublish
 
Methods inherited from class ccc.domain.Entity
equals, getId, getVersion, hashCode, setId, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ccc.domain.SnapshotSupport
forCurrentRevision, forSpecificRevision, forWorkingCopy
 

Constructor Detail

HistoricalResource

protected HistoricalResource()
Constructor: for persistence only.

Method Detail

currentRevision

public T currentRevision()
Retrieve the current revision.

Returns:
The revision corresponding to the current version.

currentRevisionNo

public int currentRevisionNo()
Retrieve the current revision number.

Returns:
The revision number corresponding to the current version.

revision

public T revision(int i)
Retrieve the specified revision.

Parameters:
i - The revision number.
Returns:
The revision corresponding to the specified version.

addRevision

protected void addRevision(T revision)
Add a new revision for this resource.

Parameters:
revision - The revision to add.

revisions

public java.util.HashMap<java.lang.Integer,T> revisions()
Accessor.

Returns:
The revisions for this resource.

toJson

public void toJson(Json json)
Convert to JSON.

Specified by:
toJson in interface Jsonable
Overrides:
toJson in class ResourceEntity
Parameters:
json - The JSON object to write to.


Copyright © 2010. All Rights Reserved.