Source Code Cross Referenced for A_CmsOrgUnitUsersList.java in  » Content-Management-System » opencms » org » opencms » workplace » tools » accounts » 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 » Content Management System » opencms » org.opencms.workplace.tools.accounts 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * File   : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/A_CmsOrgUnitUsersList.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:26 $
004:         * Version: $Revision: 1.4 $
005:         *
006:         * This library is part of OpenCms -
007:         * the Open Source Content Management System
008:         *
009:         * Copyright (c) 2002 - 2008 Alkacon Software GmbH (http://www.alkacon.com)
010:         *
011:         * This library is free software; you can redistribute it and/or
012:         * modify it under the terms of the GNU Lesser General Public
013:         * License as published by the Free Software Foundation; either
014:         * version 2.1 of the License, or (at your option) any later version.
015:         *
016:         * This library is distributed in the hope that it will be useful,
017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019:         * Lesser General Public License for more details.
020:         *
021:         * For further information about Alkacon Software GmbH, please see the
022:         * company website: http://www.alkacon.com
023:         *
024:         * For further information about OpenCms, please see the
025:         * project website: http://www.opencms.org
026:         * 
027:         * You should have received a copy of the GNU Lesser General Public
028:         * License along with this library; if not, write to the Free Software
029:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030:         */
031:
032:        package org.opencms.workplace.tools.accounts;
033:
034:        import org.opencms.file.CmsUser;
035:        import org.opencms.i18n.CmsMessageContainer;
036:        import org.opencms.jsp.CmsJspActionElement;
037:        import org.opencms.main.CmsException;
038:        import org.opencms.main.OpenCms;
039:        import org.opencms.security.CmsOrganizationalUnit;
040:        import org.opencms.security.CmsRole;
041:        import org.opencms.workplace.list.A_CmsListDialog;
042:        import org.opencms.workplace.list.CmsListColumnAlignEnum;
043:        import org.opencms.workplace.list.CmsListColumnDefinition;
044:        import org.opencms.workplace.list.CmsListItem;
045:        import org.opencms.workplace.list.CmsListMetadata;
046:        import org.opencms.workplace.list.CmsListOrderEnum;
047:
048:        import java.util.ArrayList;
049:        import java.util.Iterator;
050:        import java.util.List;
051:
052:        /**
053:         * Generalized organizational unit users view.<p>
054:         * 
055:         * @author Raphael Schnuck  
056:         * 
057:         * @version $Revision: 1.4 $ 
058:         * 
059:         * @since 6.5.6
060:         */
061:        public abstract class A_CmsOrgUnitUsersList extends A_CmsListDialog {
062:
063:            /** list action id constant. */
064:            public static final String LIST_ACTION_ICON = "ai";
065:
066:            /** list action id constant. */
067:            public static final String LIST_ACTION_STATE = "as";
068:
069:            /** list column id constant. */
070:            public static final String LIST_COLUMN_FULLNAME = "cf";
071:
072:            /** list column id constant. */
073:            public static final String LIST_COLUMN_ICON = "ci";
074:
075:            /** list column id constant. */
076:            public static final String LIST_COLUMN_LOGIN = "cl";
077:
078:            /** list column id constant. */
079:            public static final String LIST_COLUMN_NAME = "cn";
080:
081:            /** list column id constant. */
082:            public static final String LIST_COLUMN_ORGUNIT = "co";
083:
084:            /** list column id constant. */
085:            public static final String LIST_COLUMN_STATE = "cs";
086:
087:            /** Constant for session attribute. */
088:            public static final String NOT_ORGUNIT_USERS = "not_orgunit_users";
089:
090:            /** Constant for session attribute. */
091:            public static final String ORGUNIT_USERS = "orgunit_users";
092:
093:            /** Stores the users not in the current ou.*/
094:            private List m_notOuUsers;
095:
096:            /** Stores the users of the the current ou.*/
097:            private List m_ouUsers;
098:
099:            /** Stores the value of the request parameter for the organizational unit fqn. */
100:            private String m_paramOufqn;
101:
102:            /**
103:             * Public constructor.<p>
104:             * 
105:             * @param jsp an initialized JSP action element
106:             * @param listId the id of the list
107:             * @param listName the name of the list
108:             * @param searchable searchable flag
109:             */
110:            protected A_CmsOrgUnitUsersList(CmsJspActionElement jsp,
111:                    String listId, CmsMessageContainer listName,
112:                    boolean searchable) {
113:
114:                super (jsp, listId, listName, LIST_COLUMN_LOGIN,
115:                        CmsListOrderEnum.ORDER_ASCENDING,
116:                        searchable ? LIST_COLUMN_NAME : null);
117:            }
118:
119:            /**
120:             * Returns the notOuUsers.<p>
121:             *
122:             * @return the notOuUsers
123:             */
124:            public List getNotOuUsers() {
125:
126:                return m_notOuUsers;
127:            }
128:
129:            /**
130:             * Returns the ouUsers.<p>
131:             *
132:             * @return the ouUsers
133:             */
134:            public List getOuUsers() {
135:
136:                return m_ouUsers;
137:            }
138:
139:            /**
140:             * Returns the right icon path for the given list item.<p>
141:             * 
142:             * @param item the list item to get the icon path for
143:             * 
144:             * @return the icon path for the given role
145:             */
146:            public String getIconPath(CmsListItem item) {
147:
148:                try {
149:                    CmsUser user = getCms().readUser(
150:                            (String) item.get(LIST_COLUMN_LOGIN));
151:                    if (user.getOuFqn().equals(getParamOufqn())) {
152:                        return A_CmsUsersList.PATH_BUTTONS + "user.png";
153:                    } else {
154:                        return A_CmsUsersList.PATH_BUTTONS
155:                                + "user_other_ou.png";
156:                    }
157:                } catch (CmsException e) {
158:                    return A_CmsUsersList.PATH_BUTTONS + "user.png";
159:                }
160:            }
161:
162:            /**
163:             * Returns the organizational unit fqn parameter value.<p>
164:             * 
165:             * @return the organizational unit fqn parameter value
166:             */
167:            public String getParamOufqn() {
168:
169:                return m_paramOufqn;
170:            }
171:
172:            /**
173:             * Sets the notOuUsers.<p>
174:             *
175:             * @param notOuUsers the notOuUsers to set
176:             */
177:            public void setNotOuUsers(List notOuUsers) {
178:
179:                m_notOuUsers = notOuUsers;
180:                getJsp().getRequest().getSession().setAttribute(
181:                        A_CmsOrgUnitUsersList.NOT_ORGUNIT_USERS, m_notOuUsers);
182:            }
183:
184:            /**
185:             * Sets the ouUsers.<p>
186:             *
187:             * @param ouUsers the ouUsers to set
188:             */
189:            public void setOuUsers(List ouUsers) {
190:
191:                m_ouUsers = ouUsers;
192:                getJsp().getRequest().getSession().setAttribute(
193:                        A_CmsOrgUnitUsersList.ORGUNIT_USERS, m_ouUsers);
194:            }
195:
196:            /**
197:             * Sets the organizational unit fqn parameter value.<p>
198:             * 
199:             * @param ouFqn the organizational unit fqn parameter value
200:             */
201:            public void setParamOufqn(String ouFqn) {
202:
203:                if (ouFqn == null) {
204:                    ouFqn = "";
205:                }
206:                m_paramOufqn = ouFqn;
207:            }
208:
209:            /**
210:             * @see org.opencms.workplace.list.A_CmsListDialog#fillDetails(java.lang.String)
211:             */
212:            protected void fillDetails(String detailId) {
213:
214:                // noop
215:            }
216:
217:            /**
218:             * @see org.opencms.workplace.list.A_CmsListDialog#getListItems()
219:             */
220:            protected List getListItems() throws CmsException {
221:
222:                List ret = new ArrayList();
223:
224:                // get content        
225:                List users = getUsers();
226:                Iterator itUsers = users.iterator();
227:                while (itUsers.hasNext()) {
228:                    CmsUser user = (CmsUser) itUsers.next();
229:                    CmsListItem item = getList().newItem(
230:                            user.getId().toString());
231:                    item.set(LIST_COLUMN_LOGIN, user.getName());
232:                    item.set(LIST_COLUMN_NAME, user.getSimpleName());
233:                    item.set(LIST_COLUMN_ORGUNIT,
234:                            CmsOrganizationalUnit.SEPARATOR + user.getOuFqn());
235:                    item.set(LIST_COLUMN_FULLNAME, user.getFullName());
236:                    ret.add(item);
237:                }
238:
239:                return ret;
240:            }
241:
242:            /**
243:             * Returns a list of users to display.<p>
244:             * 
245:             * @return a list of <code><{@link CmsUser}</code>s
246:             * 
247:             * @throws CmsException if something goes wrong
248:             */
249:            protected abstract List getUsers() throws CmsException;
250:
251:            /**
252:             * @see org.opencms.workplace.list.A_CmsListDialog#setColumns(org.opencms.workplace.list.CmsListMetadata)
253:             */
254:            protected void setColumns(CmsListMetadata metadata) {
255:
256:                // create column for icon display
257:                CmsListColumnDefinition iconCol = new CmsListColumnDefinition(
258:                        LIST_COLUMN_ICON);
259:                iconCol.setName(Messages.get().container(
260:                        Messages.GUI_USERS_LIST_COLS_ICON_0));
261:                iconCol.setHelpText(Messages.get().container(
262:                        Messages.GUI_USERS_LIST_COLS_ICON_HELP_0));
263:                iconCol.setWidth("20");
264:                iconCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
265:                iconCol.setSorteable(false);
266:                // set icon action
267:                setIconAction(iconCol);
268:                // add it to the list definition
269:                metadata.addColumn(iconCol);
270:
271:                setStateActionCol(metadata);
272:
273:                // create column for login
274:                CmsListColumnDefinition loginCol = new CmsListColumnDefinition(
275:                        LIST_COLUMN_LOGIN);
276:                loginCol.setVisible(false);
277:                // add it to the list definition
278:                metadata.addColumn(loginCol);
279:
280:                // create column for name
281:                CmsListColumnDefinition nameCol = new CmsListColumnDefinition(
282:                        LIST_COLUMN_NAME);
283:                nameCol.setName(Messages.get().container(
284:                        Messages.GUI_USERS_LIST_COLS_LOGIN_0));
285:                nameCol.setWidth("20%");
286:                setDefaultAction(nameCol);
287:                // add it to the list definition
288:                metadata.addColumn(nameCol);
289:
290:                // create column for organizational unit
291:                CmsListColumnDefinition orgUnitCol = new CmsListColumnDefinition(
292:                        LIST_COLUMN_ORGUNIT);
293:                orgUnitCol.setName(Messages.get().container(
294:                        Messages.GUI_USERS_LIST_COLS_ORGUNIT_0));
295:                orgUnitCol.setWidth("40%");
296:                // add it to the list definition
297:                metadata.addColumn(orgUnitCol);
298:
299:                // create column for fullname
300:                CmsListColumnDefinition fullnameCol = new CmsListColumnDefinition(
301:                        LIST_COLUMN_FULLNAME);
302:                fullnameCol.setName(Messages.get().container(
303:                        Messages.GUI_USERS_LIST_COLS_FULLNAME_0));
304:                fullnameCol.setWidth("40%");
305:                fullnameCol.setTextWrapping(true);
306:                // add it to the list definition
307:                metadata.addColumn(fullnameCol);
308:            }
309:
310:            /**
311:             * Sets the optional login default action.<p>
312:             * 
313:             * @param loginCol the login column
314:             */
315:            protected abstract void setDefaultAction(
316:                    CmsListColumnDefinition loginCol);
317:
318:            /**
319:             * Sets the needed icon action(s).<p>
320:             * 
321:             * @param iconCol the list column for edition.
322:             */
323:            protected abstract void setIconAction(
324:                    CmsListColumnDefinition iconCol);
325:
326:            /**
327:             * @see org.opencms.workplace.list.A_CmsListDialog#setIndependentActions(org.opencms.workplace.list.CmsListMetadata)
328:             */
329:            protected void setIndependentActions(CmsListMetadata metadata) {
330:
331:                // noop
332:            }
333:
334:            /**
335:             * Sets the optional state change action column.<p>
336:             * 
337:             * @param metadata the list metadata object
338:             */
339:            protected abstract void setStateActionCol(CmsListMetadata metadata);
340:
341:            /**
342:             * @see org.opencms.workplace.list.A_CmsListDialog#validateParamaters()
343:             */
344:            protected void validateParamaters() throws Exception {
345:
346:                // test the needed parameters
347:                OpenCms.getRoleManager().checkRole(getCms(),
348:                        CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParamOufqn()));
349:                OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(),
350:                        m_paramOufqn).getName();
351:            }
352:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.