ibspan.tss.agents.pa.handlers
Class PersonalModelConstructor

java.lang.Object
  extended by jade.core.behaviours.Behaviour
      extended by jade.core.behaviours.CompositeBehaviour
          extended by jade.core.behaviours.SerialBehaviour
              extended by jade.core.behaviours.FSMBehaviour
                  extended by ibspan.tss.agents.pa.handlers.PersonalModelConstructor
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
DefineSearchPMC, DummyPersonalModelConstructor, SearchPMC, ShowBackedUpResultsPMC, ShowDetailsPMC

public abstract class PersonalModelConstructor
extends FSMBehaviour

This behaviour constructs model of data in Model-View-Controller architecture. This class should not be used directly, but extended. As a result of it action it should, eventually, put constructed DataModel object with use of putModel(DataModel) method or infrom about InternalSystemError by calling putError(InternalSystemError) method. Returned DataModel should contain at least contain LayoutStructure object, fetched from TemplatesRegister object, provided by the Agent this behaviour belongs to.

This implementation provides methods for backing up results of their action and restoring them: backUpResult(Memory) and getBackedUpResult().

Author:
Maciej Gawinecki
See Also:
DataModel, InternalSystemError, LayoutStructure, TemplatesRegister, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour
Behaviour.RunnableChangedEvent
 
Field Summary
protected  PersonalAgent myAgent
           
protected  TemplatesRegister templates
           
 
Fields inherited from class jade.core.behaviours.FSMBehaviour
currentName, lastStates, previousName
 
Fields inherited from class jade.core.behaviours.CompositeBehaviour
currentExecuted
 
Fields inherited from class jade.core.behaviours.Behaviour
myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING
 
Constructor Summary
PersonalModelConstructor(Agent a, DataStore ds, Object requestKey, Object actKey, Object actionNameKey, Object resultNotificationKey)
          Constructs PersonalModelConstructor object.
 
Method Summary
protected  void backUpResult(Memory result)
          Puts the given result in local DataStore.
protected  Action getAct()
          Returns Action concept extracted from the current request.
protected  PA_process_user_request getAction()
          Returns action concept extracted from current request.
protected  String getActionName()
          Returns the name of action resolved by action dispatcher for current request.
protected  Memory getBackedUpResult()
          Returns previously backed-up result.
protected  ACLMessage getRequest()
           
protected  void putError(InternalSystemError error)
          Puts the given error in the DataStore in case of constructing failure.
protected  void putModel(DataModel model)
          Puts the given model in the DataStore as the result of successful constructing.
 
Methods inherited from class jade.core.behaviours.FSMBehaviour
checkTermination, deregisterState, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, onEnd, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, reset, resetStates, scheduleFirst, scheduleNext
 
Methods inherited from class jade.core.behaviours.SerialBehaviour
handle
 
Methods inherited from class jade.core.behaviours.CompositeBehaviour
action, block, done, registerAsChild, resetChildren, restart, setAgent
 
Methods inherited from class jade.core.behaviours.Behaviour
actionWrapper, block, getBehaviourName, getDataStore, getExecutionState, getParent, isRunnable, onStart, root, setBehaviourName, setDataStore, setExecutionState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

templates

protected TemplatesRegister templates

myAgent

protected PersonalAgent myAgent
Constructor Detail

PersonalModelConstructor

public PersonalModelConstructor(Agent a,
                                DataStore ds,
                                Object requestKey,
                                Object actKey,
                                Object actionNameKey,
                                Object resultNotificationKey)
Constructs PersonalModelConstructor object.

Parameters:
a - is the agent this behaviour belongs to.
ds - is data store
requestKey - key for accessing user request ACL message from local DataStore
actKey - key for accessing action of user request from local DataStore
actionNameKey - key for accessing action name of user request from local DataStore
resultNotificationKey - key in local Data Store, where result of PersonalModelConstructor behaviour should be put at
Method Detail

putModel

protected void putModel(DataModel model)
Puts the given model in the DataStore as the result of successful constructing.

Parameters:
model - is the result model of construction.

putError

protected void putError(InternalSystemError error)
Puts the given error in the DataStore in case of constructing failure.

Parameters:
error - is the error encounter during constructing process.

getAct

protected Action getAct()
Returns Action concept extracted from the current request.

Returns:
Action concept.

getAction

protected PA_process_user_request getAction()
Returns action concept extracted from current request.

Returns:
action.

getRequest

protected ACLMessage getRequest()

getActionName

protected String getActionName()
Returns the name of action resolved by action dispatcher for current request.

Returns:
name of the action.

backUpResult

protected void backUpResult(Memory result)
Puts the given result in local DataStore.

Parameters:
result - to be backed-up.

getBackedUpResult

protected Memory getBackedUpResult()
Returns previously backed-up result.

Returns:
back-up result or null if backed-up result was null or no result has been backed up, yet.