HDIV API 2.0.4

org.hdiv.dataComposer
Class DataComposerMemory

java.lang.Object
  extended by org.hdiv.dataComposer.AbstractDataComposer
      extended by org.hdiv.dataComposer.DataComposerMemory
All Implemented Interfaces:
IDataComposer
Direct Known Subclasses:
DataComposerCipher, DataComposerHash

public class DataComposerMemory
extends AbstractDataComposer
implements IDataComposer

It generates the states of each page by storing them in the user session. To be able to associate the request state with the state stored in session, an extra parameter is added to each request, containing the state identifier which makes possible to get the state of the user session.

Non editable values are hidden to the client, guaranteeing confidentiality

Author:
Roberto Velasco
See Also:
AbstractDataComposer, org.hdiv.composer.IDataComposer

Field Summary
protected static java.lang.String DASH
          Dash character
protected  IParameter lastParameter
          Last parameter treated by the compose method
protected  IPage page
          Page with the possible requests or states
protected  int requestCounter
          Represents the identifier of each possible state stored in the page page.
protected  IState state
          State that represents all the data of a request or a form existing in a page page
protected  java.util.Stack statesStack
          States stack to store all states of the page page
 
Constructor Summary
DataComposerMemory()
           
 
Method Summary
 void addFlowId(java.lang.String id)
          Adds the flow identifier to the page of type IPage.
 void beginRequest()
          It is called by each request or form existing in the page returned by the server.
 void beginRequest(java.lang.String action)
          It is called in the pre-processing stage of each request or form existing in the page returned by the server, as long as the destiny of the request is an action.
 java.lang.String compose(java.lang.String parameter, java.lang.String value, boolean editable)
          It generates a new encoded value for the parameter parameter and the value value passed as parameters.
 java.lang.String compose(java.lang.String parameter, java.lang.String value, boolean editable, boolean isActionParam)
          Adds a new IParameter object, generated from the values passed as parameters, to the current state state.
 java.lang.String compose(java.lang.String parameter, java.lang.String value, boolean editable, boolean isActionParam, java.lang.String charEncoding)
          Adds a new IParameter object, generated from the values passed as parameters, to the current state state.
 java.lang.String compose(java.lang.String parameter, java.lang.String value, boolean editable, java.lang.String editableName)
          It generates a new encoded value for the parameter parameter and the value value passed as parameters.
 java.lang.String compose(java.lang.String parameter, java.lang.String value, boolean editable, java.lang.String editableName, boolean isActionParam, java.lang.String charEncoding)
          Adds a new IParameter object, generated from the values passed as parameters, to the current state state.
 java.lang.String compose(java.lang.String action, java.lang.String parameter, java.lang.String value, boolean editable)
          It generates a new encoded value for the parameter parameter and the value value passed as parameters.
 java.lang.String compose(java.lang.String action, java.lang.String parameter, java.lang.String value, boolean editable, boolean isActionParam, java.lang.String charEncoding)
          It generates a new encoded value for the parameter parameter and the value value passed as parameters.
 void endPage()
          This method is called in the pre-processing stage of each user request to add an IPage object, which represents the page to show by the server, with all its states to the user session.
 java.lang.String endRequest()
          It is called in the pre-processing stage of each request or form existing in the page returned by the server.
 java.lang.String getHDIVParameter()
           
 java.lang.String getHdivStateSuffix()
          Obtains the suffix to add to the _HDIV_STATE_ parameter in the memory version.
 IPage getPage()
           
 void init()
          DataComposerMemory initialization with HTTP session wrapper and new stack to store all states of the page page.
 void initTesting()
          Testing initialization
 void mergeParameters(java.lang.String oldParameter, java.lang.String newParameter)
          Creates a new parameter called newParameter and adds all the values of oldParameter stored in the state to it.
 void setConfidentiality(java.lang.Boolean confidentiality)
           
 void setHdivConfig(HDIVConfig hdivConfig)
           
 void setPage(IPage page)
           
 void startPage()
          It is called in the pre-processing stage of each user request assigning a new page identifier to the page.
 void updateComposerState()
          Updates the state state of this with the state in the first position of the state stack.
 
