001: /*
002: * File : $Source: /usr/local/cvs/opencms/src-modules/org/opencms/workplace/tools/accounts/CmsOrgUnitBean.java,v $
003: * Date : $Date: 2008-02-27 12:05:26 $
004: * Version: $Revision: 1.5 $
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.security.CmsOrganizationalUnit;
035:
036: import java.util.ArrayList;
037: import java.util.List;
038:
039: /**
040: * Organizational unit bean for use in new organizational unit dialog.<p>
041: *
042: * @author Raphael Schnuck
043: * @author Michael Moossen
044: *
045: * @version $Revision: 1.5 $
046: *
047: * @since 6.5.6
048: */
049: public class CmsOrgUnitBean {
050:
051: /** The description of this object. */
052: private String m_description;
053:
054: /** The fqn of this object. */
055: private String m_fqn;
056:
057: /** The name of this object. */
058: private String m_name;
059:
060: /** The hidden login form flag. */
061: private boolean m_nologin;
062:
063: /** The parent ou of this object. */
064: private String m_parentOu;
065:
066: /** The description of the parent ou. */
067: private String m_parentOuDesc;
068:
069: /** The resource list of this object. */
070: private List m_resources;
071:
072: /** The webusers flag. */
073: private boolean m_webusers;
074:
075: /**
076: * Public constructor.<p>
077: */
078: public CmsOrgUnitBean() {
079:
080: m_resources = new ArrayList();
081: }
082:
083: /**
084: * Returns the description.<p>
085: *
086: * @return the description
087: */
088: public String getDescription() {
089:
090: return m_description;
091: }
092:
093: /**
094: * Returns the flag value depending on the boolean flag set.<p>
095: *
096: * @return the flag value
097: */
098: public int getFlags() {
099:
100: int flags = 0;
101: if (isNologin()) {
102: flags += CmsOrganizationalUnit.FLAG_HIDE_LOGIN;
103: }
104: if (isWebusers()) {
105: flags += CmsOrganizationalUnit.FLAG_WEBUSERS;
106: }
107: return flags;
108: }
109:
110: /**
111: * Returns the fqn.<p>
112: *
113: * @return the fqn
114: */
115: public String getFqn() {
116:
117: if (m_fqn != null) {
118: return m_fqn;
119: } else {
120: return m_parentOu + m_name;
121: }
122: }
123:
124: /**
125: * Returns the name.<p>
126: *
127: * @return the name
128: */
129: public String getName() {
130:
131: return m_name;
132: }
133:
134: /**
135: * Returns the parentOu.<p>
136: *
137: * @return the parentOu
138: */
139: public String getParentOu() {
140:
141: if (m_parentOu == null) {
142: return "";
143: }
144: return CmsOrganizationalUnit.SEPARATOR + m_parentOu;
145: }
146:
147: /**
148: * Returns the description of the parent ou.<p>
149: *
150: * @return the description of the parent ou
151: */
152: public String getParentOuDesc() {
153:
154: return m_parentOuDesc;
155: }
156:
157: /**
158: * Returns the resources.<p>
159: *
160: * @return the resources
161: */
162: public List getResources() {
163:
164: return m_resources;
165: }
166:
167: /**
168: * Returns the hidden login form flag.<p>
169: *
170: * @return the hidden login form flag
171: */
172: public boolean isNologin() {
173:
174: if (isWebusers()) {
175: return true;
176: }
177: return m_nologin;
178: }
179:
180: /**
181: * Returns the webusers flag.<p>
182: *
183: * @return the webusers flag
184: */
185: public boolean isWebusers() {
186:
187: return m_webusers;
188: }
189:
190: /**
191: * Sets the description.<p>
192: *
193: * @param description the description to set
194: */
195: public void setDescription(String description) {
196:
197: m_description = description;
198: }
199:
200: /**
201: * Sets the fqn.<p>
202: *
203: * @param fqn the fqn to set
204: */
205: public void setFqn(String fqn) {
206:
207: m_fqn = fqn;
208: }
209:
210: /**
211: * Sets the name.<p>
212: *
213: * @param name the name to set
214: */
215: public void setName(String name) {
216:
217: m_name = name;
218: }
219:
220: /**
221: * Sets the hidden login form flag.<p>
222: *
223: * @param nologin the hidden login form flag to set
224: */
225: public void setNologin(boolean nologin) {
226:
227: m_nologin = nologin;
228: }
229:
230: /**
231: * Sets the parentOu.<p>
232: *
233: * @param parentOu the parentOu to set
234: */
235: public void setParentOu(String parentOu) {
236:
237: if (parentOu.startsWith(CmsOrganizationalUnit.SEPARATOR)) {
238: parentOu = parentOu.substring(1);
239: }
240: m_parentOu = parentOu;
241: }
242:
243: /**
244: * Sets the description of the parent ou.<p>
245: *
246: * @param parentOuDesc the description of the parent ou to set
247: */
248: public void setParentOuDesc(String parentOuDesc) {
249:
250: m_parentOuDesc = parentOuDesc;
251: }
252:
253: /**
254: * Sets the resources.<p>
255: *
256: * @param resources the resources to set
257: */
258: public void setResources(List resources) {
259:
260: m_resources = resources;
261: }
262:
263: /**
264: * Sets the webusers flag.<p>
265: *
266: * @param webusers the webusers flag to set
267: */
268: public void setWebusers(boolean webusers) {
269:
270: m_webusers = webusers;
271: }
272: }
|