01: /*
02: * Created on 12 Jul 2007
03: */
04: package uk.org.ponder.rsf.swf.viewparams;
05:
06: import java.util.HashMap;
07: import java.util.Map;
08:
09: import uk.org.ponder.rsf.viewstate.AnyViewParameters;
10: import uk.org.ponder.rsf.viewstate.SimpleViewParameters;
11: import uk.org.ponder.rsf.viewstate.ViewParameters;
12:
13: /** A base class for ViewParameters referencing a view handled by the
14: * Spring Web Flow system. This differs somewhat from the native RSF
15: * semantics in that the <code>viewID</code> field is disused, since an
16: * SWF ViewParameters cannot designate a concrete destination view, this
17: * is instead decoded from the flow definition.
18: * <p>This type may be declared directly as the ViewParameters type of any
19: * view which wishes to be the visible dispatch target of an SWF transition
20: * (this would largely be for visual purposes in the URL).
21: * @author Antranig Basman (antranig@caret.cam.ac.uk)
22: *
23: */
24:
25: public class SWFViewParams extends SimpleViewParameters {
26: /** This is a default viewID used if the user does not specify a physical one.
27: In fact the ViewParameters of any view which explicitly declares an SWFViewParams
28: as its native type may be used. */
29: public static final String SWF_VIEW = "_webflow";
30:
31: /** The event to be fired on this transition - either this field or {@link #flowId} is set**/
32: public String event;
33:
34: /** The ID of the flow to be launched - either this field or {@link #event} is set */
35: public String flowId;
36:
37: /** The execution key for this flow step **/
38: public String flowExecutionKey;
39:
40: /** The "nested" view parameter state - either this field of {@link #params} is set */
41: public ViewParameters target;
42:
43: /** Raw representation of the view parameter state - either this field or {@link #target} is set */
44: public Map params;
45:
46: public String getParseSpec() {
47: return super .getParseSpec()
48: + ",_event:event,_flowId:flowId,_flowExecutionKey:flowExecutionKey";
49: }
50:
51: public SWFViewParams() {
52: viewID = SWF_VIEW;
53: }
54:
55: /** Constructs an SWF ViewParams that will step no flow event **/
56: public SWFViewParams(ViewParameters target) {
57: this ();
58: this .target = target;
59: }
60:
61: public SWFViewParams(Map params) {
62: this ();
63: this .params = params;
64: }
65:
66: public ViewParameters copyBase() {
67: SWFViewParams togo = (SWFViewParams) super .copyBase();
68: if (params != null) {
69: togo.params = new HashMap();
70: togo.params.putAll(params);
71: }
72: if (target != null) {
73: togo.target = target.copyBase();
74: }
75: return togo;
76: }
77: }
|