View Javadoc

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