001: /*
002: * Copyright (c) 2001 - 2005 ivata limited.
003: * All rights reserved.
004: * -----------------------------------------------------------------------------
005: * ivata groupware may be redistributed under the GNU General Public
006: * License as published by the Free Software Foundation;
007: * version 2 of the License.
008: *
009: * These programs are free software; you can redistribute them and/or
010: * modify them under the terms of the GNU General Public License
011: * as published by the Free Software Foundation; version 2 of the License.
012: *
013: * These programs are distributed in the hope that they will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: *
017: * See the GNU General Public License in the file LICENSE.txt for more
018: * details.
019: *
020: * If you would like a copy of the GNU General Public License write to
021: *
022: * Free Software Foundation, Inc.
023: * 59 Temple Place - Suite 330
024: * Boston, MA 02111-1307, USA.
025: *
026: *
027: * To arrange commercial support and licensing, contact ivata at
028: * http://www.ivata.com/contact.jsp
029: * -----------------------------------------------------------------------------
030: * $Log: UnacknowledgedCommentsAction.java,v $
031: * Revision 1.4 2005/04/29 02:48:16 colinmacleod
032: * Data bugfixes.
033: * Changed primary key back to Integer.
034: *
035: * Revision 1.3 2005/04/10 20:31:58 colinmacleod
036: * Added new themes.
037: * Changed id type to String.
038: * Changed i tag to em and b tag to strong.
039: * Improved PicoContainerFactory with NanoContainer scripts.
040: *
041: * Revision 1.2 2005/04/09 17:19:46 colinmacleod
042: * Changed copyright text to GPL v2 explicitly.
043: *
044: * Revision 1.1.1.1 2005/03/10 17:52:02 colinmacleod
045: * Restructured ivata op around Hibernate/PicoContainer.
046: * Renamed ivata groupware.
047: *
048: * Revision 1.10 2004/12/31 18:27:44 colinmacleod
049: * Added MaskFactory to constructor of MaskAction.
050: *
051: * Revision 1.9 2004/12/23 21:01:29 colinmacleod
052: * Updated Struts to v1.2.4.
053: * Changed base classes to use ivata masks.
054: *
055: * Revision 1.8 2004/11/12 18:19:15 colinmacleod
056: * Change action and form classes to extend MaskAction, MaskForm respectively.
057: *
058: * Revision 1.7 2004/11/12 15:57:16 colinmacleod
059: * Removed dependencies on SSLEXT.
060: * Moved Persistence classes to ivata masks.
061: *
062: * Revision 1.6 2004/11/03 15:31:51 colinmacleod
063: * Change method interfaces to remove log.
064: *
065: * Revision 1.5 2004/07/13 19:47:29 colinmacleod
066: * Moved project to POJOs from EJBs.
067: * Applied PicoContainer to services layer (replacing session EJBs).
068: * Applied Hibernate to persistence layer (replacing entity EJBs).
069: *
070: * Revision 1.4 2004/03/21 21:16:29 colinmacleod
071: * Shortened name to ivata op.
072: *
073: * Revision 1.3 2004/02/10 19:57:24 colinmacleod
074: * Changed email address.
075: *
076: * Revision 1.2 2004/02/01 22:07:31 colinmacleod
077: * Added full names to author tags
078: *
079: * Revision 1.1.1.1 2004/01/27 20:58:42 colinmacleod
080: * Moved ivata openportal to SourceForge..
081: *
082: * Revision 1.4 2004/01/12 14:01:03 jano
083: * fixing bugs
084: *
085: * Revision 1.3 2003/10/28 13:16:14 jano
086: * commiting library,
087: * still fixing compile and building openGroupware project
088: *
089: * Revision 1.2 2003/10/15 14:16:53 colin
090: * fixing for XDoclet
091: *
092: * Revision 1.2 2003/07/21 14:16:06 jano
093: * return to library index or list of openComments
094: * Revision 1.1 2003/06/26 09:17:46 jano
095: * first version can only hide unacknowledged comment
096: * -----------------------------------------------------------------------------
097: */
098: package com.ivata.groupware.business.library.struts;
099:
100: import javax.servlet.http.HttpServletRequest;
101: import javax.servlet.http.HttpServletResponse;
102: import javax.servlet.http.HttpSession;
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: * <p><code>Action</code> invoked when you clicking on cross of unacknowledgedComment to remove that comment from UC list.</p>
121: * <!--**********************************************************************-->
122: * <br/>
123: * <br/><strong>Copyright © 2002 ivata limited. All rights
124: * reserved.</strong>
125: * <br/>
126: * <!--**********************************************************************-->
127: * <em>
128: * <br/> $Log: UnacknowledgedCommentsAction.java,v $
129: * <br/> Revision 1.4 2005/04/29 02:48:16 colinmacleod
130: * <br/> Data bugfixes.
131: * <br/> Changed primary key back to Integer.
132: * <br/>
133: * <br/> Revision 1.3 2005/04/10 20:31:58 colinmacleod
134: * <br/> Added new themes.
135: * <br/> Changed id type to String.
136: * <br/> Changed i tag to em and b tag to strong.
137: * <br/> Improved PicoContainerFactory with NanoContainer scripts.
138: * <br/>
139: * <br/> Revision 1.1.1.1 2005/03/10 17:52:02 colinmacleod
140: * <br/> Restructured ivata op around Hibernate/PicoContainer.
141: * <br/> Renamed ivata groupware.
142: * <br/>
143: * <br/> Revision 1.10 2004/12/31 18:27:44 colinmacleod
144: * <br/> Added MaskFactory to constructor of MaskAction.
145: * <br/>
146: * <br/> Revision 1.9 2004/12/23 21:01:29 colinmacleod
147: * <br/> Updated Struts to v1.2.4.
148: * <br/> Changed base classes to use ivata masks.
149: * <br/>
150: * <br/> Revision 1.8 2004/11/12 18:19:15 colinmacleod
151: * <br/> Change action and form classes to extend MaskAction, MaskForm respectively.
152: * <br/>
153: * <br/> Revision 1.7 2004/11/12 15:57:16 colinmacleod
154: * <br/> Removed dependencies on SSLEXT.
155: * <br/> Moved Persistence classes to ivata masks.
156: * <br/>
157: * <br/> Revision 1.6 2004/11/03 15:31:51 colinmacleod
158: * <br/> Change method interfaces to remove log.
159: * <br/>
160: * <br/> Revision 1.5 2004/07/13 19:47:29 colinmacleod
161: * <br/> Moved project to POJOs from EJBs.
162: * <br/> Applied PicoContainer to services layer (replacing session EJBs).
163: * <br/> Applied Hibernate to persistence layer (replacing entity EJBs).
164: * <br/>
165: * <br/> Revision 1.4 2004/03/21 21:16:29 colinmacleod
166: * <br/> Shortened name to ivata op.
167: * <br/>
168: * <br/> Revision 1.3 2004/02/10 19:57:24 colinmacleod
169: * <br/> Changed email address.
170: * <br/>
171: * <br/> Revision 1.2 2004/02/01 22:07:31 colinmacleod
172: * <br/> Added full names to author tags
173: * <br/>
174: * <br/> Revision 1.1.1.1 2004/01/27 20:58:42 colinmacleod
175: * <br/> Moved ivata openportal to SourceForge..
176: * <br/>
177: * <br/> Revision 1.4 2004/01/12 14:01:03 jano
178: * <br/> fixing bugs
179: * <br/>
180: * <br/> Revision 1.3 2003/10/28 13:16:14 jano
181: * <br/> commiting library,
182: * <br/> still fixing compile and building openGroupware project
183: * <br/>
184: * <br/> Revision 1.2 2003/10/15 14:16:53 colin
185: * <br/> fixing for XDoclet
186: * <br/>
187: * <br/> Revision 1.2 2003/07/21 14:16:06 jano
188: * <br/> return to library index or list of openComments
189: * <br/>
190: * <br/> Revision 1.1 2003/06/26 09:17:46 jano
191: * <br/> first version can only hide unacknowledged comment
192: * <br/>
193: * </em><br/><br/><hr>
194: * <!--**********************************************************************-->
195: *
196: * @since 2003-6-25
197: * @author Jan Boros <janboros@sourceforge.net>
198: * @version $Revision: 1.4 $
199: */
200: public class UnacknowledgedCommentsAction extends MaskAction {
201: Library library;
202:
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: /**
218: * <p>Called from the other <code>execute</code> method, this can
219: * be overridden by each subclass to provide the <em>ivata</em>-specific
220: * processing required.</p>
221: *
222: * @param mapping The ActionMapping used to select this instance.
223: * @param log valid logging object to write messages to.
224: * @param errors valid errors object to append errors to. If there are
225: * any errors, the action will return to the input.
226: * @param form optional ActionForm bean for this request (if any)
227: * @param request non-HTTP request we are processing
228: * @param response The non-HTTP response we are creating
229: * @param session returned from the <code>request</code> parameter.
230: * @param userName valid, non-null user name from session.
231: * @param settings valid, non-null settings from session.
232: * @exception SystemException if there is any problem which
233: * prevents processing. It will result in the webapp being forwarded
234: * to
235: * the standard error page.
236: * @return this method returns the string used to identify the correct
237: * <em>Struts</em> <code>ActionForward</code> which should follow this
238: * page, or <code>null</code> if it should return to the input.
239: */
240: public String execute(final ActionMapping mapping,
241: final ActionErrors errors, final ActionForm form,
242: final HttpServletRequest request,
243: final HttpServletResponse response,
244: final HttpSession session) throws SystemException {
245: Integer commentId = StringHandling.integerValue(request
246: .getParameter("hide"));
247: SecuritySession securitySession = (SecuritySession) session
248: .getAttribute("securitySession");
249: CommentDO comment = library.findCommentByPrimaryKey(
250: securitySession, commentId);
251: comment.setUnacknowledged(true);
252: library.amendComment(securitySession, comment);
253:
254: if (request.getParameter("list") != null) {
255: return "listOfComments";
256: } else {
257: return "libraryIndex";
258: }
259: }
260: }
|