001 /* 002 * Copyright 2001,2004 The Apache Software Foundation. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017 package org.apache.commons.scaffold.util; 018 019 import java.util.List; 020 021 // ---------------------------------------------------------------------- 022 023 /** 024 * Convenient wrapper for the result of a process. 025 * <p> 026 * The result property returns any object generated by the 027 * process that is to be returned to the presentation tier. 028 * 029 * The <b>messages</b> property is a list of any confirmation 030 * messages to be displayed by the presentation tier. 031 * These may be keys into a resource bundle, or literal text, 032 * depending on whether the application is localized. 033 * 034 * The <b>dispatchPath</b> property returns any special advice regarding 035 * the next step in the workflow. Null indicates the nominal "success" 036 * path should be followed. 037 * 038 * The <b>data</b> property is any actual data returned from storage. 039 * This may be a single record or a collection of records 040 * (see <code>isSingleForm()</code>). 041 * 042 * @author Ted Husted 043 * @author Synthis Corporation 044 * @version $Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $ 045 * @deprecated Use BizResponse instead 046 */ 047 public interface ProcessResult { 048 049 /** 050 * Return the attribute name for the result object. 051 * <p> 052 * Typically, this will be set by the caller but is provided 053 * in case a special name must be used or a way is needed to 054 * distingish between result objects. 055 * 056 * @return the name 057 */ 058 public String getName(); 059 060 061 /** 062 * Set the attribute name for this result object. 063 * 064 * @param name The new name 065 */ 066 public void setName(String name); 067 068 069 /** 070 * Return the scope under which to store this result object. 071 * 072 * @return the scope 073 */ 074 public String getScope(); 075 076 077 /** 078 * Set the scope under which to store this result object. 079 * 080 * @param scope The new scope 081 */ 082 public void setScope(String scope); 083 084 085 086 /** 087 * Return the single-form state: 088 * list of 0 or more records=FALSE, exactly one record=TRUE. 089 * 090 * @return True if this is a single record 091 */ 092 public boolean isSingleForm(); 093 094 095 /** 096 * Set the single-form state: 097 * list of 0 or more records=FALSE, exactly one record=TRUE. 098 * 099 * @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 }