Source Code Cross Referenced for A_CmsOrgUnitDialog.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_CmsOrgUnitDialog.java,v $
003:         * Date   : $Date: 2008-02-27 12:05:26 $
004:         * Version: $Revision: 1.6 $
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.CmsResource;
035:        import org.opencms.jsp.CmsJspActionElement;
036:        import org.opencms.main.OpenCms;
037:        import org.opencms.security.CmsOrganizationalUnit;
038:        import org.opencms.util.CmsStringUtil;
039:        import org.opencms.workplace.CmsDialog;
040:        import org.opencms.workplace.CmsWidgetDialog;
041:        import org.opencms.workplace.CmsWorkplaceSettings;
042:
043:        import java.util.ArrayList;
044:        import java.util.Iterator;
045:        import java.util.List;
046:
047:        import javax.servlet.http.HttpServletRequest;
048:        import javax.servlet.http.HttpServletResponse;
049:        import javax.servlet.jsp.PageContext;
050:
051:        /**
052:         * Dialog to edit new or existing organizational unit in the administration view.<p>
053:         * 
054:         * @author Raphael Schnuck 
055:         * 
056:         * @version $Revision: 1.6 $ 
057:         * 
058:         * @since 6.5.6
059:         */
060:        public abstract class A_CmsOrgUnitDialog extends CmsWidgetDialog {
061:
062:            /** localized messages Keys prefix. */
063:            public static final String KEY_PREFIX = "orgunit";
064:
065:            /** Defines which pages are valid for this dialog. */
066:            public static final String[] PAGES = { "page1" };
067:
068:            /** Request parameter name for the organizational unit fqn. */
069:            public static final String PARAM_OUFQN = "oufqn";
070:
071:            /** The organizational unit bean object to work with in this dialog. */
072:            protected CmsOrgUnitBean m_orgUnitBean;
073:
074:            /** Stores the value of the request parameter for the organizational unit fqn. */
075:            private String m_paramOufqn;
076:
077:            /**
078:             * Public constructor with JSP action element.<p>
079:             * 
080:             * @param jsp an initialized JSP action element
081:             */
082:            public A_CmsOrgUnitDialog(CmsJspActionElement jsp) {
083:
084:                super (jsp);
085:            }
086:
087:            /**
088:             * Public constructor with JSP variables.<p>
089:             * 
090:             * @param context the JSP page context
091:             * @param req the JSP request
092:             * @param res the JSP response
093:             */
094:            public A_CmsOrgUnitDialog(PageContext context,
095:                    HttpServletRequest req, HttpServletResponse res) {
096:
097:                this (new CmsJspActionElement(context, req, res));
098:            }
099:
100:            /**
101:             * Returns the organizational unit fqn parameter value.<p>
102:             * 
103:             * @return the organizational unit fqn parameter value
104:             */
105:            public String getParamOufqn() {
106:
107:                return m_paramOufqn;
108:            }
109:
110:            /**
111:             * Sets the organizational unit fqn parameter value.<p>
112:             * 
113:             * @param ouFqn the organizational unit fqn parameter value
114:             */
115:            public void setParamOufqn(String ouFqn) {
116:
117:                if (ouFqn == null) {
118:                    ouFqn = "";
119:                }
120:                m_paramOufqn = ouFqn;
121:            }
122:
123:            /**
124:             * Sets the resources for the given orgUnitBean.<p>
125:             * 
126:             * @param orgUnitBean the <code>CmsOrgUnitBean</code> object
127:             * @param resources the list of resources
128:             */
129:            public void setResourcesInBean(CmsOrgUnitBean orgUnitBean,
130:                    List resources) {
131:
132:                List resourceNames = new ArrayList();
133:                Iterator itResources = resources.iterator();
134:                while (itResources.hasNext()) {
135:                    CmsResource resource = (CmsResource) itResources.next();
136:                    resourceNames.add(getCms().getSitePath(resource));
137:                }
138:                orgUnitBean.setResources(resourceNames);
139:            }
140:
141:            /**
142:             * 
143:             * @see org.opencms.workplace.CmsWidgetDialog#defineWidgets()
144:             */
145:            protected void defineWidgets() {
146:
147:                initOrgUnitObject();
148:                setKeyPrefix(KEY_PREFIX);
149:            }
150:
151:            /**
152:             * @see org.opencms.workplace.CmsWidgetDialog#getPageArray()
153:             */
154:            protected String[] getPageArray() {
155:
156:                return PAGES;
157:            }
158:
159:            /**
160:             * Initializes the organizational unit object to work with depending
161:             * on the dialog state and request parameters.<p>
162:             */
163:            protected void initOrgUnitObject() {
164:
165:                try {
166:                    if (CmsStringUtil.isEmpty(getParamAction())
167:                            || CmsDialog.DIALOG_INITIAL
168:                                    .equals(getParamAction())) {
169:                        // edit an existing ou, get the ou object from database
170:                        CmsOrganizationalUnit orgunit = OpenCms
171:                                .getOrgUnitManager().readOrganizationalUnit(
172:                                        getCms(), getParamOufqn());
173:                        m_orgUnitBean = new CmsOrgUnitBean();
174:                        if (!isNewOrgUnit()) {
175:                            m_orgUnitBean.setName(orgunit.getName());
176:                            m_orgUnitBean.setDescription(orgunit
177:                                    .getDescription(getLocale()));
178:                            m_orgUnitBean.setParentOu(orgunit.getParentFqn());
179:                            m_orgUnitBean.setFqn(orgunit.getName());
180:                            m_orgUnitBean
181:                                    .setNologin(orgunit.hasFlagHideLogin());
182:                            m_orgUnitBean.setWebusers(orgunit.hasFlagWebuser());
183:                            if (orgunit.getParentFqn() != null) {
184:                                m_orgUnitBean.setParentOuDesc(OpenCms
185:                                        .getOrgUnitManager()
186:                                        .readOrganizationalUnit(getCms(),
187:                                                orgunit.getParentFqn())
188:                                        .getDescription(getLocale())
189:                                        + " ("
190:                                        + CmsOrganizationalUnit.SEPARATOR
191:                                        + orgunit.getParentFqn() + ")");
192:                            }
193:                        } else {
194:                            m_orgUnitBean.setParentOu(orgunit.getName());
195:                            m_orgUnitBean.setParentOuDesc(orgunit
196:                                    .getDescription(getLocale())
197:                                    + " ("
198:                                    + CmsOrganizationalUnit.SEPARATOR
199:                                    + orgunit.getName() + ")");
200:                        }
201:                        List resources = OpenCms.getOrgUnitManager()
202:                                .getResourcesForOrganizationalUnit(getCms(),
203:                                        orgunit.getName());
204:                        setResourcesInBean(m_orgUnitBean, resources);
205:                    } else {
206:                        // this is not the initial call, get the ou object from session
207:                        m_orgUnitBean = (CmsOrgUnitBean) getDialogObject();
208:                        // test
209:                        m_orgUnitBean.getName();
210:                    }
211:                } catch (Exception e) {
212:                    // create a new ou object
213:                    m_orgUnitBean = new CmsOrgUnitBean();
214:                    m_orgUnitBean.setParentOu(getParamOufqn());
215:                }
216:            }
217:
218:            /**
219:             * @see org.opencms.workplace.CmsWorkplace#initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
220:             */
221:            protected void initWorkplaceRequestValues(
222:                    CmsWorkplaceSettings settings, HttpServletRequest request) {
223:
224:                // initialize parameters and dialog actions in super implementation
225:                super .initWorkplaceRequestValues(settings, request);
226:
227:                // save the current state of the ou (may be changed because of the widget values)
228:                setDialogObject(m_orgUnitBean);
229:            }
230:
231:            /**
232:             * Checks if the new organizational unit dialog has to be displayed.<p>
233:             * 
234:             * @return <code>true</code> if the new organizational unit dialog has to be displayed
235:             */
236:            protected boolean isNewOrgUnit() {
237:
238:                return getCurrentToolPath().endsWith("/orgunit/mgmt/new");
239:            }
240:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.