Source Code Cross Referenced for FindTopicAction.java in  » Groupware » ivatagroupware » com » ivata » groupware » business » library » struts » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » ivatagroupware » com.ivata.groupware.business.library.struts 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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: FindTopicAction.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:05  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:23  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:41  colinmacleod
080:         * Moved ivata openportal to SourceForge..
081:         *
082:         * Revision 1.3  2003/10/28 13:16:14  jano
083:         * commiting library,
084:         * still fixing compile and building openGroupware project
085:         *
086:         * Revision 1.2  2003/10/15 14:16:53  colin
087:         * fixing for XDoclet
088:         *
089:         * Revision 1.2  2003/03/03 16:57:12  colin
090:         * converted localization to automatic paths
091:         * added labels
092:         * added mandatory fieldName attribute
093:         *
094:         * Revision 1.1  2003/02/24 19:09:24  colin
095:         * moved to business
096:         *
097:         * Revision 1.9  2003/02/04 17:43:50  colin
098:         * copyright notice
099:         *
100:         * Revision 1.8  2003/01/18 20:21:18  colin
101:         * conversion to new MaskAction methods
102:         * -----------------------------------------------------------------------------
103:         */
104:        package com.ivata.groupware.business.library.struts;
105:
106:        import java.lang.reflect.InvocationTargetException;
107:
108:        import javax.servlet.http.HttpServletRequest;
109:        import javax.servlet.http.HttpServletResponse;
110:        import javax.servlet.http.HttpSession;
111:
112:        import org.apache.commons.beanutils.PropertyUtils;
113:        import org.apache.struts.action.ActionErrors;
114:        import org.apache.struts.action.ActionForm;
115:        import org.apache.struts.action.ActionMapping;
116:
117:        import com.ivata.groupware.admin.security.server.SecuritySession;
118:        import com.ivata.groupware.business.addressbook.person.group.right.RightConstants;
119:        import com.ivata.groupware.business.library.Library;
120:        import com.ivata.groupware.business.library.right.LibraryRights;
121:        import com.ivata.groupware.business.library.topic.TopicDO;
122:        import com.ivata.mask.MaskFactory;
123:        import com.ivata.mask.util.StringHandling;
124:        import com.ivata.mask.util.SystemException;
125:        import com.ivata.mask.web.struts.MaskAction;
126:        import com.ivata.mask.web.struts.MaskAuthenticator;
127:
128:        /**
129:         * <p><code>Action</code> invoked when you calling topicModify.jsp
130:         * from topic.jsp.</p>
131:         * <!--**********************************************************************-->
132:         *
133:         * @since 2002-11-22
134:         * @author Jan Boros <janboros@sourceforge.net>
135:         * @version $Revision: 1.4 $
136:         */
137:        public class FindTopicAction extends MaskAction {
138:            Library library;
139:            LibraryRights libraryRights;
140:
141:            /**
142:             * TODO
143:             * @param library
144:             * @param libraryRights
145:             * @param maskFactory This factory is needed to access the masks and groups
146:             * of masks.
147:             * @param authenticator used to confirm whether or not the
148:             * user should be allowed to continue, in the <code>execute</code> method.
149:             */
150:            public FindTopicAction(Library library,
151:                    LibraryRights libraryRights, MaskFactory maskFactory,
152:                    MaskAuthenticator authenticator) {
153:                super (maskFactory, authenticator);
154:                this .library = library;
155:                this .libraryRights = libraryRights;
156:            }
157:
158:            /**
159:             * <p>Submit or cancel the form in
160:             * <code>/library/topicModify.jsp</code>.</p>
161:             *
162:             * @param mapping current action mapping from <em>Struts</em> config.
163:             * @param log valid logging object to write messages to.
164:             * @param errors valid errors object to append errors to. If there are
165:             * any errors, the action will return to the input.
166:             * @param form optional ActionForm bean for this request (if any)
167:             * @param request non-HTTP request we are processing
168:             * @param response The non-HTTP response we are creating
169:             * @param session  returned from the <code>request</code> parameter.
170:             * @param userName current user name from session. .
171:             * @param settings valid, non-null settings from session.
172:             * @exception SystemException if there is any problem which
173:             * prevents processing. It will result in the webapp being forwarded
174:             * to
175:             * the standard error page.
176:             * @return this method returns the string used to identify the correct
177:             * <em>Struts</em> <code>ActionForward</code> which should follow this
178:             * page, or <code>null</code> if it should return to the input.
179:             *
180:             */
181:            public String execute(final ActionMapping mapping,
182:                    final ActionErrors errors, final ActionForm form,
183:                    final HttpServletRequest request,
184:                    final HttpServletResponse response,
185:                    final HttpSession session) throws SystemException {
186:                SecuritySession securitySession = (SecuritySession) session
187:                        .getAttribute("securitySession");
188:                try {
189:                    TopicForm libraryTopicForm = new TopicForm(library);
190:
191:                    // request parameter overrides
192:                    String requestId = request.getParameter("id");
193:                    Integer id;
194:                    if (requestId != null) {
195:                        id = StringHandling.integerValue(requestId);
196:                    } else {
197:                        id = (Integer) PropertyUtils.getSimpleProperty(form,
198:                                "id");
199:                    }
200:
201:                    TopicDO topic = library.findTopicByPrimaryKey(
202:                            securitySession, id);
203:
204:                    libraryTopicForm.setTopic(topic);
205:
206:                    // set view rights to ITEM in the form
207:                    java.util.Collection rights = libraryRights
208:                            .findRightsForItemsInTopic(securitySession, id,
209:                                    RightConstants.ACCESS_VIEW);
210:                    Integer[] tmp = new Integer[rights.size()];
211:                    int a = 0;
212:
213:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
214:                        tmp[a] = (Integer) i.next();
215:                        a++;
216:                    }
217:
218:                    libraryTopicForm.setRightsViewItem(tmp);
219:
220:                    // set add rights to ITEM in the form
221:                    rights = libraryRights.findRightsForItemsInTopic(
222:                            securitySession, id, RightConstants.ACCESS_ADD);
223:                    tmp = new Integer[rights.size()];
224:                    a = 0;
225:
226:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
227:                        tmp[a] = (Integer) i.next();
228:                        a++;
229:                    }
230:
231:                    libraryTopicForm.setRightsAddItem(tmp);
232:
233:                    // set amend rights to ITEM in the form
234:                    rights = libraryRights.findRightsForItemsInTopic(
235:                            securitySession, id, RightConstants.ACCESS_AMEND);
236:                    tmp = new Integer[rights.size()];
237:                    a = 0;
238:
239:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
240:                        tmp[a] = (Integer) i.next();
241:                        a++;
242:                    }
243:
244:                    libraryTopicForm.setRightsAmendItem(tmp);
245:
246:                    // set delete rights to ITEM in the form
247:                    rights = libraryRights.findRightsForItemsInTopic(
248:                            securitySession, id, RightConstants.ACCESS_REMOVE);
249:                    tmp = new Integer[rights.size()];
250:                    a = 0;
251:
252:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
253:                        tmp[a] = (Integer) i.next();
254:                        a++;
255:                    }
256:
257:                    libraryTopicForm.setRightsRemoveItem(tmp);
258:
259:                    // set view rights to TOPIC in the form
260:                    rights = libraryRights.findRightsForTopic(securitySession,
261:                            id, RightConstants.ACCESS_VIEW);
262:                    tmp = new Integer[rights.size()];
263:                    a = 0;
264:
265:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
266:                        tmp[a] = (Integer) i.next();
267:                        a++;
268:                    }
269:
270:                    libraryTopicForm.setRightsView(tmp);
271:
272:                    // set amend rights to TOPIC in the form
273:                    rights = libraryRights.findRightsForTopic(securitySession,
274:                            id, RightConstants.ACCESS_AMEND);
275:                    tmp = new Integer[rights.size()];
276:                    a = 0;
277:
278:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
279:                        tmp[a] = (Integer) i.next();
280:                        a++;
281:                    }
282:
283:                    libraryTopicForm.setRightsAmend(tmp);
284:
285:                    // set delete rights to TOPIC in the form
286:                    rights = libraryRights.findRightsForTopic(securitySession,
287:                            id, RightConstants.ACCESS_REMOVE);
288:                    tmp = new Integer[rights.size()];
289:                    a = 0;
290:
291:                    for (java.util.Iterator i = rights.iterator(); i.hasNext();) {
292:                        tmp[a] = (Integer) i.next();
293:                        a++;
294:                    }
295:
296:                    libraryTopicForm.setRightsRemove(tmp);
297:                    libraryTopicForm.setTopicTab_activeTab(new Integer(0));
298:                    session.setAttribute("libraryTopicForm", libraryTopicForm);
299:                    session.removeAttribute("topicTab_activeTab");
300:
301:                    // Forward control to the topicModify.jsp - FORM for add new or modify existing TOPIC
302:                    return "libraryTopic";
303:                } catch (NoSuchMethodException e) {
304:                    throw new SystemException(e);
305:                } catch (InvocationTargetException e) {
306:                    throw new SystemException(e);
307:                } catch (IllegalAccessException e) {
308:                    throw new SystemException(e);
309:                }
310:            }
311:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.