Java Doc for Transition.java in  » J2EE » Expresso » com » jcorporate » expresso » core » controller » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Expresso » com.jcorporate.expresso.core.controller 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.jcorporate.expresso.core.controller.ControllerElement
      com.jcorporate.expresso.core.controller.Transition

Transition
public class Transition extends ControllerElement implements Cloneable,java.io.Serializable(Code)

An Transition is a choice that the user can make that initiates either another sequence in this same controller or some new controller. A transition is one of the three types of objects that a controller produces when it enters a new state, the others being Input objects and Output objects.

Another use of a Transition object is for internal transitioning between various controllers and their states. Typical example is as follows:

 Transition t = new Transition();
 t.setControllerObject(com.myapp.MyController.class);
 t.setState("State2");
 t.addParameter("SampleParam","This is a parameter value");
 return t.transition();
 

Recognized Attributes:

The following types are recognized by the expresso framework and automatically rendered: You may add your own types or ignore them if you are doing your own page rendering.

header: Renders the transition in the jc-header class style

button: Renders the transition as a button.

default behavior: Renders as a clickable button




Constructor Summary
public  Transition()
     Default Constructor.
public  Transition(String newState, Controller myController)
     Convenience method to transition to another state in this same controller.
Parameters:
  newState - the new name of the state.
Parameters:
  myController - An instantiated Controller object.
public  Transition(String newLabel, String newObject)
     Convenience constructor to create an action with a label and a controller already set.
public  Transition(String newName, String newLabel, String newObject)
     Convenience constructor to create an action with a label and a controller already set.
public  Transition(String name, String label, Class controllerClass, String controllerState)
     Convenience method to allow for one line of code to construct a transition.
public  Transition(String label, Class controllerClass, String controllerState)
     Convenience method to allow for one line of code to construct a transition.

Method Summary
public synchronized  voidaddParam(String paramCode, String paramValue)
     Adds a parameter to a transition.
public  Objectclone()
    
public  voidenableReturnToSender(ControllerResponse response)
     Call this method when the state/controller being transitioned to should return control back to the calling state once it has 'completed' successfully.
public static  TransitionfromXML(String newTransition)
    
public static  ControllerElementfromXML(Node n)
    
public  StringgetControllerObject()
     Return the name of the controller object that this Transition referred to.
public  StringgetFullUrl()
     Similar to getURL but also includes the context path.
public  StringgetHTMLParamString()
     Returns a hidden form field string that is safe in either the GET or POST case.
public  StringgetMapping()
     This function returns the mapping of the Struts action (including the .do part) but without a context prepended to the mapping.
public  StringgetOwnerController()
     Sets the controller that created this transition.
public  StringgetParam(String paramCode)
     Return the value for a specific parameter for this transition object.
public synchronized  StringgetParamString(boolean includeControllerParameter)
    
Parameters:
  includeControllerParameter - whether to include controller param or not.
public  StringgetParamString()
     Return a string of the current params This is NOT URL encoded string.
public  HashtablegetParams()
     Return the hashtable of parameters for this transition object.
public  HttpServletResponsegetServletResponse()
    
public  StringgetState()
    
public  StringgetTheUrl(boolean resolveControllerReference)
     Internal use for retrieving the URL that this transition points to.
Parameters:
  resolveControllerReference - should the controller be resolved toa mapping, or should it just be the request path with a controller equalsparameter.
public  StringgetUrl()
     Returns a URL reference for this transition.
public  booleanisExternalTransition(String runningController)
     Returns True if the destination for this transition is a different controller from the one currently active.
Parameters:
  runningController - the name of the controller we're currently in.Usually you woulduse this.getClass().getName() within your own controller asa parameter.
public  booleanisRecursiveTransition(String runningState, String runningController)
     Returns True if the destination for this transition is the same as the currently active state.
public  booleanisReturnToSenderEnabled()
     Return the return-to-sender flag.
