Source Code Cross Referenced for NavigationImpl.java in  » Groupware » ivatagroupware » com » ivata » groupware » navigation » 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.navigation 
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: NavigationImpl.java,v $
031:         * Revision 1.2  2005/10/02 14:08:59  colinmacleod
032:         * Added/improved log4j logging.
033:         *
034:         * Revision 1.1  2005/09/29 13:06:06  colinmacleod
035:         * First version of setting subproject.
036:         * Existing classes restructured, new setting user interface created.
037:         * Flexible XML UI configuration makes it easy to reuse the same web pages in
038:         * other projects.
039:         * Web files work as stand-alone webapp for testing.
040:         *
041:         * Revision 1.4  2005/09/14 14:52:02  colinmacleod
042:         * Added serialVersionUID.
043:         *
044:         * Revision 1.3  2005/04/10 20:09:39  colinmacleod
045:         * Added new themes.
046:         * Changed id type to String.
047:         * Changed i tag to em and b tag to strong.
048:         * Improved PicoContainerFactory with NanoContainer scripts.
049:         *
050:         * Revision 1.2  2005/04/09 17:19:09  colinmacleod
051:         * Changed copyright text to GPL v2 explicitly.
052:         *
053:         * Revision 1.1.1.1  2005/03/10 17:50:35  colinmacleod
054:         * Restructured ivata op around Hibernate/PicoContainer.
055:         * Renamed ivata groupware.
056:         *
057:         * Revision 1.4  2004/11/12 18:17:11  colinmacleod
058:         * Ordered imports.
059:         *
060:         * Revision 1.3  2004/11/12 15:57:07  colinmacleod
061:         * Removed dependencies on SSLEXT.
062:         * Moved Persistence classes to ivata masks.
063:         *
064:         * Revision 1.2  2004/07/19 18:17:34  colinmacleod
065:         * Made synchronized collection.
066:         *
067:         * Revision 1.1  2004/07/13 19:41:16  colinmacleod
068:         * Moved project to POJOs from EJBs.
069:         * Applied PicoContainer to services layer (replacing session EJBs).
070:         * Applied Hibernate to persistence layer (replacing entity EJBs).
071:         * -----------------------------------------------------------------------------
072:         */
073:        package com.ivata.groupware.navigation;
074:
075:        import org.apache.log4j.Logger;
076:
077:        import java.util.Collection;
078:        import java.util.Collections;
079:
080:        import javax.ejb.EJBException;
081:
082:        import com.ivata.groupware.admin.security.server.SecuritySession;
083:        import com.ivata.groupware.business.BusinessLogic;
084:        import com.ivata.groupware.navigation.menu.item.MenuItemDO;
085:        import com.ivata.mask.persistence.PersistenceSession;
086:        import com.ivata.mask.persistence.QueryPersistenceManager;
087:        import com.ivata.mask.util.SystemException;
088:
089:        /**
090:         * <p>Lets you access the menues and folders in the system and generally get
091:         * around.</p>
092:         *
093:         * @since 2002-05-07
094:         * @author Colin MacLeod
095:         * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
096:         * @version $Revision: 1.2 $
097:         */
098:        public class NavigationImpl extends BusinessLogic implements  Navigation {
099:            /**
100:             * Logger for this class.
101:             */
102:            private static final Logger logger = Logger
103:                    .getLogger(NavigationImpl.class);
104:
105:            /**
106:             * Serialization version (for <code>Serializable</code> interface).
107:             */
108:            private static final long serialVersionUID = 1L;
109:            /**
110:             * Persistence manger used to store/retrieve data objects, or retrieve a
111:             * new persistence session.
112:             */
113:            private QueryPersistenceManager persistenceManager;
114:
115:            /**
116:             * Construct and initialize the navigation implementation.
117:             *
118:             * @param persistenceManager persistence manager used to store/retrieve data
119:             *     objects.
120:             */
121:            public NavigationImpl(QueryPersistenceManager persistenceManager) {
122:                this .persistenceManager = persistenceManager;
123:            }
124:
125:            /**
126:             * <p>Add a new menu item, with no image associated with it initially.</p>
127:             *
128:             * @param userName the user for whom to insert the new menu item, or
129:             * <code>null</code> if everyone should see it.
130:             * @param menuId the unique identifier of the menu into which the new item
131:             * will be inserted.
132:             * @param text human-readable english language text for the menu item.
133:             * Should be unique within the menu it is in though this is not enforced
134:             * server-side.
135:             * @param URL the <code>URL</code> the new menu item links to.
136:             *
137:             * @ejb.interface-method
138:             *      view-type="remote"
139:             */
140:            public void addMenuItem(final SecuritySession securitySession,
141:                    final MenuItemDO menuItem) throws SystemException {
142:                if (logger.isDebugEnabled()) {
143:                    logger
144:                            .debug("addMenuItem(SecuritySession securitySession = "
145:                                    + securitySession
146:                                    + ", MenuItemDO menuItem = "
147:                                    + menuItem
148:                                    + ") - start");
149:                }
150:
151:                PersistenceSession persistenceSession = persistenceManager
152:                        .openSession(securitySession);
153:                try {
154:                    persistenceManager.add(persistenceSession, menuItem);
155:                } catch (Exception e) {
156:                    logger.error("addMenuItem(SecuritySession, MenuItemDO)", e);
157:
158:                    persistenceSession.cancel();
159:                    throw new SystemException(e);
160:                } finally {
161:                    persistenceSession.close();
162:                }
163:
164:                if (logger.isDebugEnabled()) {
165:                    logger
166:                            .debug("addMenuItem(SecuritySession, MenuItemDO) - end");
167:                }
168:            }
169:
170:            /**
171:             * <p>changes a menu item, if it belongs to the given user</p>
172:             *
173:             * @param menuItemId the unique identifier of the menu item to change.
174:             * @param text human-readable english language text for the menu item.
175:             * Should be unique within the menu it is in though this is not enforced
176:             * server-side.
177:             * @param URL the <code>URL</code> the new menu item links to.
178:             * @param userName the user for whom the menu item should belong
179:             *
180:             * @ejb.interface-method
181:             *      view-type="remote"
182:             */
183:            public void amendMenuItem(final SecuritySession securitySession,
184:                    final MenuItemDO menuItem) throws SystemException {
185:                if (logger.isDebugEnabled()) {
186:                    logger
187:                            .debug("amendMenuItem(SecuritySession securitySession = "
188:                                    + securitySession
189:                                    + ", MenuItemDO menuItem = "
190:                                    + menuItem
191:                                    + ") - start");
192:                }
193:
194:                PersistenceSession persistenceSession = persistenceManager
195:                        .openSession(securitySession);
196:                try {
197:                    persistenceManager.amend(persistenceSession, menuItem);
198:                } catch (Exception e) {
199:                    logger.error("amendMenuItem(SecuritySession, MenuItemDO)",
200:                            e);
201:
202:                    persistenceSession.cancel();
203:                    throw new SystemException(e);
204:                } finally {
205:                    persistenceSession.close();
206:                }
207:
208:                if (logger.isDebugEnabled()) {
209:                    logger
210:                            .debug("amendMenuItem(SecuritySession, MenuItemDO) - end");
211:                }
212:            }
213:
214:            /**
215:             * <p>Find all the menues for a given user.</p>
216:             *
217:             * @param userName the user to search for
218:             * @return a <code>Collection</code>Containing all the user's menues, as
219:             * instances of {@link com.ivata.groupware.menu.MenuDO MenuDO}
220:             * @see com.ivata.groupware.menu.MenuDOHome#findByUserName( String sUserName )
221:             * @throws EJBException if there is a <code>FinderException</code> calling
222:             * <code>MenuDOHome.findByUserName</code>
223:             * @throws EJBException if there is a <code>NamingException</code> setting
224:             * looking up the MenuHome
225:             *
226:             * @ejb.interface-method
227:             *      view-type="remote"
228:             */
229:            public Collection findMenues(final SecuritySession securitySession)
230:                    throws SystemException {
231:                if (logger.isDebugEnabled()) {
232:                    logger
233:                            .debug("findMenues(SecuritySession securitySession = "
234:                                    + securitySession + ") - start");
235:                }
236:
237:                PersistenceSession persistenceSession = persistenceManager
238:                        .openSession(securitySession);
239:                try {
240:                    Collection returnCollection = Collections
241:                            .synchronizedCollection(persistenceManager.find(
242:                                    persistenceSession,
243:                                    "navigationMenuByUserNameOrderByPriority",
244:                                    new Object[] { securitySession.getUser()
245:                                            .getName() }));
246:                    if (logger.isDebugEnabled()) {
247:                        logger
248:                                .debug("findMenues(SecuritySession) - end - return value = "
249:                                        + returnCollection);
250:                    }
251:                    return returnCollection;
252:                } catch (Exception e) {
253:                    logger.error("findMenues(SecuritySession)", e);
254:
255:                    persistenceSession.cancel();
256:                    throw new SystemException(e);
257:                } finally {
258:                    persistenceSession.close();
259:                }
260:            }
261:
262:            /**
263:             * <p>removes a menu item, if it belongs to the given user</p>
264:             *
265:             * @param menuItemId the unique identifier of the menu item to remove.
266:             * @param userName the user for whom the menu item should belong
267:             *
268:             * @ejb.interface-method
269:             *      view-type="remote"
270:             */
271:            public void removeMenuItem(final SecuritySession securitySession,
272:                    final String menuItemId) throws SystemException {
273:                if (logger.isDebugEnabled()) {
274:                    logger
275:                            .debug("removeMenuItem(SecuritySession securitySession = "
276:                                    + securitySession
277:                                    + ", String menuItemId = "
278:                                    + menuItemId
279:                                    + ") - start");
280:                }
281:
282:                PersistenceSession persistenceSession = persistenceManager
283:                        .openSession(securitySession);
284:                try {
285:                    persistenceManager.remove(persistenceSession,
286:                            MenuItemDO.class, menuItemId);
287:                } catch (Exception e) {
288:                    logger.error("removeMenuItem(SecuritySession, String)", e);
289:
290:                    persistenceSession.cancel();
291:                    throw new SystemException(e);
292:                } finally {
293:                    persistenceSession.close();
294:                }
295:
296:                if (logger.isDebugEnabled()) {
297:                    logger
298:                            .debug("removeMenuItem(SecuritySession, String) - end");
299:                }
300:            }
301:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.