01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: FlowState.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine;
09:
10: import java.io.Serializable;
11: import java.util.LinkedHashMap;
12: import java.util.Map;
13:
14: public class FlowState implements Serializable {
15: private static final long serialVersionUID = -8198565791703792063L;
16:
17: private Map<String, String[]> mParameters = null;
18: private Map<String, String[]> mSubmissionGlobalInputs = null;
19: private Map<String, String[]> mSubmissionElementInputs = null;
20: private String mSubmissionContextId = null;
21:
22: public boolean isEmpty() {
23: return (null == mParameters || 0 == mParameters.size())
24: && (null == mSubmissionGlobalInputs || 0 == mSubmissionGlobalInputs
25: .size())
26: && (null == mSubmissionElementInputs || 0 == mSubmissionElementInputs
27: .size()) && null == mSubmissionContextId;
28: }
29:
30: public void putParameter(String key, String[] value) {
31: if (null == mParameters) {
32: mParameters = new LinkedHashMap<String, String[]>();
33: }
34:
35: mParameters.put(key, value);
36: }
37:
38: public void putParameter(String key, String value) {
39: putParameter(key, new String[] { value });
40: }
41:
42: public void setParameters(Map<String, String[]> parameters) {
43: mParameters = parameters;
44: }
45:
46: public boolean hasParameters() {
47: return mParameters != null && mParameters.size() > 0;
48: }
49:
50: public Map<String, String[]> getParameters() {
51: return mParameters;
52: }
53:
54: public void putSubmissionGlobalInput(String key, String[] value) {
55: if (null == mSubmissionGlobalInputs) {
56: mSubmissionGlobalInputs = new LinkedHashMap<String, String[]>();
57: }
58:
59: mSubmissionGlobalInputs.put(key, value);
60: }
61:
62: public Map<String, String[]> getSubmissionGlobalInputs() {
63: return mSubmissionGlobalInputs;
64: }
65:
66: public boolean hasSubmissionGlobalInputs() {
67: return mSubmissionGlobalInputs != null
68: && mSubmissionGlobalInputs.size() > 0;
69: }
70:
71: public void setSubmissionElementInputs(Map<String, String[]> inputs) {
72: mSubmissionElementInputs = inputs;
73: }
74:
75: public Map<String, String[]> getSubmissionElementInputs() {
76: return mSubmissionElementInputs;
77: }
78:
79: public boolean hasSubmissionElementInputs() {
80: return mSubmissionElementInputs != null
81: && mSubmissionElementInputs.size() > 0;
82: }
83:
84: public void setSubmissionContextId(String submissionContextId) {
85: mSubmissionContextId = submissionContextId;
86: }
87:
88: public String getSubmissionContextId() {
89: return mSubmissionContextId;
90: }
91: }
|