Methods inherited from class org.hdiv.dataComposer.AbstractDataComposer
getAction, getApplication, getPageId, getSession, init, initPageId, setAction, setApplication, setSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hdiv.dataComposer.IDataComposer
getApplication, getSession, init, setApplication, setSession
 

Field Detail

DASH

protected static final java.lang.String DASH
Dash character

See Also:
Constant Field Values

page

protected IPage page
Page with the possible requests or states


state

protected IState state
State that represents all the data of a request or a form existing in a page page


lastParameter

protected IParameter lastParameter
Last parameter treated by the compose method


requestCounter

protected int requestCounter
Represents the identifier of each possible state stored in the page page.


statesStack

protected java.util.Stack statesStack
States stack to store all states of the page page

Constructor Detail

DataComposerMemory

public DataComposerMemory()
Method Detail

init

public void init()
DataComposerMemory initialization with HTTP session wrapper and new stack to store all states of the page page.


initTesting

public void initTesting()
Testing initialization


compose

public java.lang.String compose(java.lang.String parameter,
                                java.lang.String value,
                                boolean editable)
It generates a new encoded value for the parameter parameter and the value value passed as parameters. The returned value guarantees the confidentiality in the encoded and memory strategies if confidentiality indicator confidentiality is true.

Specified by:
compose in interface IDataComposer
Parameters:
parameter - HTTP parameter name
value - value generated by server
editable - parameter type: editable(textbox, password,etc.) or non editable (hidden, select, radio, ...)
Returns:
Codified value to send to the client

compose

public java.lang.String compose(java.lang.String action,
                                java.lang.String parameter,
                                java.lang.String value,
                                boolean editable)
It generates a new encoded value for the parameter parameter and the value value passed as parameters. The returned value guarantees the confidentiality in the encoded and memory strategies if confidentiality indicator confidentiality is true.

Specified by:
compose in interface IDataComposer
Parameters:
action - target action
parameter - HTTP parameter name
value - value generated by server
editable - parameter type: editable(textbox, password,etc.) or non editable (hidden, select, radio, ...)
Returns:
Codified value to send to the client

compose

public java.lang.String compose(java.lang.String parameter,
                                java.lang.String value,
                                boolean editable,
                                boolean isActionParam)
Adds a new IParameter object, generated from the values passed as parameters, to the current state state. If confidentiality is activated it generates a new encoded value that will be returned by the server for the parameter parameter in the encoded and memory strategies.

Parameters:
parameter - HTTP parameter
value - value generated by server
editable - Parameter type: editable(textbox, password,etc.) or non editable (hidden, select, radio, ...)
isActionParam - parameter added in action attribute
Returns:
Codified value to send to the client

compose

public java.lang.String compose(java.lang.String parameter,
                                java.lang.String value,
                                boolean editable,
                                java.lang.String editableName)
It generates a new encoded value for the parameter parameter and the value value passed as parameters. The returned value guarantees the confidentiality in the encoded and memory strategies if confidentiality indicator confidentiality is true.

Specified by:
compose in interface IDataComposer
Parameters:
parameter - HTTP parameter name
value - value generated by server
editable - parameter type: editable(textbox, password,etc.) or non editable (hidden, select, radio, ...)
editableName - editable name (text or textarea)
Returns:
Codified value to send to the client
Since:
HDIV 1.1

compose

public java.lang.String compose(java.lang.String action,
                                java.lang.String parameter,
                                java.lang.String value,
                                boolean editable,
                                boolean isActionParam,
                                java.lang.String charEncoding)
It generates a new encoded value for the parameter parameter and the value value passed as parameters. The returned value guarantees the confidentiality in the encoded and memory strategies if confidentiality indicator confidentiality is true.

Specified by:
compose in interface IDataComposer
Parameters:
action - target action
parameter - parameter name
value - value generated by server
editable - parameter type: editable(textbox, password,etc.) or non editable (hidden, select,...)
isActionParam - parameter added in action attribute
charEncoding - character encoding
Returns:
Codified value to send to the client

compose

public java.lang.String compose(java.lang.String parameter,
                                java.lang.String value,
                                boolean editable,
                                boolean isActionParam,
                                java.lang.String charEncoding)
