001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.Group;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="GroupModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>Group</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.Group
052: * @see com.liferay.portal.service.model.GroupModel
053: * @see com.liferay.portal.service.model.impl.GroupImpl
054: *
055: */
056: public class GroupModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "Group_";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "groupId", new Integer(Types.BIGINT) },
060:
061: { "companyId", new Integer(Types.BIGINT) },
062:
063: { "creatorUserId", new Integer(Types.BIGINT) },
064:
065: { "classNameId", new Integer(Types.BIGINT) },
066:
067: { "classPK", new Integer(Types.BIGINT) },
068:
069: { "parentGroupId", new Integer(Types.BIGINT) },
070:
071: { "liveGroupId", new Integer(Types.BIGINT) },
072:
073: { "name", new Integer(Types.VARCHAR) },
074:
075: { "description", new Integer(Types.VARCHAR) },
076:
077: { "type_", new Integer(Types.INTEGER) },
078:
079: { "typeSettings", new Integer(Types.VARCHAR) },
080:
081: { "friendlyURL", new Integer(Types.VARCHAR) },
082:
083: { "active_", new Integer(Types.BOOLEAN) } };
084: public static final String TABLE_SQL_CREATE = "create table Group_ (groupId LONG not null primary key,companyId LONG,creatorUserId LONG,classNameId LONG,classPK LONG,parentGroupId LONG,liveGroupId LONG,name VARCHAR(75) null,description STRING null,type_ INTEGER,typeSettings STRING null,friendlyURL VARCHAR(100) null,active_ BOOLEAN)";
085: public static final String TABLE_SQL_DROP = "drop table Group_";
086: public static final boolean CACHE_ENABLED = GetterUtil
087: .getBoolean(
088: PropsUtil
089: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Group"),
090: true);
091: public static final boolean CACHE_ENABLED_GROUPS_ORGS = GetterUtil
092: .getBoolean(
093: PropsUtil
094: .get("value.object.finder.cache.enabled.Groups_Orgs"),
095: true);
096: public static final boolean CACHE_ENABLED_GROUPS_PERMISSIONS = GetterUtil
097: .getBoolean(
098: PropsUtil
099: .get("value.object.finder.cache.enabled.Groups_Permissions"),
100: true);
101: public static final boolean CACHE_ENABLED_GROUPS_ROLES = GetterUtil
102: .getBoolean(
103: PropsUtil
104: .get("value.object.finder.cache.enabled.Groups_Roles"),
105: true);
106: public static final boolean CACHE_ENABLED_GROUPS_USERGROUPS = GetterUtil
107: .getBoolean(
108: PropsUtil
109: .get("value.object.finder.cache.enabled.Groups_UserGroups"),
110: true);
111: public static final boolean CACHE_ENABLED_USERS_GROUPS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_GROUPS;
112: public static final long LOCK_EXPIRATION_TIME = GetterUtil
113: .getLong(PropsUtil
114: .get("lock.expiration.time.com.liferay.portal.model.Group"));
115:
116: public GroupModelImpl() {
117: }
118:
119: public long getPrimaryKey() {
120: return _groupId;
121: }
122:
123: public void setPrimaryKey(long pk) {
124: setGroupId(pk);
125: }
126:
127: public Serializable getPrimaryKeyObj() {
128: return new Long(_groupId);
129: }
130:
131: public long getGroupId() {
132: return _groupId;
133: }
134:
135: public void setGroupId(long groupId) {
136: if (groupId != _groupId) {
137: _groupId = groupId;
138: }
139: }
140:
141: public long getCompanyId() {
142: return _companyId;
143: }
144:
145: public void setCompanyId(long companyId) {
146: if (companyId != _companyId) {
147: _companyId = companyId;
148: }
149: }
150:
151: public long getCreatorUserId() {
152: return _creatorUserId;
153: }
154:
155: public void setCreatorUserId(long creatorUserId) {
156: if (creatorUserId != _creatorUserId) {
157: _creatorUserId = creatorUserId;
158: }
159: }
160:
161: public long getClassNameId() {
162: return _classNameId;
163: }
164:
165: public void setClassNameId(long classNameId) {
166: if (classNameId != _classNameId) {
167: _classNameId = classNameId;
168: }
169: }
170:
171: public long getClassPK() {
172: return _classPK;
173: }
174:
175: public void setClassPK(long classPK) {
176: if (classPK != _classPK) {
177: _classPK = classPK;
178: }
179: }
180:
181: public long getParentGroupId() {
182: return _parentGroupId;
183: }
184:
185: public void setParentGroupId(long parentGroupId) {
186: if (parentGroupId != _parentGroupId) {
187: _parentGroupId = parentGroupId;
188: }
189: }
190:
191: public long getLiveGroupId() {
192: return _liveGroupId;
193: }
194:
195: public void setLiveGroupId(long liveGroupId) {
196: if (liveGroupId != _liveGroupId) {
197: _liveGroupId = liveGroupId;
198: }
199: }
200:
201: public String getName() {
202: return GetterUtil.getString(_name);
203: }
204:
205: public void setName(String name) {
206: if (((name == null) && (_name != null))
207: || ((name != null) && (_name == null))
208: || ((name != null) && (_name != null) && !name
209: .equals(_name))) {
210: _name = name;
211: }
212: }
213:
214: public String getDescription() {
215: return GetterUtil.getString(_description);
216: }
217:
218: public void setDescription(String description) {
219: if (((description == null) && (_description != null))
220: || ((description != null) && (_description == null))
221: || ((description != null) && (_description != null) && !description
222: .equals(_description))) {
223: _description = description;
224: }
225: }
226:
227: public int getType() {
228: return _type;
229: }
230:
231: public void setType(int type) {
232: if (type != _type) {
233: _type = type;
234: }
235: }
236:
237: public String getTypeSettings() {
238: return GetterUtil.getString(_typeSettings);
239: }
240:
241: public void setTypeSettings(String typeSettings) {
242: if (((typeSettings == null) && (_typeSettings != null))
243: || ((typeSettings != null) && (_typeSettings == null))
244: || ((typeSettings != null) && (_typeSettings != null) && !typeSettings
245: .equals(_typeSettings))) {
246: _typeSettings = typeSettings;
247: }
248: }
249:
250: public String getFriendlyURL() {
251: return GetterUtil.getString(_friendlyURL);
252: }
253:
254: public void setFriendlyURL(String friendlyURL) {
255: if (((friendlyURL == null) && (_friendlyURL != null))
256: || ((friendlyURL != null) && (_friendlyURL == null))
257: || ((friendlyURL != null) && (_friendlyURL != null) && !friendlyURL
258: .equals(_friendlyURL))) {
259: _friendlyURL = friendlyURL;
260: }
261: }
262:
263: public boolean getActive() {
264: return _active;
265: }
266:
267: public boolean isActive() {
268: return _active;
269: }
270:
271: public void setActive(boolean active) {
272: if (active != _active) {
273: _active = active;
274: }
275: }
276:
277: public Group toEscapedModel() {
278: if (isEscapedModel()) {
279: return (Group) this ;
280: } else {
281: Group model = new GroupImpl();
282:
283: model.setEscapedModel(true);
284:
285: model.setGroupId(getGroupId());
286: model.setCompanyId(getCompanyId());
287: model.setCreatorUserId(getCreatorUserId());
288: model.setClassNameId(getClassNameId());
289: model.setClassPK(getClassPK());
290: model.setParentGroupId(getParentGroupId());
291: model.setLiveGroupId(getLiveGroupId());
292: model.setName(Html.escape(getName()));
293: model.setDescription(Html.escape(getDescription()));
294: model.setType(getType());
295: model.setTypeSettings(Html.escape(getTypeSettings()));
296: model.setFriendlyURL(Html.escape(getFriendlyURL()));
297: model.setActive(getActive());
298:
299: model = (Group) Proxy.newProxyInstance(Group.class
300: .getClassLoader(), new Class[] { Group.class },
301: new ReadOnlyBeanHandler(model));
302:
303: return model;
304: }
305: }
306:
307: public Object clone() {
308: GroupImpl clone = new GroupImpl();
309:
310: clone.setGroupId(getGroupId());
311: clone.setCompanyId(getCompanyId());
312: clone.setCreatorUserId(getCreatorUserId());
313: clone.setClassNameId(getClassNameId());
314: clone.setClassPK(getClassPK());
315: clone.setParentGroupId(getParentGroupId());
316: clone.setLiveGroupId(getLiveGroupId());
317: clone.setName(getName());
318: clone.setDescription(getDescription());
319: clone.setType(getType());
320: clone.setTypeSettings(getTypeSettings());
321: clone.setFriendlyURL(getFriendlyURL());
322: clone.setActive(getActive());
323:
324: return clone;
325: }
326:
327: public int compareTo(Object obj) {
328: if (obj == null) {
329: return -1;
330: }
331:
332: GroupImpl group = (GroupImpl) obj;
333:
334: int value = 0;
335:
336: value = getName().toLowerCase().compareTo(
337: group.getName().toLowerCase());
338:
339: if (value != 0) {
340: return value;
341: }
342:
343: return 0;
344: }
345:
346: public boolean equals(Object obj) {
347: if (obj == null) {
348: return false;
349: }
350:
351: GroupImpl group = null;
352:
353: try {
354: group = (GroupImpl) obj;
355: } catch (ClassCastException cce) {
356: return false;
357: }
358:
359: long pk = group.getPrimaryKey();
360:
361: if (getPrimaryKey() == pk) {
362: return true;
363: } else {
364: return false;
365: }
366: }
367:
368: public int hashCode() {
369: return (int) getPrimaryKey();
370: }
371:
372: private long _groupId;
373: private long _companyId;
374: private long _creatorUserId;
375: private long _classNameId;
376: private long _classPK;
377: private long _parentGroupId;
378: private long _liveGroupId;
379: private String _name;
380: private String _description;
381: private int _type;
382: private String _typeSettings;
383: private String _friendlyURL;
384: private boolean _active;
385: }
|