org.apache.myfaces.orchestra.conversation.versioning
Class VersioningConversation

java.lang.Object
  extended by org.apache.myfaces.orchestra.conversation.Conversation
      extended by org.apache.myfaces.orchestra.conversation.versioning.VersioningConversation

public class VersioningConversation
extends org.apache.myfaces.orchestra.conversation.Conversation

A special kind of conversation which provides snapshot- and rollback functionality. Both commands can be triggered from within a version scoped managed-bean.

A typical usecase may be a multi-edit page whith different levels of edit-/cancel actions on a hierarchical tree of objects. (e.g. Company -> persons -> addresses)

Triggering a snapshot will "copy" the whole conversational data, means all the beans which are currently located in this conversation. The "copy" process currently only supports serializing SerializingConversationDataHolder, cloning maybe added in future versions. Triggering snapshots should be done with care, since it adds some overhead to memory and is therefore no that well scaleable.


Constructor Summary
VersioningConversation(org.apache.myfaces.orchestra.conversation.ConversationContext conversationContext, String name, org.apache.myfaces.orchestra.conversation.ConversationFactory factory, String strategy)
           
 
Method Summary
 void clearAllSavePoints()
          Frees all SavePoints and versioned conversational data
 SavePoint createSavePoint()
          Creates a snapshot of the actual conversational data.
 void createSavePoint(String savePointName)
          Creates a snapshot of the actual conversational data.
 void revertToLastSavePoint()
          Reverts to the last snapshot.
 void revertToSavePoint(SavePoint savePoint)
          Reverts to the given snapshot (SavePoint).
 void revertToSavePoint(String savePointName)
          Reverts to a snapshot via the given SavePoint name.
 
Methods inherited from class org.apache.myfaces.orchestra.conversation.Conversation
addAspect, bind, checkValid, destroy, getAspect, getAttribute, getBeans, getCurrentInstance, getFactory, getLastAccess, getName, hasAttribute, invalidate, invalidateAndRestart, isInvalid, removeAttribute, setAttribute, setBeans, setBinder, touch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersioningConversation

public VersioningConversation(org.apache.myfaces.orchestra.conversation.ConversationContext conversationContext,
                              String name,
                              org.apache.myfaces.orchestra.conversation.ConversationFactory factory,
                              String strategy)
Method Detail

createSavePoint

public SavePoint createSavePoint()
Creates a snapshot of the actual conversational data. Should be held inside the managed-bean for later rollback reference.

Does NOT add any overhead directly to the managed-bean. It represents just a placeholder.

Returns:
SavePoint a placeholder for a current snaphsot

createSavePoint

public void createSavePoint(String savePointName)
Creates a snapshot of the actual conversational data.

Parameters:
savePointName - The name of the snapshot; Should be "remembered" for later rollback references.

revertToSavePoint

public void revertToSavePoint(SavePoint savePoint)
Reverts to the given snapshot (SavePoint). Seeks the snapshot, gets the corresponding data, restores it and frees it out of the memory.


revertToSavePoint

public void revertToSavePoint(String savePointName)
Reverts to a snapshot via the given SavePoint name.


revertToLastSavePoint

public void revertToLastSavePoint()
Reverts to the last snapshot.


clearAllSavePoints

public void clearAllSavePoints()
Frees all SavePoints and versioned conversational data



Copyright © 2012 The Apache Software Foundation. All Rights Reserved.