Source Code Cross Referenced for CmsNotUserGroupsList.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/CmsNotUserGroupsList.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:26 $
004:         * Version: $Revision: 1.12 $
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.jsp.CmsJspActionElement;
035:        import org.opencms.main.CmsException;
036:        import org.opencms.main.CmsRuntimeException;
037:        import org.opencms.main.OpenCms;
038:        import org.opencms.workplace.list.CmsListColumnAlignEnum;
039:        import org.opencms.workplace.list.CmsListColumnDefinition;
040:        import org.opencms.workplace.list.CmsListDefaultAction;
041:        import org.opencms.workplace.list.CmsListDirectAction;
042:        import org.opencms.workplace.list.CmsListItem;
043:        import org.opencms.workplace.list.CmsListMetadata;
044:        import org.opencms.workplace.list.CmsListMultiAction;
045:
046:        import java.util.HashSet;
047:        import java.util.Iterator;
048:        import java.util.List;
049:        import java.util.Map;
050:        import java.util.Set;
051:
052:        import javax.servlet.http.HttpServletRequest;
053:        import javax.servlet.http.HttpServletResponse;
054:        import javax.servlet.jsp.PageContext;
055:
056:        /**
057:         * Not Usergroups view.<p>
058:         * 
059:         * @author Michael Moossen  
060:         * 
061:         * @version $Revision: 1.12 $ 
062:         * 
063:         * @since 6.0.0 
064:         */
065:        public class CmsNotUserGroupsList extends A_CmsUserGroupsList {
066:
067:            /** list action id constant. */
068:            public static final String LIST_ACTION_ADD = "aa";
069:
070:            /** list action id constant. */
071:            public static final String LIST_DEFACTION_ADD = "da";
072:
073:            /** list id constant. */
074:            public static final String LIST_ID = "lnug";
075:
076:            /** list action id constant. */
077:            public static final String LIST_MACTION_ADD = "ma";
078:
079:            /** a set of action id's to use for adding. */
080:            protected static Set m_addActionIds = new HashSet();
081:
082:            /**
083:             * Public constructor.<p>
084:             * 
085:             * @param jsp an initialized JSP action element
086:             */
087:            public CmsNotUserGroupsList(CmsJspActionElement jsp) {
088:
089:                this (jsp, LIST_ID);
090:            }
091:
092:            /**
093:             * Public constructor with JSP variables.<p>
094:             * 
095:             * @param context the JSP page context
096:             * @param req the JSP request
097:             * @param res the JSP response
098:             */
099:            public CmsNotUserGroupsList(PageContext context,
100:                    HttpServletRequest req, HttpServletResponse res) {
101:
102:                this (new CmsJspActionElement(context, req, res));
103:            }
104:
105:            /**
106:             * Public constructor.<p>
107:             * 
108:             * @param jsp an initialized JSP action element
109:             * @param listId the id of the list
110:             */
111:            protected CmsNotUserGroupsList(CmsJspActionElement jsp,
112:                    String listId) {
113:
114:                super (jsp, listId, Messages.get().container(
115:                        Messages.GUI_NOTUSERGROUPS_LIST_NAME_0), true);
116:            }
117:
118:            /**
119:             * @see org.opencms.workplace.list.A_CmsListDialog#executeListMultiActions()
120:             */
121:            public void executeListMultiActions() throws CmsRuntimeException {
122:
123:                if (getParamListAction().equals(LIST_MACTION_ADD)) {
124:                    // execute the remove multiaction
125:                    try {
126:                        Iterator itItems = getSelectedItems().iterator();
127:                        while (itItems.hasNext()) {
128:                            CmsListItem listItem = (CmsListItem) itItems.next();
129:                            getCms().addUserToGroup(getParamUsername(),
130:                                    (String) listItem.get(LIST_COLUMN_NAME));
131:                        }
132:                    } catch (CmsException e) {
133:                        // refresh the list
134:                        Map objects = (Map) getSettings().getListObject();
135:                        if (objects != null) {
136:                            objects.remove(A_CmsUsersList.class.getName());
137:                        }
138:                        throw new CmsRuntimeException(Messages.get().container(
139:                                Messages.ERR_ADD_SELECTED_GROUPS_0), e);
140:                    }
141:                } else {
142:                    throwListUnsupportedActionException();
143:                }
144:                listSave();
145:            }
146:
147:            /**
148:             * @see org.opencms.workplace.list.A_CmsListDialog#executeListSingleActions()
149:             */
150:            public void executeListSingleActions() throws CmsRuntimeException {
151:
152:                if (m_addActionIds.contains(getParamListAction())) {
153:                    CmsListItem listItem = getSelectedItem();
154:                    try {
155:                        getCms().addUserToGroup(getParamUsername(),
156:                                (String) listItem.get(LIST_COLUMN_NAME));
157:                    } catch (CmsException e) {
158:                        // should never happen
159:                        throw new CmsRuntimeException(Messages.get().container(
160:                                Messages.ERR_ADD_SELECTED_GROUP_0), e);
161:                    }
162:                } else {
163:                    throwListUnsupportedActionException();
164:                }
165:                listSave();
166:            }
167:
168:            /**
169:             * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#getGroups(boolean)
170:             */
171:            protected List getGroups(boolean withOtherOus) throws CmsException {
172:
173:                List usergroups = getCms().getGroupsOfUser(getParamUsername(),
174:                        false, withOtherOus);
175:                List groups;
176:                if (withOtherOus) {
177:                    groups = OpenCms.getRoleManager().getManageableGroups(
178:                            getCms(), "", true);
179:                } else {
180:                    groups = OpenCms.getRoleManager().getManageableGroups(
181:                            getCms(), getParamOufqn(), false);
182:                }
183:                groups.removeAll(usergroups);
184:                return groups;
185:            }
186:
187:            /**
188:             * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setDefaultAction(org.opencms.workplace.list.CmsListColumnDefinition)
189:             */
190:            protected void setDefaultAction(CmsListColumnDefinition nameCol) {
191:
192:                // add add action
193:                CmsListDefaultAction addAction = new CmsListDefaultAction(
194:                        LIST_DEFACTION_ADD);
195:                addAction.setName(Messages.get().container(
196:                        Messages.GUI_GROUPS_LIST_DEFACTION_ADD_NAME_0));
197:                addAction.setHelpText(Messages.get().container(
198:                        Messages.GUI_GROUPS_LIST_DEFACTION_ADD_HELP_0));
199:                nameCol.addDefaultAction(addAction);
200:                // keep the id
201:                m_addActionIds.add(addAction.getId());
202:            }
203:
204:            /**
205:             * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setIconAction(org.opencms.workplace.list.CmsListColumnDefinition)
206:             */
207:            protected void setIconAction(CmsListColumnDefinition iconCol) {
208:
209:                CmsListDirectAction iconAction = new CmsListDirectAction(
210:                        LIST_ACTION_ICON);
211:                iconAction.setName(Messages.get().container(
212:                        Messages.GUI_GROUPS_LIST_AVAILABLE_NAME_0));
213:                iconAction.setHelpText(Messages.get().container(
214:                        Messages.GUI_GROUPS_LIST_AVAILABLE_HELP_0));
215:                iconAction.setIconPath(A_CmsUsersList.PATH_BUTTONS
216:                        + "group.png");
217:                iconAction.setEnabled(false);
218:                iconCol.addDirectAction(iconAction);
219:            }
220:
221:            /**
222:             * @see org.opencms.workplace.list.A_CmsListDialog#setMultiActions(org.opencms.workplace.list.CmsListMetadata)
223:             */
224:            protected void setMultiActions(CmsListMetadata metadata) {
225:
226:                // add add multi action
227:                CmsListMultiAction addMultiAction = new CmsListMultiAction(
228:                        LIST_MACTION_ADD);
229:                addMultiAction.setName(Messages.get().container(
230:                        Messages.GUI_GROUPS_LIST_MACTION_ADD_NAME_0));
231:                addMultiAction.setHelpText(Messages.get().container(
232:                        Messages.GUI_GROUPS_LIST_MACTION_ADD_HELP_0));
233:                addMultiAction.setConfirmationMessage(Messages.get().container(
234:                        Messages.GUI_GROUPS_LIST_MACTION_ADD_CONF_0));
235:                addMultiAction.setIconPath(ICON_MULTI_ADD);
236:                metadata.addMultiAction(addMultiAction);
237:            }
238:
239:            /**
240:             * @see org.opencms.workplace.tools.accounts.A_CmsUserGroupsList#setStateActionCol(org.opencms.workplace.list.CmsListMetadata)
241:             */
242:            protected void setStateActionCol(CmsListMetadata metadata) {
243:
244:                // create column for state change
245:                CmsListColumnDefinition stateCol = new CmsListColumnDefinition(
246:                        LIST_COLUMN_STATE);
247:                stateCol.setName(Messages.get().container(
248:                        Messages.GUI_GROUPS_LIST_COLS_STATE_0));
249:                stateCol.setHelpText(Messages.get().container(
250:                        Messages.GUI_GROUPS_LIST_COLS_STATE_HELP_0));
251:                stateCol.setWidth("20");
252:                stateCol.setAlign(CmsListColumnAlignEnum.ALIGN_CENTER);
253:                stateCol.setSorteable(false);
254:                // add it to the list definition
255:                metadata.addColumn(stateCol);
256:
257:                // add add action
258:                CmsListDirectAction stateAction = new CmsListDirectAction(
259:                        LIST_ACTION_ADD);
260:                stateAction.setName(Messages.get().container(
261:                        Messages.GUI_GROUPS_LIST_DEFACTION_ADD_NAME_0));
262:                stateAction.setHelpText(Messages.get().container(
263:                        Messages.GUI_GROUPS_LIST_DEFACTION_ADD_HELP_0));
264:                stateAction.setIconPath(ICON_ADD);
265:                stateCol.addDirectAction(stateAction);
266:                // keep the id
267:                m_addActionIds.add(stateAction.getId());
268:            }
269:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.