001: /*
002: WikiForms - a WikiPage FORM handler for JSPWiki.
003:
004: Copyright (C) 2003 BaseN.
005:
006: JSPWiki Copyright (C) 2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
007:
008: This program is free software; you can redistribute it and/or modify
009: it under the terms of the GNU Lesser General Public License as published
010: by the Free Software Foundation; either version 2.1 of the License, or
011: (at your option) any later version.
012:
013: This program is distributed in the hope that it will be useful,
014: but WITHOUT ANY WARRANTY; without even the implied warranty of
015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: GNU Lesser General Public License for more details.
017:
018: You should have received a copy of the GNU Lesser General Public License
019: along with this program; if not, write to the Free Software
020: */
021: package com.ecyrd.jspwiki.forms;
022:
023: import java.io.Serializable;
024: import java.util.HashMap;
025: import java.util.Map;
026:
027: /**
028: * Container for carrying HTTP FORM information between
029: * WikiPlugin invocations in the Session.
030: *
031: * @author ebu
032: */
033: public class FormInfo implements Serializable {
034: private static final long serialVersionUID = 0L;
035:
036: public static final int EXECUTED = 1;
037: public static final int OK = 0;
038: public static final int ERROR = -1;
039:
040: public int m_status;
041: public boolean m_hide;
042: public String m_action;
043: public String m_name;
044: public String m_handler;
045: public String m_result;
046: public String m_error;
047: //public PluginParameters submission;
048: public Map m_submission;
049:
050: public FormInfo() {
051: m_status = OK;
052: }
053:
054: public void setStatus(int val) {
055: m_status = val;
056: }
057:
058: public int getStatus() {
059: return m_status;
060: }
061:
062: public void setHide(boolean val) {
063: m_hide = val;
064: }
065:
066: public boolean hide() {
067: return m_hide;
068: }
069:
070: public void setAction(String val) {
071: m_action = val;
072: }
073:
074: public String getAction() {
075: return m_action;
076: }
077:
078: public void setName(String val) {
079: m_name = val;
080: }
081:
082: public String getName() {
083: return m_name;
084: }
085:
086: public void setHandler(String val) {
087: m_handler = val;
088: }
089:
090: public String getHandler() {
091: return m_handler;
092: }
093:
094: public void setResult(String val) {
095: m_result = val;
096: }
097:
098: public String getResult() {
099: return m_result;
100: }
101:
102: public void setError(String val) {
103: m_error = val;
104: }
105:
106: public String getError() {
107: return m_error;
108: }
109:
110: /**
111: * Copies the given values into the handler parameter map using Map.putAll().
112: * @param val parameter name-value pairs for a Form handler WikiPlugin
113: */
114: public void setSubmission(Map val) {
115: m_submission = new HashMap();
116: m_submission.putAll(val);
117: }
118:
119: /**
120: * Adds the given values into the handler parameter map.
121: * @param val parameter name-value pairs for a Form handler WikiPlugin
122: */
123: public void addSubmission(Map val) {
124: if (m_submission == null)
125: m_submission = new HashMap();
126: m_submission.putAll(val);
127: }
128:
129: /**
130: * Returns parameter name-value pairs for a Form handler WikiPlugin.
131: * The names are those of Form input fields, and the values whatever
132: * the user selected in the form. The FormSet plugin can also be used
133: * to provide initial values.
134: *
135: * @return Handler parameter name-value pairs.
136: */
137: public Map getSubmission() {
138: return m_submission;
139: }
140: }
|