Adds a new IParameter object, generated from the values passed as parameters, to the current state state. If confidentiality is activated it generates a new encoded value that will be returned by the server for the parameter parameter in the encoded and memory strategies.

Specified by:
compose in interface IDataComposer
Parameters:
parameter - HTTP parameter
value - value generated by server
editable - Parameter type: editable(textbox, password,etc.) or non editable (hidden, select, radio, ...)
isActionParam - parameter added in action attribute
charEncoding - character encoding
Returns:
Codified value to send to the client

compose

public java.lang.String compose(java.lang.String parameter,
                                java.lang.String value,
                                boolean editable,
                                java.lang.String editableName,
                                boolean isActionParam,
                                java.lang.String charEncoding)
Adds a new IParameter object, generated from the values passed as parameters, to the current state state. If confidentiality is activated it generates a new encoded value that will be returned by the server for the parameter parameter in the encoded and memory strategies.

Parameters:
parameter - HTTP parameter
value - value generated by server
editable - Parameter type: editable(textbox, password,etc.) or non editable (hidden, select, radio, ...)
editableName - editable name (text or textarea)
isActionParam - parameter added in action attribute
charEncoding - character encoding
Returns:
Codified value to send to the client
Since:
HDIV 1.1

mergeParameters

public void mergeParameters(java.lang.String oldParameter,
                            java.lang.String newParameter)
Creates a new parameter called newParameter and adds all the values of oldParameter stored in the state to it.

Specified by:
mergeParameters in interface IDataComposer
Parameters:
oldParameter - name of the parameter stored in the state
newParameter - name of the new parameter

beginRequest

public void beginRequest()
It is called by each request or form existing in the page returned by the server. It creates a new state to store all the parameters and values of the request or form.

Specified by:
beginRequest in interface IDataComposer
Overrides:
beginRequest in class AbstractDataComposer

beginRequest

public void beginRequest(java.lang.String action)
It is called in the pre-processing stage of each request or form existing in the page returned by the server, as long as the destiny of the request is an action. It creates a new state to store all the parameters and values of the request or form.

Specified by:
beginRequest in interface IDataComposer
Overrides:
beginRequest in class AbstractDataComposer
Parameters:
action - action name
See Also:
beginRequest()

endRequest

public java.lang.String endRequest()
It is called in the pre-processing stage of each request or form existing in the page returned by the server. It adds the state of the treated request or form to the page page and returns and identifier compoded by the page identifier and the state identifier.

Specified by:
endRequest in interface IDataComposer
Returns:
Identifier composed by the page identifier and the state identifier.

getHdivStateSuffix

public java.lang.String getHdivStateSuffix()
Obtains the suffix to add to the _HDIV_STATE_ parameter in the memory version.

Returns:
Returns suffix added to the _HDIV_STATE_ parameter in the memory version.
Since:
HDIV 1.1

updateComposerState

public void updateComposerState()
Updates the state state of this with the state in the first position of the state stack. If the state stack is empty it does nothing.


startPage

public void startPage()
It is called in the pre-processing stage of each user request assigning a new page identifier to the page.

Specified by:
startPage in interface IDataComposer

endPage

public void endPage()
This method is called in the pre-processing stage of each user request to add an IPage object, which represents the page to show by the server, with all its states to the user session.

Specified by:
endPage in interface IDataComposer

getPage

public IPage getPage()
Returns:
IPage which represents the page in memory.

setPage

public void setPage(IPage page)
Parameters:
page - The page to set.

setConfidentiality

public void setConfidentiality(java.lang.Boolean confidentiality)
Parameters:
confidentiality - The confidentiality to set.

setHdivConfig

public void setHdivConfig(HDIVConfig hdivConfig)
Parameters:
hdivConfig - The HDIV configuration object to set.

getHDIVParameter

public java.lang.String getHDIVParameter()
Specified by:
getHDIVParameter in interface IDataComposer
Returns:
Returns the HDIV state parameter.

addFlowId

public void addFlowId(java.lang.String id)
Adds the flow identifier to the page of type IPage.

Specified by:
addFlowId in interface IDataComposer
Since:
HDIV 2.0.3

HDIV 2.0.4

Copyright © 2008 hdiv.org. All Rights Reserved.