protected  ControllerResponsenewStateDispatch(ControllerRequest request)
     This method invokes a new controller by dispatching to it rather than calling it directly.
public  voidredirectTransition(ControllerRequest request, ControllerResponse response)
     Transition to a new controller and state by issuing a Redirect request to the browser.
public synchronized  voidsetControllerObject(String newObject)
    
public synchronized  voidsetControllerObject(Class c)
     Mor Typesafe way of setting the controller object.
public synchronized  voidsetControllerResponse(ControllerResponse newResponse)
     Override of the normal setControllerResponse so that the HttpServletResponse is also set for this particular transition.
public synchronized  voidsetOwnerController(String newController)
     Sets the controller that created this transition.
public synchronized  voidsetParams(Hashtable newParams)
     Set this transition's parameters to the passed in collection.
public synchronized  voidsetReturnToSenderParms(ControllerRequest newReturnToSenderRequest)
     This method will take the request parameters that were passed to this state and will copy them into this transition's parameters.
public  voidsetServletResponse(HttpServletResponse servletResponse)
     Low level, sets the servlet response.
public synchronized  voidsetState(String newState)
     Sets the target state to transition to.
public  FastStringBuffertoXML(FastStringBuffer stream)
     Convert the object to an xml fragment.
Parameters:
  stream - an instantiated FastStringBuffer to which we append to.
public  ControllerResponsetransition(ControllerRequest req, ControllerResponse res)
     Run this transition - e.g.
public  ControllerResponsetransition(ControllerRequest req, ControllerResponse res, boolean clear)
     Run this transition - e.g.


Constructor Detail
Transition
public Transition()(Code)
Default Constructor. Normally you don't use this.



Transition
public Transition(String newState, Controller myController)(Code)
Convenience method to transition to another state in this same controller.
Parameters:
  newState - the new name of the state.
Parameters:
  myController - An instantiated Controller object. Use a ControllerFactoryto instantiate the controller if you must use this constructor.



Transition
public Transition(String newLabel, String newObject)(Code)
Convenience constructor to create an action with a label and a controller already set.
Parameters:
  newLabel - Label for the new action
Parameters:
  newObject - The name of the object this action referred to



Transition
public Transition(String newName, String newLabel, String newObject)(Code)
Convenience constructor to create an action with a label and a controller already set.
Parameters:
  newName - Name of this Transition object
Parameters:
  newLabel - Label for the new action
Parameters:
  newObject - The name of the Controller object this action referred to



Transition
public Transition(String name, String label, Class controllerClass, String controllerState)(Code)
Convenience method to allow for one line of code to construct a transition.
Parameters:
  name - The name of the transition
Parameters:
  label - The label to use for the transition
Parameters:
  controllerClass - The Class of the controller to use
Parameters:
  controllerState - The name of the controller's state.



Transition
public Transition(String label, Class controllerClass, String controllerState)(Code)
Convenience method to allow for one line of code to construct a transition. The (internal) name of the transition will be the state name.
Parameters:
  label - The label to use for the transition
Parameters:
  controllerClass - The Class of the controller to use
Parameters:
  controllerState - The name of the controller's state.




Method Detail
addParam
public synchronized void addParam(String paramCode, String paramValue)(Code)
Adds a parameter to a transition. These parameters are meant to be eventually consumed by the target controller via the request.getParameter() method.
Parameters:
  paramCode - The code name of the parameter
Parameters:
  paramValue - The value for the paramter



clone
public Object clone() throws CloneNotSupportedException(Code)
Returns a copy of itself a cloned and instantiated Transition object.
throws:
  CloneNotSupportedException - as required by the methodsignature.



enableReturnToSender
public void enableReturnToSender(ControllerResponse response) throws ControllerException(Code)
Call this method when the state/controller being transitioned to should return control back to the calling state once it has 'completed' successfully. Th 'completion' point depends on whether the transition is to an external (new controller) or internal state. For external transitions, the completion point is once the Final state has run successfully. For internal transitions, the completion point is once the called state has run successfully.

