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.UserGroup;
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="UserGroupModelImpl.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>UserGroup</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.UserGroup
052: * @see com.liferay.portal.service.model.UserGroupModel
053: * @see com.liferay.portal.service.model.impl.UserGroupImpl
054: *
055: */
056: public class UserGroupModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "UserGroup";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "userGroupId", new Integer(Types.BIGINT) },
060:
061: { "companyId", new Integer(Types.BIGINT) },
062:
063: { "parentUserGroupId", new Integer(Types.BIGINT) },
064:
065: { "name", new Integer(Types.VARCHAR) },
066:
067: { "description", new Integer(Types.VARCHAR) } };
068: public static final String TABLE_SQL_CREATE = "create table UserGroup (userGroupId LONG not null primary key,companyId LONG,parentUserGroupId LONG,name VARCHAR(75) null,description STRING null)";
069: public static final String TABLE_SQL_DROP = "drop table UserGroup";
070: public static final boolean CACHE_ENABLED = GetterUtil
071: .getBoolean(
072: PropsUtil
073: .get("value.object.finder.cache.enabled.com.liferay.portal.model.UserGroup"),
074: true);
075: public static final boolean CACHE_ENABLED_USERS_USERGROUPS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_USERGROUPS;
076: public static final long LOCK_EXPIRATION_TIME = GetterUtil
077: .getLong(PropsUtil
078: .get("lock.expiration.time.com.liferay.portal.model.UserGroup"));
079:
080: public UserGroupModelImpl() {
081: }
082:
083: public long getPrimaryKey() {
084: return _userGroupId;
085: }
086:
087: public void setPrimaryKey(long pk) {
088: setUserGroupId(pk);
089: }
090:
091: public Serializable getPrimaryKeyObj() {
092: return new Long(_userGroupId);
093: }
094:
095: public long getUserGroupId() {
096: return _userGroupId;
097: }
098:
099: public void setUserGroupId(long userGroupId) {
100: if (userGroupId != _userGroupId) {
101: _userGroupId = userGroupId;
102: }
103: }
104:
105: public long getCompanyId() {
106: return _companyId;
107: }
108:
109: public void setCompanyId(long companyId) {
110: if (companyId != _companyId) {
111: _companyId = companyId;
112: }
113: }
114:
115: public long getParentUserGroupId() {
116: return _parentUserGroupId;
117: }
118:
119: public void setParentUserGroupId(long parentUserGroupId) {
120: if (parentUserGroupId != _parentUserGroupId) {
121: _parentUserGroupId = parentUserGroupId;
122: }
123: }
124:
125: public String getName() {
126: return GetterUtil.getString(_name);
127: }
128:
129: public void setName(String name) {
130: if (((name == null) && (_name != null))
131: || ((name != null) && (_name == null))
132: || ((name != null) && (_name != null) && !name
133: .equals(_name))) {
134: _name = name;
135: }
136: }
137:
138: public String getDescription() {
139: return GetterUtil.getString(_description);
140: }
141:
142: public void setDescription(String description) {
143: if (((description == null) && (_description != null))
144: || ((description != null) && (_description == null))
145: || ((description != null) && (_description != null) && !description
146: .equals(_description))) {
147: _description = description;
148: }
149: }
150:
151: public UserGroup toEscapedModel() {
152: if (isEscapedModel()) {
153: return (UserGroup) this ;
154: } else {
155: UserGroup model = new UserGroupImpl();
156:
157: model.setEscapedModel(true);
158:
159: model.setUserGroupId(getUserGroupId());
160: model.setCompanyId(getCompanyId());
161: model.setParentUserGroupId(getParentUserGroupId());
162: model.setName(Html.escape(getName()));
163: model.setDescription(Html.escape(getDescription()));
164:
165: model = (UserGroup) Proxy.newProxyInstance(UserGroup.class
166: .getClassLoader(), new Class[] { UserGroup.class },
167: new ReadOnlyBeanHandler(model));
168:
169: return model;
170: }
171: }
172:
173: public Object clone() {
174: UserGroupImpl clone = new UserGroupImpl();
175:
176: clone.setUserGroupId(getUserGroupId());
177: clone.setCompanyId(getCompanyId());
178: clone.setParentUserGroupId(getParentUserGroupId());
179: clone.setName(getName());
180: clone.setDescription(getDescription());
181:
182: return clone;
183: }
184:
185: public int compareTo(Object obj) {
186: if (obj == null) {
187: return -1;
188: }
189:
190: UserGroupImpl userGroup = (UserGroupImpl) obj;
191:
192: int value = 0;
193:
194: value = getName().compareTo(userGroup.getName());
195:
196: if (value != 0) {
197: return value;
198: }
199:
200: return 0;
201: }
202:
203: public boolean equals(Object obj) {
204: if (obj == null) {
205: return false;
206: }
207:
208: UserGroupImpl userGroup = null;
209:
210: try {
211: userGroup = (UserGroupImpl) obj;
212: } catch (ClassCastException cce) {
213: return false;
214: }
215:
216: long pk = userGroup.getPrimaryKey();
217:
218: if (getPrimaryKey() == pk) {
219: return true;
220: } else {
221: return false;
222: }
223: }
224:
225: public int hashCode() {
226: return (int) getPrimaryKey();
227: }
228:
229: private long _userGroupId;
230: private long _companyId;
231: private long _parentUserGroupId;
232: private String _name;
233: private String _description;
234: }
|