planetj.magic
Class AbstractMagicRequest

java.lang.Object
  |
  +--planetj.html.AbstractHTMLRenderer
        |
        +--planetj.magic.AbstractMagicRequest
All Implemented Interfaces:
IFeature, IHTMLRenderer, IMagicRequest, IRenderer, Serializable
Direct Known Subclasses:
MagicRequest, RowReflectionRequest

public abstract class AbstractMagicRequest
extends AbstractHTMLRenderer
implements IMagicRequest

Abstract Class for all MagicRequests

Author:
PlanetJ Corporation
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class planetj.dataengine.IFeature
IFeature.OperationCountFeature
 
Field Summary
 
Fields inherited from class planetj.html.AbstractHTMLRenderer
className
 
Fields inherited from interface planetj.magic.IMagicRequest
IS_COMPLETE, MAGIC_REQUEST, MAGIC_REQUEST_PARAM1, MAGIC_REQUEST_RC, SAME_URI, TYPE, TYPE_PAGE, TYPE_SESSION, TYPE_STATIC, USER_REQUEST_ATTRIBUTES_STORED
 
Fields inherited from interface planetj.html.IHTMLRenderer
HTML
 
Fields inherited from interface planetj.dataengine.IFeature
DEFAULT_MESSAGE_FEATURE, FEATURE_DELETE, FEATURE_INSERT, FEATURE_LEVEL_ENTERPRISE, FEATURE_LEVEL_ENTRY, FEATURE_LEVEL_PROFESSIONAL, FEATURE_LEVEL_STANDARD, FEATURE_UPDATE, MESSAGE_END, MESSAGE_START
 
Constructor Summary
AbstractMagicRequest()
          MagicRequest constructor comment.
AbstractMagicRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          MagicRequest constructor comment.
AbstractMagicRequest(String pId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          MagicRequest constructor comment.
 
Method Summary
 void addLinkedRequestAfter(IMagicRequest pMagicRequest)
          Adds the given MagicRequest to the list of requests to be executed after this MagicRequest
 void addLinkedRequestBefore(IMagicRequest pMagicRequest)
          Adds the given MagicRequest to the list of requests to be executed before this MagicRequest
 StringBuffer appendUnsupportedHTMLMessage(StringBuffer html)
          Appends the default unsupported message
 Object clone()
          Clone this object.
 Object clone(String cloneKey, javax.servlet.http.HttpServletRequest request)
          Clone this object.
static boolean equals(Object one, Object two)
           
abstract  IMagicRequest execute(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, DataEngineServlet servlet)
          Execute method comment.
 IMagicRequest executeAll(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse, DataEngineServlet pServlet)
          Execute method comment.
 String getAnchorName()
          Get the name of the anchor generated next to the Field requiring the status change.
 Field getBaseField()
          Get the based on Row for this Request.
 Row getBaseRow()
          Get the based on Row for this Request.
 RowCollection getBaseRowCollection()
          Get the based on RowCollection for this Request.
 String getCurrentURI()
          Get the URI of the page this MagicRequest was created on.
 boolean getDefaultEndNavigationGroup()
          Get the default state if this request should end its navigation group.
 String getFailMessage()
          Deprecated. - only temporarily added to support custom fail messages
 int getFeatureLevel()
          Gets the minimum feature level requried to execute this operation
 IMagicRequest getFirstRequest()
          Gets the first magic request that will be executed when executeAll() is invoked on this magic request.
 String getId()
          Return the id used to store this magic request in the session.
 String getKey()
          Return the id used to store this magic request in the session.
 IMagicRequest getLastRequest()
          Gets the last magic request that will be executed when executeAll() is invoked on this magic request.
 String getMagicServletURI()
           
 String getMagicURI()
          Get the URI to use to call the Magic Servlet for this request
 String getNextURI(LayoutDisplayPropertyGroup layoutTemplate)
          Get the URI of the next page to call.
static Object getRequestAttribute(String key, javax.servlet.http.HttpServletRequest request)
           
static String getRequestParameter(String key, javax.servlet.http.HttpServletRequest request)
          Gets the specified parameter from the HTTPRequest.
static String[] getRequestParameterValues(String key, javax.servlet.http.HttpServletRequest request)
          Gets the specified parameter from the HTTPRequest.
static Object getSessionAttribute(String pKey, javax.servlet.http.HttpServletRequest pRequest)
          Gets the specified object in the HTTPSession.
static Object getSharedSessionAttribute(String key, javax.servlet.http.HttpServletRequest request)
          Gets the specified object in the HTTPSession.
 String getSuccessMessage()
          Get the message to set in the request if this "Magic Request" runs successfully.
abstract  String getType()
          Get the type of magic request.
 boolean hasLinkedRequestsAfter()
          Return wheter or not this request has additional request to execute
 boolean hasLinkedRequestsBefore()
          Return wheter or not this request has additional request to execute
 boolean isApplicable()
          Assume by default that this feature applies
 boolean isCompleted(javax.servlet.http.HttpServletRequest req)
          Gets whether or not the request has completed execution
 boolean isEndNavigationGroup()
          Tests whether or not this magic request needs to end the current navigation group and go back to the previous state of the last page of the last group.
 boolean isPopup()
          Tests if this request should execute in a popup window.
 boolean isReturnToRequester()
          Returns whether or not the magic request needs to be returned to the requester.
 boolean isSaveResults()
          Deprecated. - from code prior to navigation and layouts - wasn't referenced or used any where !!N WK (4/22/2003 8:27:47 AM)
 boolean isStartNewNavigationGroup()
          Tests whether or not this magic request needs to start a new navigation group.
 void preexecute(DataEngineServlet pServlet, javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse)
          Called before the execute method runs.
static Object removeRequestAttribute(String key, javax.servlet.http.HttpServletRequest request)
           
static void removeSessionAttribute(String key, javax.servlet.http.HttpServletRequest request)
          Removes the specified object in the HTTPSession.
static void removeSharedSessionAttribute(String key, javax.servlet.http.HttpServletRequest request)
          Removes the specified object in the HTTPSession.
 void setAnchorName(String name)
          Set the name of the anchor generated next to the Field requiring the status change.
 void setBaseField(Field pBaseField)
          Set the based on Field for this Request.
 void setBaseRow(Row pBaseRow)
          Set the based on Row for this Request.
 void setBaseRowCollection(RowCollection pBaseRowCollection)
          Set the based on RowCollection for this Request.
 void setCompleted(boolean pCompleted, javax.servlet.http.HttpServletRequest request)
          Sets the state of the magic request to finished executing
 void setEndNavigationGroup(boolean endGroup)
           
 void setFailMessage(String message)
          Deprecated. - only temporarily added to support custom fail messages
 void setId(String pId)
          Sets the id used to store this magic request in the session.
 void setNextURI(String uri)
          Set the URI of the next page to call.
 void setNextURI(String section, String uri)
          Set the URI of the next page to call.
 void setNextURIs(LayoutDisplayPropertyGroup props)
           
 void setPopup(boolean newPopup)
          Sets if this request should execute in a popup window.
static void setRequestGroupAttribute(String key, Object value, javax.servlet.http.HttpServletRequest request)
           
static void setRequestPageAttribute(String key, Object value, javax.servlet.http.HttpServletRequest request)
          Sets an attribute on the request that is associated with this page.
static void setRequestPersistentAttribute(String key, Object value, javax.servlet.http.HttpServletRequest request)
          Sets an attribute on the request that will be persisted.
static void setRequestTransientAttribute(String key, Object value, javax.servlet.http.HttpServletRequest request)
          Sets an attriubte on the request that will not be automatically transferred to another request.
 void setReturnToRequester(boolean returnToRequester)
          Returns whether or not the magic request needs to be returned to the requester.
 void setRowEventListener(IRowEventListener newRowEventListener)
          Sets the RowEventListener on this MagicReqest.
static void setSessionAttribute(String pKey, Object pValue, javax.servlet.http.HttpServletRequest pRequest)
          Sets the specified object in the HTTPSession.
static void setSessionSharedAttribute(String key, Object value, javax.servlet.http.HttpServletRequest request)
          Sets the specified object in the HttpSession.
 void setStartNewNavigationGroup(boolean startNew)
           
 void setSuccessMessage(String message)
          Message to set in the request if this "Magic Request" runs successful.
 IMagicRequest store(javax.servlet.http.HttpServletRequest request)
          Store this MagicRequest in the user's session to the DataEngineServlet can get at it when requested
 
Methods inherited from class planetj.html.AbstractHTMLRenderer
append, generate, getDisplayType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface planetj.html.IHTMLRenderer
append, generate
 
Methods inherited from interface planetj.dataengine.display.IRenderer
getDisplayType
 

Constructor Detail

AbstractMagicRequest

public AbstractMagicRequest()
MagicRequest constructor comment.


AbstractMagicRequest

public AbstractMagicRequest(String pId,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
MagicRequest constructor comment.

Parameters:
pId - id of MagicRequest used to store the request in the session

AbstractMagicRequest

public AbstractMagicRequest(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
MagicRequest constructor comment.

Method Detail

addLinkedRequestAfter

public void addLinkedRequestAfter(IMagicRequest pMagicRequest)
Adds the given MagicRequest to the list of requests to be executed after this MagicRequest

Specified by:
addLinkedRequestAfter in interface IMagicRequest

addLinkedRequestBefore

public void addLinkedRequestBefore(IMagicRequest pMagicRequest)
Adds the given MagicRequest to the list of requests to be executed before this MagicRequest

Specified by:
addLinkedRequestBefore in interface IMagicRequest

appendUnsupportedHTMLMessage

public StringBuffer appendUnsupportedHTMLMessage(StringBuffer html)
Appends the default unsupported message

Specified by:
appendUnsupportedHTMLMessage in interface IFeature

clone

public Object clone()
Clone this object.

Overrides:
clone in class Object
Returns:
clone of this MagicRequest.

clone

public Object clone(String cloneKey,
                    javax.servlet.http.HttpServletRequest request)
Clone this object.

Returns:
clone of this MagicRequest.

equals

public static final boolean equals(Object one,
                                   Object two)

execute

public abstract IMagicRequest execute(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      DataEngineServlet servlet)
                               throws CMException
Execute method comment.

Specified by:
execute in interface IMagicRequest
CMException

executeAll

public final IMagicRequest executeAll(javax.servlet.http.HttpServletRequest pRequest,
                                      javax.servlet.http.HttpServletResponse pResponse,
                                      DataEngineServlet pServlet)
                               throws CMException
Execute method comment.

Specified by:
executeAll in interface IMagicRequest
CMException

getAnchorName

public String getAnchorName()
Get the name of the anchor generated next to the Field requiring the status change.

Returns:
name of HTML anchor

getBaseField

public Field getBaseField()
Get the based on Row for this Request. Used when you have associations.

Specified by:
getBaseField in interface IMagicRequest

getBaseRow

public Row getBaseRow()
Get the based on Row for this Request. Used when you have associations.

Specified by:
getBaseRow in interface IMagicRequest

getBaseRowCollection

public RowCollection getBaseRowCollection()
Get the based on RowCollection for this Request. .


getCurrentURI

public String getCurrentURI()
Get the URI of the page this MagicRequest was created on.

Specified by:
getCurrentURI in interface IMagicRequest

getDefaultEndNavigationGroup

public boolean getDefaultEndNavigationGroup()
Get the default state if this request should end its navigation group. The default is set upon initialization of the request.

Returns:
true if navigation group should be ended; false otherwise.

getFailMessage

public String getFailMessage()
Deprecated. - only temporarily added to support custom fail messages

Get the message to set in the request if this "Magic Request" fails attempting to run.

Returns:
fail message to set in the request

getFeatureLevel

public int getFeatureLevel()
Gets the minimum feature level requried to execute this operation

Specified by:
getFeatureLevel in interface IFeature

getFirstRequest

public IMagicRequest getFirstRequest()
Gets the first magic request that will be executed when executeAll() is invoked on this magic request. If there are no requests before this one, then this same object will be returned

Specified by:
getFirstRequest in interface IMagicRequest

getId

public String getId()
Return the id used to store this magic request in the session.

Specified by:
getId in interface IMagicRequest

getKey

public String getKey()
Return the id used to store this magic request in the session.

Specified by:
getKey in interface IMagicRequest

getLastRequest

public IMagicRequest getLastRequest()
Gets the last magic request that will be executed when executeAll() is invoked on this magic request. If there are no requests after this one, then this same object will be returned

Specified by:
getLastRequest in interface IMagicRequest

getMagicServletURI

public String getMagicServletURI()

getMagicURI

public String getMagicURI()
Get the URI to use to call the Magic Servlet for this request

Specified by:
getMagicURI in interface IMagicRequest

getNextURI

public String getNextURI(LayoutDisplayPropertyGroup layoutTemplate)
Get the URI of the next page to call.

Specified by:
getNextURI in interface IMagicRequest

getRequestAttribute

public static Object getRequestAttribute(String key,
                                         javax.servlet.http.HttpServletRequest request)

getRequestParameter

public static String getRequestParameter(String key,
                                         javax.servlet.http.HttpServletRequest request)
Gets the specified parameter from the HTTPRequest. This provides a single place with potential error logging and programatic debug instead of all users getting their own parameters.


getRequestParameterValues

public static String[] getRequestParameterValues(String key,
                                                 javax.servlet.http.HttpServletRequest request)
Gets the specified parameter from the HTTPRequest. This provides a single place with potential error logging and programatic debug instead of all users getting their own parameters.


getSessionAttribute

public static Object getSessionAttribute(String pKey,
                                         javax.servlet.http.HttpServletRequest pRequest)
Gets the specified object in the HTTPSession. This provides a single place with potential error logging and programatic debug instead of all users getting objects from the session.

Parameters:
pRequest - request containing session to retrieve objects from.
pKey - key used to identify the object in the session.

getSharedSessionAttribute

public static Object getSharedSessionAttribute(String key,
                                               javax.servlet.http.HttpServletRequest request)
Gets the specified object in the HTTPSession. This provides a single place with potential error logging and programatic debug instead of all users getting objects from the session.


getSuccessMessage

public String getSuccessMessage()
Get the message to set in the request if this "Magic Request" runs successfully.

Returns:
success message to set in the request

getType

public abstract String getType()
Get the type of magic request.

Specified by:
getType in interface IMagicRequest

hasLinkedRequestsAfter

public boolean hasLinkedRequestsAfter()
Return wheter or not this request has additional request to execute


hasLinkedRequestsBefore

public boolean hasLinkedRequestsBefore()
Return wheter or not this request has additional request to execute


isApplicable

public boolean isApplicable()
                     throws CMException
Assume by default that this feature applies

Specified by:
isApplicable in interface IFeature
CMException

isCompleted

public boolean isCompleted(javax.servlet.http.HttpServletRequest req)
Gets whether or not the request has completed execution

Specified by:
isCompleted in interface IMagicRequest

isEndNavigationGroup

public boolean isEndNavigationGroup()
Description copied from interface: IMagicRequest
Tests whether or not this magic request needs to end the current navigation group and go back to the previous state of the last page of the last group.

Specified by:
isEndNavigationGroup in interface IMagicRequest

isPopup

public boolean isPopup()
Tests if this request should execute in a popup window. If true, there will be no header, TOC, or footer, and the popup window will be closed when this request's navigation group ends


isReturnToRequester

public boolean isReturnToRequester()
Returns whether or not the magic request needs to be returned to the requester. Defaults to true. If any "Magic" requests do not require return to the requester, then this method should be overridden.

Specified by:
isReturnToRequester in interface IMagicRequest

isSaveResults

public boolean isSaveResults()
Deprecated. - from code prior to navigation and layouts - wasn't referenced or used any where !!N WK (4/22/2003 8:27:47 AM)

Tests if the results of executing this magic request should be saved. This allows the user to go back to this result after viewing another page. If this method returns false, and the user goes back from viewing a later page, the results of this request will be "skipped" and the user will see results from a page "before" this one.

Specified by:
isSaveResults in interface IMagicRequest

isStartNewNavigationGroup

public boolean isStartNewNavigationGroup()
Description copied from interface: IMagicRequest
Tests whether or not this magic request needs to start a new navigation group.

Specified by:
isStartNewNavigationGroup in interface IMagicRequest

preexecute

public void preexecute(DataEngineServlet pServlet,
                       javax.servlet.http.HttpServletRequest pRequest,
                       javax.servlet.http.HttpServletResponse pResponse)
                throws CMException
Called before the execute method runs. If this method is overriden, it must be invoked on the superclass

CMException

removeRequestAttribute

public static Object removeRequestAttribute(String key,
                                            javax.servlet.http.HttpServletRequest request)

removeSessionAttribute

public static void removeSessionAttribute(String key,
                                          javax.servlet.http.HttpServletRequest request)
Removes the specified object in the HTTPSession. This provides a single place with potential error logging and programatic debug instead of all users setting objects into the session.


removeSharedSessionAttribute

public static void removeSharedSessionAttribute(String key,
                                                javax.servlet.http.HttpServletRequest request)
Removes the specified object in the HTTPSession. This provides a single place with potential error logging and programatic debug instead of all users setting objects into the session.


setAnchorName

public void setAnchorName(String name)
Set the name of the anchor generated next to the Field requiring the status change.

Parameters:
name - name of HTML anchor

setBaseField

public void setBaseField(Field pBaseField)
Set the based on Field for this Request. Used when you have associations.

Specified by:
setBaseField in interface IMagicRequest

setBaseRow

public void setBaseRow(Row pBaseRow)
Set the based on Row for this Request. Used when you have associations.

Specified by:
setBaseRow in interface IMagicRequest

setBaseRowCollection

public void setBaseRowCollection(RowCollection pBaseRowCollection)
Set the based on RowCollection for this Request.


setCompleted

public void setCompleted(boolean pCompleted,
                         javax.servlet.http.HttpServletRequest request)
Sets the state of the magic request to finished executing


setEndNavigationGroup

public void setEndNavigationGroup(boolean endGroup)

setFailMessage

public void setFailMessage(String message)
Deprecated. - only temporarily added to support custom fail messages

Message to set in the request if this "Magic Request" fails attempting to run.

Parameters:
message - fail message to set in the request

setId

public void setId(String pId)
Sets the id used to store this magic request in the session.


setNextURI

public void setNextURI(String uri)
Set the URI of the next page to call. This method counters any template pages previously set. When the magic request finishes executing, the uri parameter will be called. If the uri should be included in a template, then setNextURI(String, String) should be called.


setNextURI

public void setNextURI(String section,
                       String uri)
Set the URI of the next page to call.


setNextURIs

public void setNextURIs(LayoutDisplayPropertyGroup props)

setPopup

public void setPopup(boolean newPopup)
Sets if this request should execute in a popup window. If true, there will be no header, TOC, or footer, and the popup window will be closed when this request's navigation group ends


setRequestGroupAttribute

public static void setRequestGroupAttribute(String key,
                                            Object value,
                                            javax.servlet.http.HttpServletRequest request)

setRequestPageAttribute

public static void setRequestPageAttribute(String key,
                                           Object value,
                                           javax.servlet.http.HttpServletRequest request)
Sets an attribute on the request that is associated with this page. If the user navigates away from the page displayed from this request, and then returns via the "Cancel" button or other backwards navigation, any attributes stored in the request with this method will be restored to the request.


setRequestPersistentAttribute

public static void setRequestPersistentAttribute(String key,
                                                 Object value,
                                                 javax.servlet.http.HttpServletRequest request)
Sets an attribute on the request that will be persisted. If the user navigates via a MagicRequest, any attribute set via this method will be propagated to the next HttpServletRequest.


setRequestTransientAttribute

public static void setRequestTransientAttribute(String key,
                                                Object value,
                                                javax.servlet.http.HttpServletRequest request)
Sets an attriubte on the request that will not be automatically transferred to another request. This is how request attributes "normally" work.


setReturnToRequester

public void setReturnToRequester(boolean returnToRequester)
Returns whether or not the magic request needs to be returned to the requester. Defaults to true. If any "Magic" requests do not require return to the requester, then this method should be overridden.


setRowEventListener

public void setRowEventListener(IRowEventListener newRowEventListener)
Sets the RowEventListener on this MagicReqest. Creation date: (7/11/2002 11:18:06 AM)

Specified by:
setRowEventListener in interface IMagicRequest
Parameters:
newRowEventListener - planetj.database.IRowEventListener

setSessionAttribute

public static void setSessionAttribute(String pKey,
                                       Object pValue,
                                       javax.servlet.http.HttpServletRequest pRequest)
Sets the specified object in the HTTPSession. This provides a single place with potential error logging and programatic debug instead of all users setting objects into the session.

Parameters:
pRequest - request containing session to store the specified object in.
pValue - the object being stored in the session.

setSessionSharedAttribute

public static void setSessionSharedAttribute(String key,
                                             Object value,
                                             javax.servlet.http.HttpServletRequest request)
Sets the specified object in the HttpSession. This provides a single place with potential error logging and programatic debug instead of all users setting objects into the session.


setStartNewNavigationGroup

public void setStartNewNavigationGroup(boolean startNew)

setSuccessMessage

public void setSuccessMessage(String message)
Message to set in the request if this "Magic Request" runs successful.

Parameters:
message - success message to set in the request

store

public IMagicRequest store(javax.servlet.http.HttpServletRequest request)
Store this MagicRequest in the user's session to the DataEngineServlet can get at it when requested