1 /*
2 * Copyright 2001,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.commons.scaffold.util;
18
19 import java.util.List;
20
21 // ----------------------------------------------------------------------
22
23 /**
24 * Convenient wrapper for the result of a process.
25 * <p>
26 * The result property returns any object generated by the
27 * process that is to be returned to the presentation tier.
28 *
29 * The <b>messages</b> property is a list of any confirmation
30 * messages to be displayed by the presentation tier.
31 * These may be keys into a resource bundle, or literal text,
32 * depending on whether the application is localized.
33 *
34 * The <b>dispatchPath</b> property returns any special advice regarding
35 * the next step in the workflow. Null indicates the nominal "success"
36 * path should be followed.
37 *
38 * The <b>data</b> property is any actual data returned from storage.
39 * This may be a single record or a collection of records
40 * (see <code>isSingleForm()</code>).
41 *
42 * @author Ted Husted
43 * @author Synthis Corporation
44 * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
45 * @deprecated Use BizResponse instead
46 */
47 public interface ProcessResult {
48
49 /**
50 * Return the attribute name for the result object.
51 * <p>
52 * Typically, this will be set by the caller but is provided
53 * in case a special name must be used or a way is needed to
54 * distingish between result objects.
55 *
56 * @return the name
57 */
58 public String getName();
59
60
61 /**
62 * Set the attribute name for this result object.
63 *
64 * @param name The new name
65 */
66 public void setName(String name);
67
68
69 /**
70 * Return the scope under which to store this result object.
71 *
72 * @return the scope
73 */
74 public String getScope();
75
76
77 /**
78 * Set the scope under which to store this result object.
79 *
80 * @param scope The new scope
81 */
82 public void setScope(String scope);
83
84
85
86 /**
87 * Return the single-form state:
88 * list of 0 or more records=FALSE, exactly one record=TRUE.
89 *
90 * @return True if this is a single record
91 */
92 public boolean isSingleForm();
93
94
95 /**
96 * Set the single-form state:
97 * list of 0 or more records=FALSE, exactly one record=TRUE.
98 *
99 * @param Set to true for single form.
100 */
101 public void setSingleForm(boolean singleForm);
102
103
104 /**
105 * Return the exposed state.
106 *
107 * @return True if the result should be exposed
108 */
109 public boolean isExposed();
110
111
112 /**
113 * Indicates whether the result should be exposed
114 * to the rest of the application through a context.
115 *
116 * @param multiple The new exposed
117 */
118 public void setExposed(boolean exposed);
119
120
121 /**
122 * Return the data object.
123 *
124 * @return The data object
125 */
126 public Object getData();
127
128
129 /**
130 * Assign a new data object.
131 *
132 * @param data The new data object
133 */
134 public void setData(Object data);
135
136
137 /**
138 * Return whether data object has been set.
139 *
140 * @return True if this result contains a data object
141 */
142 public boolean isData();
143
144
145 /**
146 * Return whether the result of this ProcessResult is a collection of
147 * contains other ProcessResult objects to be handled individually.
148 * This allows processes to be combined on the business tier and
149 * returned to controller as a single operation.
150 *
151 * @return True if this ProcessResult contains other ProcessResults
152 * objects
153 */
154 public boolean isAggregate();
155
156
157 /**
158 * Assign a new container state.
159 *
160 * @param aggregate Set to true for aggregate result
161 */
162 public void setAggregate(boolean aggregate);
163
164
165 /**
166 * Return the messages list.
167 *
168 * @return The message list
169 */
170 public List getMessages();
171
172
173 /**
174 * Return whether there are any messages queued.
175 *
176 * @return True if there are messages queued.
177 */
178 public boolean isMessages();
179
180
181 /**
182 * Add a message to the list.
183 * Instantiate messages if it does not already exist.
184 *
185 * @return True if message added.
186 */
187 public boolean addMessage(Object message);
188
189
190 /**
191 * The dispatch property can be used to re-route control to an non-default location,
192 * either as a system path or via a logical name (e.g ActionForward).
193 *
194 * @see <code>setDispatchPath()</code>
195 *
196 * @return The dispatch advice
197 */
198 public String getDispatch();
199
200
201 /**
202 * Field to store dispatch property.
203 */
204 public void setDispatch(String dispatch);
205
206
207 /**
208 * Return whether dispatch advice has been set.
209 *
210 * @return True if dispatch advice has been set.
211 */
212 public boolean isDispatch();
213
214
215 /**
216 * Return whether dispatch advice is suppose to be a
217 * true path or a logical name (e.g. ActionForward)
218 *
219 * @return True if dispatch advice is an actual path
220 */
221 public boolean isDispatchPath();
222
223
224 /**
225 * Indicates whether dispatch advice (if any) is suppose to be a
226 * path or a logical name (e.g. ActionForward).
227 *
228 * @param dispatchPath The new dispatch advice
229 */
230 public void setDispatchPath(boolean dispatchPath);
231
232 }