biz.hammurapi.web.interaction
Class InteractionInstance

java.lang.Object
  extended bybiz.hammurapi.sql.DatabaseObject
      extended bybiz.hammurapi.web.interaction.sql.InteractionInstanceImpl
          extended bybiz.hammurapi.web.interaction.InteractionInstance
All Implemented Interfaces:
biz.hammurapi.util.Attributable, java.lang.Cloneable, biz.hammurapi.sql.columns.ColumnChangeListener, biz.hammurapi.config.Context, biz.hammurapi.config.ContextConfigurable, biz.hammurapi.sql.DataAccessObject, biz.hammurapi.config.DomConfigurable, biz.hammurapi.xml.dom.DomSerializable, biz.hammurapi.sql.IDatabaseObject, biz.hammurapi.web.interaction.sql.InteractionInstance, biz.hammurapi.util.Observable, java.io.Serializable, biz.hammurapi.util.Versioned, biz.hammurapi.util.Visitable

public class InteractionInstance
extends biz.hammurapi.web.interaction.sql.InteractionInstanceImpl
implements biz.hammurapi.sql.DataAccessObject, biz.hammurapi.util.Visitable

Represents interaction instance.

Author:
Pavel Vlasov
See Also:
Serialized Form

Nested Class Summary
 class InteractionInstance.StepInstance
          Step instance
 class InteractionInstance.TransitionInstance
           
 
Field Summary
 
Fields inherited from class biz.hammurapi.web.interaction.sql.InteractionInstanceImpl
ExitUrl, FinishTime, Id, InteractionId, IsFinished, Owner, PropertySet, StartTime, Status, StepId
 
Fields inherited from class biz.hammurapi.sql.DatabaseObject
columns, objectVersion, originalVersion
 
Constructor Summary
InteractionInstance()
          Default constructor
InteractionInstance(boolean force)
           
InteractionInstance(java.sql.ResultSet rs)
           
 
Method Summary
 boolean accept(biz.hammurapi.util.Visitor visitor)
           
 void after(java.util.Map context)
          Executes after code.
 void completed(java.lang.Integer stepId, java.util.Map context, java.lang.String userId)
          Marks step as completed, evaluates transitions from it and new step instances.
 void delete()
           
 InteractionFactory.InteractionDefinition getDefinition()
           
 InteractionFactory getFactory()
           
 int getNextSeqId()
           
 InteractionInstance.StepInstance getOwnerStep()
           
 PropertySet getProperties()
          Creates property set or retrieves it from the database.
 java.lang.Object getProperty(java.lang.String name)
          Convenience method to retrieve interaction instance properties.
 InteractionInstance.StepInstance getStep(int id)
           
 InteractionInstance.StepInstance getStep(java.lang.String[] status)
          Traverses steps tree.
 InteractionInstance.StepInstance getStepByDefinitionName(java.lang.String defName)
          Returns single step with given step definition name.
 InteractionInstance.StepInstance getStepByStatus(java.lang.String status)
          Returns first step in given status
 java.util.Collection getStepsByDefinitionName(java.lang.String defName)
          Returns single step with given step definition name.
 java.util.Collection getStepsByDefinitionNameAndStatus(java.lang.String defName, java.lang.String status)
          Returns steps with given step definition name and status.
 InteractionInstance.TransitionInstance getTransition(int id)
           
 void invalidate()
          Indicates that steps and transitions information shall be reloaded.
 void setFactory(InteractionFactory factory)
           
 void setSQLProcessor(biz.hammurapi.sql.SQLProcessor processor)
          Loads child objects
 void toDom(org.w3c.dom.Element holder)
           
static java.util.Collection tokenize(java.lang.Object obj)
          Converts object into collection of tokens according to the following rules: a) If object is Iterator then each next() return value becomes a token.
 void update()
          Updates step information in the database
 
Methods inherited from class biz.hammurapi.web.interaction.sql.InteractionInstanceImpl
clone, getExitUrl, getFinishTime, getId, getInteractionId, getIsFinished, getOwner, getPropertySet, getStartTime, getStatus, getStepId, project, project, setExitUrl, setFinishTime, setId, setInteractionId, setIsFinished, setOwner, setPropertySet, setStartTime, setStatus, setStepId
 
Methods inherited from class biz.hammurapi.sql.DatabaseObject
addColumn, addObserver, addRelationship, clear, configure, configure, copy, delete, equals, fromDom, fromDom, get, getAttribute, getColumn, getColumnAttribute, getObjectVersion, getRelationship, getSqlType, hashCode, insert, isDeleted, isModified, loadRelationships, onChange, removeAttribute, removeColumnAttribute, removeObserver, setAttribute, setColumnAttribute, setOriginal, toDom, toString, update
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InteractionInstance