When this method is called with a non-null response parameter, this indicates the currently running state should be the return address. If this method is called with a null response parameter then this indicates that the return address should be determined at transition execution time. This is useful/necessary when a transition is instantiated outside the scope of a state execution. For example, when the controllerSecurityTransition value is set in the controller constructor, the return state is not known/active.
Parameters:
  response - the ControllerResponse object
throws:
  ControllerException - upon error




fromXML
public static Transition fromXML(String newTransition) throws ControllerException(Code)
Return a Transition based upon the String based xml fragment
Parameters:
  newTransition - an xml fragment an instantiated Transition object
throws:
  ControllerException - upon error



fromXML
public static ControllerElement fromXML(Node n) throws ControllerException(Code)
Return a controller element based upon the xml fragment
Parameters:
  n - a DOM Node object an instantiated ControllerElement
throws:
  ControllerException - upon error



getControllerObject
public String getControllerObject()(Code)
Return the name of the controller object that this Transition referred to. If this is null, then it refers to the same controller object (e.g. intra-controller transition) The class name of the controller object this actionrefers to.



getFullUrl
public String getFullUrl() throws ControllerException(Code)
Similar to getURL but also includes the context path. Useful for working with JSTL cout expressions inside an <a> link.

If the ControllerResponse has been set and running in a servlet environment, then this function also encodes the resulting URL with suitable session id's if necessary too

This URL is optimized, so it includes a Controller.CONTROLLER_PARAM_KEY param only if the destination controller is different than the controller of the ControllerResponse (if the response is known). java.lang.String
throws:
  ControllerException - upon error.
See Also:   Transition.getTheUrl



getHTMLParamString
public String getHTMLParamString()(Code)
Returns a hidden form field string that is safe in either the GET or POST case.

Creation date: (1/10/01 11:24:00 AM) author: Adam Rossi, PlatinumSolutions java.lang.String




getMapping
public String getMapping() throws ControllerException(Code)
This function returns the mapping of the Struts action (including the .do part) but without a context prepended to the mapping. java.lang.String



getOwnerController
public String getOwnerController()(Code)
Sets the controller that created this transition. If controllerObject equals owner controller, then no controller= parameter is generated. the owner controller



getParam
public String getParam(String paramCode)(Code)
Return the value for a specific parameter for this transition object.
Parameters:
  paramCode - The code (name) of the parameter The value of the parameter as a string



getParamString
public synchronized String getParamString(boolean includeControllerParameter)(Code)

Parameters:
  includeControllerParameter - whether to include controller param or not. parameter string which includes all params added to trans, as wellas state param. controller param added optionally



getParamString
public String getParamString()(Code)
Return a string of the current params This is NOT URL encoded string. Use either getUrl() OR java.net.URLEncoder() to do this job. java.lang.String



getParams
public Hashtable getParams()(Code)
Return the hashtable of parameters for this transition object. These parameters are to be handed to the new controller when the action is called. A hashtable of name/value pairs for the parameters



getServletResponse
public HttpServletResponse getServletResponse()(Code)
Gets an underlying ServletResponse if it has been set either through setting the controller response or manually HttpServletResponse or NULL if not being used.



getState
public String getState()(Code)
Retrieve the currently set state java.lang.String



getTheUrl
public String getTheUrl(boolean resolveControllerReference) throws ControllerException(Code)
Internal use for retrieving the URL that this transition points to.
Parameters:
  resolveControllerReference - should the controller be resolved toa mapping, or should it just be the request path with a controller equalsparameter. True if you want the URL mapped to a .do mapping. java.lang.String
throws:
  ControllerException - if there is an error or there is no controllerresponse object available to help resoolve the reference.



getUrl
public String getUrl() throws ControllerException(Code)
Returns a URL reference for this transition. The URL does NOT include the context path. java.lang.String
throws:
  ControllerException - upon error



