ibspan.tss.agents.sha.mvc
Class ModelConstructor

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.sha.mvc.ModelConstructor
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
CheckLogin1MC, CheckRegistration1MC, CheckRegistration2MC, DummyModelConstructor, LogoutMC, PersonalForwarderMC

public abstract class ModelConstructor
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.

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  SessionHandlingAgent 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
ModelConstructor(Agent a, DataStore ds)
          Constructs ModelConstructor.
 
Method Summary
protected  SHA_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  Session getCurrentSession()
          Returns the session to which currently service request belongs to.
protected  OntModel getTemplatesDB()
          Returns the register of templates used to build screen layouts.
protected  UserRequest getUserRequest()
          Returns concept of current user request.
 int onEnd()
           
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.
 void setAccessKeys(Object actKey, Object actionNameKey, Object resultKey)
          Sets the keys necessary for the work of this behaviour.
 
Methods inherited from class jade.core.behaviours.FSMBehaviour
checkTermination, deregisterState, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, 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 SessionHandlingAgent myAgent
Constructor Detail

ModelConstructor

public ModelConstructor(Agent a,
                        DataStore ds)
Constructs ModelConstructor.

Parameters:
a - is the agent owning this behaviour.
ds - is the DataStore for this constructor.
Method Detail

setAccessKeys

public void setAccessKeys(Object actKey,
                          Object actionNameKey,
                          Object resultKey)
Sets the keys necessary for the work of this behaviour.

Parameters:
actKey - is the key in the DataStore where the Action concept extracted from current request can be found.
actionNameKey - is tThe key in the DataStore where the name of action resolved by action dispatcher - for current request - can be found.
resultKey - is the key in the DataStore where the results of work of this constructor will be put.

onEnd

public int onEnd()
Overrides:
onEnd in class FSMBehaviour

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.

getAction

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

Returns:
action.

getUserRequest

protected UserRequest getUserRequest()
Returns concept of current user request.

Returns:
user request.

getActionName

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

Returns:
name of the action.

getTemplatesDB

protected OntModel getTemplatesDB()
Returns the register of templates used to build screen layouts.

Returns:
the register of templates.

getCurrentSession

protected Session getCurrentSession()
Returns the session to which currently service request belongs to.

Returns:
current session.