KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > business > library > struts > UnacknowledgedCommentsAction


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: UnacknowledgedCommentsAction.java,v $
31  * Revision 1.4 2005/04/29 02:48:16 colinmacleod
32  * Data bugfixes.
33  * Changed primary key back to Integer.
34  *
35  * Revision 1.3 2005/04/10 20:31:58 colinmacleod
36  * Added new themes.
37  * Changed id type to String.
38  * Changed i tag to em and b tag to strong.
39  * Improved PicoContainerFactory with NanoContainer scripts.
40  *
41  * Revision 1.2 2005/04/09 17:19:46 colinmacleod
42  * Changed copyright text to GPL v2 explicitly.
43  *
44  * Revision 1.1.1.1 2005/03/10 17:52:02 colinmacleod
45  * Restructured ivata op around Hibernate/PicoContainer.
46  * Renamed ivata groupware.
47  *
48  * Revision 1.10 2004/12/31 18:27:44 colinmacleod
49  * Added MaskFactory to constructor of MaskAction.
50  *
51  * Revision 1.9 2004/12/23 21:01:29 colinmacleod
52  * Updated Struts to v1.2.4.
53  * Changed base classes to use ivata masks.
54  *
55  * Revision 1.8 2004/11/12 18:19:15 colinmacleod
56  * Change action and form classes to extend MaskAction, MaskForm respectively.
57  *
58  * Revision 1.7 2004/11/12 15:57:16 colinmacleod
59  * Removed dependencies on SSLEXT.
60  * Moved Persistence classes to ivata masks.
61  *
62  * Revision 1.6 2004/11/03 15:31:51 colinmacleod
63  * Change method interfaces to remove log.
64  *
65  * Revision 1.5 2004/07/13 19:47:29 colinmacleod
66  * Moved project to POJOs from EJBs.
67  * Applied PicoContainer to services layer (replacing session EJBs).
68  * Applied Hibernate to persistence layer (replacing entity EJBs).
69  *
70  * Revision 1.4 2004/03/21 21:16:29 colinmacleod
71  * Shortened name to ivata op.
72  *
73  * Revision 1.3 2004/02/10 19:57:24 colinmacleod
74  * Changed email address.
75  *
76  * Revision 1.2 2004/02/01 22:07:31 colinmacleod
77  * Added full names to author tags
78  *
79  * Revision 1.1.1.1 2004/01/27 20:58:42 colinmacleod
80  * Moved ivata openportal to SourceForge..
81  *
82  * Revision 1.4 2004/01/12 14:01:03 jano
83  * fixing bugs
84  *
85  * Revision 1.3 2003/10/28 13:16:14 jano
86  * commiting library,
87  * still fixing compile and building openGroupware project
88  *
89  * Revision 1.2 2003/10/15 14:16:53 colin
90  * fixing for XDoclet
91  *
92  * Revision 1.2 2003/07/21 14:16:06 jano
93  * return to library index or list of openComments
94  * Revision 1.1 2003/06/26 09:17:46 jano
95  * first version can only hide unacknowledged comment
96  * -----------------------------------------------------------------------------
97  */