isExternalTransition
public boolean isExternalTransition(String runningController)(Code)
Returns True if the destination for this transition is a different controller from the one currently active.
Parameters:
  runningController - the name of the controller we're currently in.Usually you woulduse this.getClass().getName() within your own controller asa parameter. true if this is a transition to a another controller.



isRecursiveTransition
public boolean isRecursiveTransition(String runningState, String runningController)(Code)
Returns True if the destination for this transition is the same as the currently active state. Avoid infinite loop.
Parameters:
  runningState - the current state
Parameters:
  runningController - the current controller true if we're recusing to the same state and controller as we'realready in.



isReturnToSenderEnabled
public boolean isReturnToSenderEnabled()(Code)
Return the return-to-sender flag. boolean



newStateDispatch
protected ControllerResponse newStateDispatch(ControllerRequest request) throws ControllerException, NonHandleableException(Code)
This method invokes a new controller by dispatching to it rather than calling it directly. This is required when transitioning to external states so that Struts can setup the controller form.

The currently active controller request is passed to the new state to simulate a direct call to the state. The request is then picked up by the controller's perform method. Any exceptions raised by the target state will filter back here to be passed on. This approach was needed in order to simulate a direct call the the state while at the same time allowing Struts to setup the controller form.
Parameters:
  request - the ControllerRequest Object an instantiated ControllerResponse object




redirectTransition
public void redirectTransition(ControllerRequest request, ControllerResponse response) throws ControllerException(Code)
Transition to a new controller and state by issuing a Redirect request to the browser. This can only be used in a Servlet environment, and is mainly useful when you want the URL for the browser to change after a request, so for example, after making an online purchase, you display the invoice, but if the user hit's refresh, you don't want the processing to occur again.
Parameters:
  request - The ControllerRequest object handed to you by the framework
Parameters:
  response - the ControllerResponse object handed to you by the framework



setControllerObject
public synchronized void setControllerObject(String newObject)(Code)
Set the Controller that this action referrs to
Parameters:
  newObject - Name of the Controller object that this Transition refers to



setControllerObject
public synchronized void setControllerObject(Class c)(Code)
Mor Typesafe way of setting the controller object. Any typos will be caught at compile time. Example usage:
 Transition t = new Transition();
 t.setControllerObject(com.jcorporate.expresso.services.Status.class);
 

Parameters:
  c - the class of the controller object to add.



setControllerResponse
public synchronized void setControllerResponse(ControllerResponse newResponse)(Code)
Override of the normal setControllerResponse so that the HttpServletResponse is also set for this particular transition.
Parameters:
  newResponse - the controllerResponse to set.



setOwnerController
public synchronized void setOwnerController(String newController)(Code)
Sets the controller that created this transition. If controllerObject equals owner controller, then no controller= parameter is generated.
Parameters:
  newController - the classname of the new controller



setParams
public synchronized void setParams(Hashtable newParams)(Code)
Set this transition's parameters to the passed in collection.
Parameters:
  newParams - the new parameters in bulk



setReturnToSenderParms
public synchronized void setReturnToSenderParms(ControllerRequest newReturnToSenderRequest)(Code)
This method will take the request parameters that were passed to this state and will copy them into this transition's parameters. These parameters will then be used when this state is reinvoked (return-to-sender) in order to re-establish the parameter context.
Parameters:
  newReturnToSenderRequest - The ControllerRequest object



setServletResponse
public void setServletResponse(HttpServletResponse servletResponse)(Code)
Low level, sets the servlet response. Normally you won't use this function except under specialty situations where you are using a Transition more as a URL generator
Parameters:
  servletResponse - a servlet response object for encoding URLs



setState
public synchronized void setState(String newState)(Code)
Sets the target state to transition to.
Parameters:
  newState - java.lang.String



toXML
public FastStringBuffer toXML(FastStringBuffer stream)(Code)
Convert the object to an xml fragment.
Parameters:
  stream - an instantiated FastStringBuffer to which we append to. a FastStringBuffer object



