KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > za > org > coefficient > interfaces > CoefficientContext


1 /*
2  * Coefficient - facilitates project based collaboration
3  * Copyright (C) 2003, Dylan Etkin, CSIR icomtek
4  * PO Box 395
5  * Pretoria 0001, RSA
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package za.org.coefficient.interfaces;
21
22 import org.apache.commons.fileupload.FileUploadException;
23 import org.apache.commons.httpclient.Cookie;
24
25 import za.co.csir.icomtek.workflow.interfaces.WorkflowContext;
26 import za.org.coefficient.authentication.CoefficientUser;
27 import za.org.coefficient.core.Project;
28 import za.org.coefficient.exception.ConfigurationException;
29 import za.org.coefficient.html.Page;
30 import za.org.coefficient.util.common.BaseMultipartRequest;
31 import za.org.coefficient.util.common.UploadedFile;
32
33 import java.io.IOException JavaDoc;
34 import java.util.Date JavaDoc;
35 import java.util.HashMap JavaDoc;
36
37 /**
38  * DOCUMENT ME!
39  *
40  * @author $author$
41  * @version $Revision: 1.7 $
42  */

43 public interface CoefficientContext extends WorkflowContext {
44     //~ Methods ================================================================
45

46     public void setCookie(Cookie cookie);
47
48     public Cookie[] getCookies();
49
50     /**
51      * If a user is logged in this will return that user otherwise it will
52      * return null
53      *
54      * @return the logged in user or null if not logged in
55      */

56     public CoefficientUser getCurrentUser();
57
58     /**
59      * Passthru method to set the error content on the internal Page object
60      *
61      * @param html a String containing the html content defining an error
62      * display
63      */

64     public void setError(String JavaDoc html);
65
66     public boolean isError();
67
68     /**
69      * This will forward to the module and perform its main method
70      */

71     public void setForward(String JavaDoc moduleName) throws ConfigurationException;
72
73     /**
74      * This will forward to the module and perform the method specified by
75      * op and will pass no other parameters
76      */

77     public void setForward(String JavaDoc moduleName, String JavaDoc opName)
78         throws ConfigurationException;
79
80     /**
81      * This method is used to force a redirect after the current iteration
82      * of the interceptor chain has completed.
83      *
84      * @param moduleName is the module to forward control to, this must not
85      * be null
86      * @param opName is the operation that the forwarded module should perform
87      * if this value is null then it will use the MainMethod
88      * @param params is a hashmap containing key-value pairs that will be
89      * additional parameters included on the request line to the
90      * specified module. If null no additional parameters will
91      * be sent
92      *
93      * @exception configuationException is thrown if module name is empty
94      * or null
95      */

96     public void setForward(String JavaDoc moduleName, String JavaDoc opName, HashMap JavaDoc params)
97         throws ConfigurationException;
98
99     /**
100      * Passthru method to set the module content on the internal Page object
101      *
102      * @param html a String containing the html content the module wants to
103      * display
104      * @param name is the result of the call to getModuleName on the module
105      * setting the content
106      */

107     public void setModuleContent(String JavaDoc html, String JavaDoc name)
108         throws RuntimeException JavaDoc;
109
110     /**
111      * force a specific theme - used primarily for printing
112      */

113     public void setModuleContent(String JavaDoc html, String JavaDoc name, String JavaDoc theme)
114         throws RuntimeException JavaDoc;
115
116     /**
117      * This method can be used to clear a modules set content from the
118      * page before it has been rendered. The content is returned so you
119      * can do what you would like with the content but it will not show
120      * up in the page unless placed there manually.
121      *
122      * @param moduleName is the name of the modules content to clear.
123      * @return is the content html string if content has been set for the
124      * module, null otherwise.
125      */

126     public String JavaDoc clearModuleContent(String JavaDoc name);
127
128     public BaseMultipartRequest getMultipartRequest() throws FileUploadException;
129
130     public Page getPage();
131
132     public String JavaDoc getTheme();
133     public void setTheme(String JavaDoc theme);
134
135     /**
136      * Passthru method to the request object.
137      *
138      * @param name a String containing the paramameter name.
139      * @return a String containing the parameter value.
140      *
141      *
142      * @see #getParameter(String,String) The getParameter() with a default value.
143      *
144      */

145     public String JavaDoc getParameter(String JavaDoc name);
146
147     /**
148      * Passthru method to the request object.
149      *
150      * @param name a String with the name of the parameter
151      * @param defaultValue if no parameter with that name is defined
152      * the return value is the defaultValue
153      * @return a String with the parameter value or
154      * the default value.
155      */

156     public String JavaDoc getParameter(String JavaDoc name, String JavaDoc defaultValue);
157
158     public boolean getParameterAsBoolean(String JavaDoc name);
159
160     public Date JavaDoc getParameterAsDate(String JavaDoc name);
161
162     public Double JavaDoc getParameterAsDouble(String JavaDoc name, double defaultValue);
163
164     public Double JavaDoc getParameterAsDouble(String JavaDoc name);
165
166     public double getParameterAsDoublePrimitive(String JavaDoc name, double defaultValue);
167
168     public int getParameterAsInt(String JavaDoc name, int defaultValue);
169
170     public Integer JavaDoc getParameterAsInteger(String JavaDoc name, int defaultValue);
171
172     public Integer JavaDoc getParameterAsInteger(String JavaDoc name);
173
174     public Long JavaDoc getParameterAsLong(String JavaDoc name, long defaultValue);
175
176     public Long JavaDoc getParameterAsLong(String JavaDoc name);
177
178     public long getParameterAsLongPrimitive(String JavaDoc name, long defaultValue);
179
180     /**
181      * Passthru method to the request object. If request
182      * is null, return an empty array of String.
183      *
184      * @param name a String containing the parameter name.
185      * @return an array of Strings with all values associated
186      *
187      */

188     public String JavaDoc[] getParameterValues(String JavaDoc name);
189
190     /**
191      * Passthru method to the request object. If request
192      * is null, return an empty array of String.
193      *
194      * @param name a String containing the parameter name.
195      * @return an array of Strings with all values associated
196      *
197      */

198     public Long JavaDoc[] getParameterValuesLong(String JavaDoc name);
199
200     public String JavaDoc[] getParametersValues(String JavaDoc name);
201
202     public void setProject(Project project);
203
204     public Project getProject();
205
206     /**
207      * Uses bean introspection to set writable properties of bean from the
208      * parameters, where a (case-insensitive) name match between the bean
209      * property and the parameter is looked for
210      *
211      * @param bean an object
212      * @return if true then all properties were successfully set, else some
213      * were not
214      */

215     public boolean setProperties(Object JavaDoc bean);
216
217     public Object JavaDoc getRequestAttribute(String JavaDoc name);
218
219     public String JavaDoc getRequestURL();
220
221     public String JavaDoc getLastNonHelpOp();
222
223     public void setSessionAttribute(String JavaDoc name, Object JavaDoc value);
224
225     public Object JavaDoc getSessionAttribute(String JavaDoc name);
226
227     public UploadedFile getUploadedFile(String JavaDoc name) throws FileUploadException;
228
229     public void setWorkflowUser(CoefficientUser workflowUser);
230
231     public void invalidateSession();
232
233     public void removeSessionAttribute(String JavaDoc name);
234
235 }
236
Popular Tags