98 package com.ivata.groupware.business.library.struts;
99
100 import javax.servlet.http.HttpServletRequest JavaDoc;
101 import javax.servlet.http.HttpServletResponse JavaDoc;
102 import javax.servlet.http.HttpSession JavaDoc;
103
104 import org.apache.struts.action.ActionErrors;
105 import org.apache.struts.action.ActionForm;
106 import org.apache.struts.action.ActionMapping;
107
108 import com.ivata.groupware.admin.security.server.SecuritySession;
109 import com.ivata.groupware.business.library.Library;
110 import com.ivata.groupware.business.library.comment.CommentDO;
111 import com.ivata.mask.MaskFactory;
112 import com.ivata.mask.util.StringHandling;
113 import com.ivata.mask.util.SystemException;
114 import com.ivata.mask.web.struts.MaskAction;
115 import com.ivata.mask.web.struts.MaskAuthenticator;
116
117
118 /**
119  *<!--**********************************************************************-->
120  *
121  * <p><code>Action</code> invoked when you clicking on cross of unacknowledgedComment to remove that comment from UC list.</p>
122  * <!--**********************************************************************-->
123  * <br/>
124  * <br/><strong>Copyright &copy; 2002 ivata limited. All rights
125  * reserved.</strong>
126  * <br/>
127  * <!--**********************************************************************-->
128  * <em>
129  * <br/> $Log: UnacknowledgedCommentsAction.java,v $
130  * <br/> Revision 1.4 2005/04/29 02:48:16 colinmacleod
131  * <br/> Data bugfixes.
132  * <br/> Changed primary key back to Integer.
133  * <br/>
134  * <br/> Revision 1.3 2005/04/10 20:31:58 colinmacleod
135  * <br/> Added new themes.
136  * <br/> Changed id type to String.
137  * <br/> Changed i tag to em and b tag to strong.
138  * <br/> Improved PicoContainerFactory with NanoContainer scripts.
139  * <br/>
140  * <br/> Revision 1.1.1.1 2005/03/10 17:52:02 colinmacleod
141  * <br/> Restructured ivata op around Hibernate/PicoContainer.
142  * <br/> Renamed ivata groupware.
143  * <br/>
144  * <br/> Revision 1.10 2004/12/31 18:27:44 colinmacleod
145  * <br/> Added MaskFactory to constructor of MaskAction.
146  * <br/>
147  * <br/> Revision 1.9 2004/12/23 21:01:29 colinmacleod
148  * <br/> Updated Struts to v1.2.4.
149  * <br/> Changed base classes to use ivata masks.
150  * <br/>
151  * <br/> Revision 1.8 2004/11/12 18:19:15 colinmacleod
152  * <br/> Change action and form classes to extend MaskAction, MaskForm respectively.
153  * <br/>
154  * <br/> Revision 1.7 2004/11/12 15:57:16 colinmacleod
155  * <br/> Removed dependencies on SSLEXT.
156  * <br/> Moved Persistence classes to ivata masks.
157  * <br/>
158  * <br/> Revision 1.6 2004/11/03 15:31:51 colinmacleod
159  * <br/> Change method interfaces to remove log.
160  * <br/>
161  * <br/> Revision 1.5 2004/07/13 19:47:29 colinmacleod
162  * <br/> Moved project to POJOs from EJBs.
163  * <br/> Applied PicoContainer to services layer (replacing session EJBs).
164  * <br/> Applied Hibernate to persistence layer (replacing entity EJBs).
165  * <br/>
166  * <br/> Revision 1.4 2004/03/21 21:16:29 colinmacleod
167  * <br/> Shortened name to ivata op.
168  * <br/>
169  * <br/> Revision 1.3 2004/02/10 19:57:24 colinmacleod
170  * <br/> Changed email address.
171  * <br/>
172  * <br/> Revision 1.2 2004/02/01 22:07:31 colinmacleod
173  * <br/> Added full names to author tags
174  * <br/>
175  * <br/> Revision 1.1.1.1 2004/01/27 20:58:42 colinmacleod
176  * <br/> Moved ivata openportal to SourceForge..
177  * <br/>
178  * <br/> Revision 1.4 2004/01/12 14:01:03 jano
179  * <br/> fixing bugs
180  * <br/>
181  * <br/> Revision 1.3 2003/10/28 13:16:14 jano
182  * <br/> commiting library,
183  * <br/> still fixing compile and building openGroupware project
184  * <br/>
185  * <br/> Revision 1.2 2003/10/15 14:16:53 colin
186  * <br/> fixing for XDoclet
187  * <br/>
188  * <br/> Revision 1.2 2003/07/21 14:16:06 jano
189  * <br/> return to library index or list of openComments
190  * <br/>
191  * <br/> Revision 1.1 2003/06/26 09:17:46 jano
192  * <br/> first version can only hide unacknowledged comment
193  * <br/>
194  * </em><br/><br/><hr>
195  * <!--**********************************************************************-->
196  *
197  * @since 2003-6-25
198  * @author Jan Boros <janboros@sourceforge.net>
199  * @version $Revision: 1.4 $
200  */

201 public class UnacknowledgedCommentsAction extends MaskAction {
202     Library library;
203     /**
204      * TODO
205      * @param library
206      * @param maskFactory This factory is needed to access the masks and groups
207      * of masks.
208      * @param authenticator used to confirm whether or not the
209      * user should be allowed to continue, in the <code>execute</code> method.
210      */

211     public UnacknowledgedCommentsAction(Library library,
212             MaskFactory maskFactory, MaskAuthenticator authenticator) {
213         super(maskFactory, authenticator);
214         this.library = library;
215     }
216     /**
217      * <p>Called from the other <code>execute</code> method, this can
218      * be overridden by each subclass to provide the <em>ivata</em>-specific
219      * processing required.</p>
220      *
221      * @param mapping The ActionMapping used to select this instance.
222      * @param log valid logging object to write messages to.
223      * @param errors valid errors object to append errors to. If there are
224      * any errors, the action will return to the input.
225      * @param form optional ActionForm bean for this request (if any)
226      * @param request non-HTTP request we are processing
227      * @param response The non-HTTP response we are creating
228      * @param session returned from the <code>request</code> parameter.
229      * @param userName valid, non-null user name from session.
230      * @param settings valid, non-null settings from session.
231      * @exception SystemException if there is any problem which
232      * prevents processing. It will result in the webapp being forwarded
233      * to
234      * the standard error page.
235      * @return this method returns the string used to identify the correct
236      * <em>Struts</em> <code>ActionForward</code> which should follow this
237      * page, or <code>null</code> if it should return to the input.
238      */

239     public String JavaDoc execute(final ActionMapping mapping,
240             final ActionErrors errors,
241             final ActionForm form,
242             final HttpServletRequest JavaDoc request,
243             final HttpServletResponse JavaDoc response,
244             final HttpSession JavaDoc session)
245             throws SystemException {
246         Integer JavaDoc commentId = StringHandling.integerValue(
247                 request.getParameter("hide"));
248         SecuritySession securitySession = (SecuritySession)
249             session.getAttribute("securitySession");
250         CommentDO comment = library.findCommentByPrimaryKey(securitySession,
251                 commentId);
252         comment.setUnacknowledged(true);
253         library.amendComment(securitySession, comment);
254
255         if (request.getParameter("list") != null) {
256             return "listOfComments";
257         } else {
258             return "libraryIndex";
259         }
260     }
261 }
262
Popular Tags