org.springframework.conversation.manager
Interface MutableConversation

All Superinterfaces:
Conversation
All Known Implementing Classes:
DefaultConversation

public interface MutableConversation
extends Conversation

This interface extends the Conversation interface and is most likely used internally to modify the conversation object. Should never be used outside of the conversation management infrastructure.

Since:
3.1
Author:
Micha Kiener

Method Summary
 void addChildConversation(MutableConversation conversation, boolean isIsolated)
          Method being invoked to add the given conversation as a child conversation to this parent conversation.
 void clear()
          Clears the state of this conversation by removing all of its attributes.
 void invalidate()
          Invalidates this conversation object.
 boolean isExpired()
          Returns true if this conversation has been expired.
 void registerDestructionCallback(String attributeName, Runnable callback)
          Registers the given callback to be invoked if the attribute having the specified name is being removed from this conversation.
 void removeChildConversation(MutableConversation conversation)
          Removes the given child conversation from this parent conversation.
 void setId(String id)
          Set the id for this conversation which must be unique within the scope the conversation objects are being stored.
 void touch()
          Reset the last access timestamp using the current time in milliseconds from the system.
 
Methods inherited from interface org.springframework.conversation.Conversation
getAttribute, getChildren, getCreationTime, getId, getLastAccessedTime, getParent, getRoot, getTimeout, isIsolated, isNested, removeAttribute, setAttribute, setTimeout
 

Method Detail

setId

void setId(String id)
Set the id for this conversation which must be unique within the scope the conversation objects are being stored. The id of the conversation objects is usually managed by the ConversationRepository.

Parameters:
id - the id of the conversation

addChildConversation

void addChildConversation(MutableConversation conversation,
                          boolean isIsolated)
Method being invoked to add the given conversation as a child conversation to this parent conversation. If isIsolated is true, the state of the child conversation is isolated from its parent state, if it is set to false, the child conversation will inherit the state from its parent.

Parameters:
conversation - the conversation to be added as a child to this parent conversation
isIsolated - flag indicating whether this conversation should be isolated from the given parent conversation

removeChildConversation

void removeChildConversation(MutableConversation conversation)
Removes the given child conversation from this parent conversation.

Parameters:
conversation - the conversation to be removed from this one

touch

void touch()
Reset the last access timestamp using the current time in milliseconds from the system. This is usually done if a conversation is used behind a scope and beans are being accessed or added to it.


clear

void clear()
Clears the state of this conversation by removing all of its attributes. It will, however, not invalidate the conversation. All attributes having a destruction callback being registered will fire, if the underlying ConversationRepository supports destruction callbacks.


isExpired

boolean isExpired()
Returns true if this conversation has been expired. The expiration time (timeout) is only managed on the root conversation and is valid for the whole conversation hierarchy.

Returns:
true if this conversation has been expired, false otherwise

invalidate

void invalidate()
Invalidates this conversation object. An invalidated conversation will throw an IllegalStateException, if it is accessed or modified.


registerDestructionCallback

void registerDestructionCallback(String attributeName,
                                 Runnable callback)
Registers the given callback to be invoked if the attribute having the specified name is being removed from this conversation. Supporting destruction callbacks is dependant of the underlying ConversationRepository, so this operation is optional and might not be supported.

Parameters:
attributeName - the name of the attribute to register the destruction callback for
callback - the callback to be invoked if the specified attribute is removed from this conversation