public InteractionInstance()
Default constructor


InteractionInstance

public InteractionInstance(boolean force)

InteractionInstance

public InteractionInstance(java.sql.ResultSet rs)
                    throws java.sql.SQLException
Method Detail

invalidate

public void invalidate()
Indicates that steps and transitions information shall be reloaded.


getDefinition

public InteractionFactory.InteractionDefinition getDefinition()
                                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

setSQLProcessor

public void setSQLProcessor(biz.hammurapi.sql.SQLProcessor processor)
                     throws java.sql.SQLException
Loads child objects

Specified by:
setSQLProcessor in interface biz.hammurapi.sql.DataAccessObject
Throws:
java.sql.SQLException

getNextSeqId

public int getNextSeqId()
Returns:
Next sequential step id.

getStepByStatus

public InteractionInstance.StepInstance getStepByStatus(java.lang.String status)
Returns first step in given status

Parameters:
status -
Returns:

getStepByDefinitionName

public InteractionInstance.StepInstance getStepByDefinitionName(java.lang.String defName)
                                                         throws java.sql.SQLException
Returns single step with given step definition name.

Parameters:
defName -
Returns:
Throws:
java.sql.SQLException

getStepsByDefinitionNameAndStatus

public java.util.Collection getStepsByDefinitionNameAndStatus(java.lang.String defName,
                                                              java.lang.String status)
                                                       throws java.sql.SQLException
Returns steps with given step definition name and status. This method can be used in guards of transitions which shall navigate from multiple instances of one step to a single instance of another.

Parameters:
defName -
Returns:
Throws:
java.sql.SQLException

getStepsByDefinitionName

public java.util.Collection getStepsByDefinitionName(java.lang.String defName)
                                              throws java.sql.SQLException
Returns single step with given step definition name.

Parameters:
defName -
Returns:
Throws:
java.sql.SQLException

getStep

public InteractionInstance.StepInstance getStep(java.lang.String[] status)
Traverses steps tree. The tree is constructed from root steps with steps activated by the root steps as children of respective steps.

Parameters:
status - Array
Returns:
First available step with status equal to one of elements in the status array.

getFactory

public InteractionFactory getFactory()

setFactory

public void setFactory(InteractionFactory factory)

update

public void update()
            throws java.sql.SQLException
Updates step information in the database

Throws:
java.sql.SQLException

delete

public void delete()
            throws java.sql.SQLException
Throws:
java.sql.SQLException

getProperties

public PropertySet getProperties()
                          throws java.sql.SQLException
Creates property set or retrieves it from the database.

Throws:
java.sql.SQLException

getStep

public InteractionInstance.StepInstance getStep(int id)

getTransition

public InteractionInstance.TransitionInstance getTransition(int id)
                                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

after

public void after(java.util.Map context)
           throws HammurapiWebException
Executes after code.

Parameters:
context - evaluation context.
Returns:
If 'false' then interaction instance does not get created.
Throws:
HammurapiWebException

accept

public boolean accept(biz.hammurapi.util.Visitor visitor)
Specified by:
accept in interface biz.hammurapi.util.Visitable

completed

public void completed(java.lang.Integer stepId,
                      java.util.Map context,
                      java.lang.String userId)
               throws java.sql.SQLException,
                      HammurapiWebException
Marks step as completed, evaluates transitions from it and new step instances.

Parameters:
stepId - Control step Id. If this parameter is not equal to internal step id then interaction rewinds to this stepId if step with this ID is processed or throws exception if step with this id is not found or is not in "completed" status.
Throws:
java.sql.SQLException
HammurapiWebException

tokenize

public static java.util.Collection tokenize(java.lang.Object obj)
Converts object into collection of tokens according to the following rules: a) If object is Iterator then each next() return value becomes a token. b) If object is Enumeration then each nextElement() return value becomes a token. c) If object is Boolean.FALSE then it is discarded d) Otherwise object per se becomes a token.

Parameters:
obj -
Returns:

getOwnerStep

public InteractionInstance.StepInstance getOwnerStep()
                                              throws java.sql.SQLException
Returns:
Step instance of parent interaction which initiated this interaction
Throws:
java.sql.SQLException

toDom

public void toDom(org.w3c.dom.Element holder)
Specified by:
toDom in interface biz.hammurapi.xml.dom.DomSerializable

getProperty

public java.lang.Object getProperty(java.lang.String name)
Convenience method to retrieve interaction instance properties.

Parameters:
name -
Returns:
Throws:
java.sql.SQLException


Copyright © 2006 Hammurapi Group. All Rights Reserved.