com.zphinx.spine.core.viewprocessors
Class MultiViewProcessor

java.lang.Object
  extended by com.zphinx.spine.core.viewprocessors.ViewProcessor
      extended by com.zphinx.spine.core.viewprocessors.MultiViewProcessor

public class MultiViewProcessor
extends ViewProcessor

MultiViewProcessor processes invocations which require multiple delegates and DataTransferObjects while using a single ViewProcessor.

It allows the programmer access to more than one delegate or process flow from the same ViewProcessor whilst possessing the ability to use an optional builder to create and run generic methods in each of the generated SpineBeans.

Version:
$1.0

Copyright ©Zphinx Software Solutions

Author:
David Ladapo

Field Summary
 
Fields inherited from class com.zphinx.spine.core.viewprocessors.ViewProcessor
DATABASE_DATASOURCE, GENERAL_EXCEPTION, messages, newClass
 
Constructor Summary
MultiViewProcessor()
           
 
Method Summary
 AbstractBusinessDelegate delegateFactory(CommandComponent command, int pageIndex)
          Creates and initializes a suitable AbstractBusinessDelegate
 ResultObject delegateFactoryAndRun(CommandComponent command, int pageIndex)
          Creates and initializes a suitable AbstractBusinessDelegate then calls the run method of the instantiated Business Delegate.
protected  Object findBuilder(String delegateSubClass)
          Gets the builder for the named BusinessDelegate i.e the delegateSubClass
 ResultObject processData(DataTransferObject dto, Object obj, DAOInput daoConstructor, int operation)
          Deprecated.  
 ResultObject processData(DataTransferObject dto, Object obj, DAOInput daoConstructor, int operation, int pageIndex)
          Calls the methods of this ViewProcessor,creates and sends the DataTransferAssembler to the business layer
 int processNavigation(ResultObject result)
          Processes the navigation rules for this processor
 
Methods inherited from class com.zphinx.spine.core.viewprocessors.ViewProcessor
createAssembler, delegateFactory, getDelegate, getProcessorAliasName, processData, resetDelegateName, resetPackageName, setDelegateFullName, setProcessorAliasName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiViewProcessor

public MultiViewProcessor()
Method Detail

processNavigation

public int processNavigation(ResultObject result)
Processes the navigation rules for this processor

Specified by:
processNavigation in class ViewProcessor
Parameters:
result - The resultObject instance to be parsed for information
Returns:
An int specifying the navigation to return to user

processData

public ResultObject processData(DataTransferObject dto,
                                Object obj,
                                DAOInput daoConstructor,
                                int operation,
                                int pageIndex)
Calls the methods of this ViewProcessor,creates and sends the DataTransferAssembler to the business layer

Parameters:
dto - The DataTransferObject used to create a DataTransferAssembler
obj - The object used to initialize this transaction, usually a dataSource when a database proxy is in use
daoConstructor - The construct object used to instantiate a dao
operation - The operation to call within the dto
pageIndex - The int representing the position of the DAO defination in spine.xml
Returns:
An instance of the ResultObject obtained from the bussiness layer

processData

public ResultObject processData(DataTransferObject dto,
                                Object obj,
                                DAOInput daoConstructor,
                                int operation)
Deprecated. 

Processes the invocation to the business tier, throws a runtime exception asking the user to call processData(DataTransferObject, Object, DAOInput, int, int)

Overrides:
processData in class ViewProcessor
Parameters:
dto - The DataTransferObject used to create a DataTransferAssembler
obj - The object used to initialize this transaction, usually a dataSource when a DataBaseProxy is in use
daoConstructor - The construct object used to instantiate a dao
operation - The operation to call within the dto
Returns:
An instance of the ResultObject obtained from the bussiness layer

delegateFactoryAndRun

public ResultObject delegateFactoryAndRun(CommandComponent command,
                                          int pageIndex)
Creates and initializes a suitable AbstractBusinessDelegate then calls the run method of the instantiated Business Delegate.

Parameters:
command - The DataTransferAssembler used by this processor
pageIndex - The int representing the position of the DAO defination in spine.xml
Returns:
A DataTransferAssembler in the form of a ResultObject

delegateFactory

public AbstractBusinessDelegate delegateFactory(CommandComponent command,
                                                int pageIndex)
                                         throws SpineException
Creates and initializes a suitable AbstractBusinessDelegate

Parameters:
command - The DataTransferAssembler used by this processor
pageIndex - The int representing the position of the DAO defination in spine.xml
Returns:
The required AbstractBusinessDelegate Object
Throws:
SpineException

findBuilder

protected Object findBuilder(String delegateSubClass)
Gets the builder for the named BusinessDelegate i.e the delegateSubClass

Parameters:
delegateSubClass - The full class name of the delegate subclass defined as subClass in configuration
Returns:
The AbstractBuilder Object which was defined in configuration