transition
public ControllerResponse transition(ControllerRequest req, ControllerResponse res) throws ControllerException, NonHandleableException(Code)
Run this transition - e.g. transition to the new state of the specified controller object immediately, setting the specified response to the response of this new controller/state, discarding any previous response
Parameters:
  req - The ControllerRequest object handed to you by the framework
Parameters:
  res - the ControllerResponse object handed to you by the framework the ControllerResponse Object from the called controller
throws:
  ControllerException - upon error
throws:
  NonHandleableException - upon fatal error



transition
public ControllerResponse transition(ControllerRequest req, ControllerResponse res, boolean clear) throws ControllerException, NonHandleableException(Code)
Run this transition - e.g. transition to the new state of the specified controller object immediately, setting the specified response to the response of this new controller/state, discarding any previous response (if "clear" is specified)

NB: all parameters in the original request are discarded, except those that are explicit params added to this Transition. Therefore, if you have a param X in the original state, and you need it in the upcoming state, use addParam() to preserve it, OR use the ControllerResponse.setFormCache() to save them before the transition(),
Parameters:
  req - The ControllerRequest object handed to you by the framework
Parameters:
  res - the ControllerResponse object handed to you by the framework
Parameters:
  clear - True clears the response object before adding the outputsfrom the called controller? the ControllerResponse Object from the called controller
throws:
  ControllerException - upon error
throws:
  NonHandleableException - upon fatal error
See Also:   ControllerResponse.setFormCache
See Also:   


See Also:   and response.getFormCache(paramName) to retrieve them
See Also:   ControllerResponse.getFormCache(String)




Methods inherited from com.jcorporate.expresso.core.controller.ControllerElement
public void addNested(ControllerElement e)(Code)(Java Doc)
public Vector allNested()(Code)(Java Doc)
public Object clone() throws java.lang.CloneNotSupportedException(Code)(Java Doc)
public static ControllerElement fromXML(Node n) throws ControllerException(Code)(Java Doc)
protected static ControllerElement fromXML(Node n, ControllerElement ce) throws ControllerException(Code)(Java Doc)
public String getAttribute(String att)(Code)(Java Doc)
public HashMap getAttributes()(Code)(Java Doc)
public HashMap getAttributesOrNull()(Code)(Java Doc)
public ControllerElement getContent(String name)(Code)(Java Doc)
public Vector getContents()(Code)(Java Doc)
protected ControllerResponse getControllerResponse()(Code)(Java Doc)
public String getDescription()(Code)(Java Doc)
public int getDisplayLength()(Code)(Java Doc)
public String getLabel()(Code)(Java Doc)
public int getLines()(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public Vector getNested()(Code)(Java Doc)
public ControllerElement getNested(String nestedName) throws ControllerException(Code)(Java Doc)
public int getNestedCount()(Code)(Java Doc)
public Iterator getNestedIterator()(Code)(Java Doc)
public Map getNestedMap()(Code)(Java Doc)
public Vector getNestedOrNull()(Code)(Java Doc)
public ControllerElement getParent()(Code)(Java Doc)
public String getTitle()(Code)(Java Doc)
public String getType()(Code)(Java Doc)
public void remove() throws ControllerException(Code)(Java Doc)
public void removeNested(ControllerElement elementToRemove) throws ControllerException(Code)(Java Doc)
public void setAttribute(String attrib, String val)(Code)(Java Doc)
public synchronized void setControllerResponse(ControllerResponse newResponse)(Code)(Java Doc)
public void setDescription(String newDescription)(Code)(Java Doc)
public void setDisplayLength(int newLength)(Code)(Java Doc)
public void setLabel(String newLabel)(Code)(Java Doc)
public void setLines(int newLines)(Code)(Java Doc)
public void setName(String newName)(Code)(Java Doc)
public void setParent(ControllerElement t)(Code)(Java Doc)
public void setType(String s)(Code)(Java Doc)
public FastStringBuffer toXML(FastStringBuffer stream)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.