1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.UserGroup;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.util.Html;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38
58 public class UserGroupModelImpl extends BaseModelImpl {
59 public static final String TABLE_NAME = "UserGroup";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "userGroupId", new Integer(Types.BIGINT) },
62
63
64 { "companyId", new Integer(Types.BIGINT) },
65
66
67 { "parentUserGroupId", new Integer(Types.BIGINT) },
68
69
70 { "name", new Integer(Types.VARCHAR) },
71
72
73 { "description", new Integer(Types.VARCHAR) }
74 };
75 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)";
76 public static final String TABLE_SQL_DROP = "drop table UserGroup";
77 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
78 "value.object.finder.cache.enabled.com.liferay.portal.model.UserGroup"),
79 true);
80 public static final boolean CACHE_ENABLED_USERS_USERGROUPS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_USERGROUPS;
81 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
82 "lock.expiration.time.com.liferay.portal.model.UserGroup"));
83
84 public UserGroupModelImpl() {
85 }
86
87 public long getPrimaryKey() {
88 return _userGroupId;
89 }
90
91 public void setPrimaryKey(long pk) {
92 setUserGroupId(pk);
93 }
94
95 public Serializable getPrimaryKeyObj() {
96 return new Long(_userGroupId);
97 }
98
99 public long getUserGroupId() {
100 return _userGroupId;
101 }
102
103 public void setUserGroupId(long userGroupId) {
104 if (userGroupId != _userGroupId) {
105 _userGroupId = userGroupId;
106 }
107 }
108
109 public long getCompanyId() {
110 return _companyId;
111 }
112
113 public void setCompanyId(long companyId) {
114 if (companyId != _companyId) {
115 _companyId = companyId;
116 }
117 }
118
119 public long getParentUserGroupId() {
120 return _parentUserGroupId;
121 }
122
123 public void setParentUserGroupId(long parentUserGroupId) {
124 if (parentUserGroupId != _parentUserGroupId) {
125 _parentUserGroupId = parentUserGroupId;
126 }
127 }
128
129 public String getName() {
130 return GetterUtil.getString(_name);
131 }
132
133 public void setName(String name) {
134 if (((name == null) && (_name != null)) ||
135 ((name != null) && (_name == null)) ||
136 ((name != null) && (_name != null) && !name.equals(_name))) {
137 _name = name;
138 }
139 }
140
141 public String getDescription() {
142 return GetterUtil.getString(_description);
143 }
144
145 public void setDescription(String description) {
146 if (((description == null) && (_description != null)) ||
147 ((description != null) && (_description == null)) ||
148 ((description != null) && (_description != null) &&
149 !description.equals(_description))) {
150 _description = description;
151 }
152 }
153
154 public UserGroup toEscapedModel() {
155 if (isEscapedModel()) {
156 return (UserGroup)this;
157 }
158 else {
159 UserGroup model = new UserGroupImpl();
160
161 model.setEscapedModel(true);
162
163 model.setUserGroupId(getUserGroupId());
164 model.setCompanyId(getCompanyId());
165 model.setParentUserGroupId(getParentUserGroupId());
166 model.setName(Html.escape(getName()));
167 model.setDescription(Html.escape(getDescription()));
168
169 model = (UserGroup)Proxy.newProxyInstance(UserGroup.class.getClassLoader(),
170 new Class[] { UserGroup.class },
171 new ReadOnlyBeanHandler(model));
172
173 return model;
174 }
175 }
176
177 public Object clone() {
178 UserGroupImpl clone = new UserGroupImpl();
179
180 clone.setUserGroupId(getUserGroupId());
181 clone.setCompanyId(getCompanyId());
182 clone.setParentUserGroupId(getParentUserGroupId());
183 clone.setName(getName());
184 clone.setDescription(getDescription());
185
186 return clone;
187 }
188
189 public int compareTo(Object obj) {
190 if (obj == null) {
191 return -1;
192 }
193
194 UserGroupImpl userGroup = (UserGroupImpl)obj;
195
196 int value = 0;
197
198 value = getName().compareTo(userGroup.getName());
199
200 if (value != 0) {
201 return value;
202 }
203
204 return 0;
205 }
206
207 public boolean equals(Object obj) {
208 if (obj == null) {
209 return false;
210 }
211
212 UserGroupImpl userGroup = null;
213
214 try {
215 userGroup = (UserGroupImpl)obj;
216 }
217 catch (ClassCastException cce) {
218 return false;
219 }
220
221 long pk = userGroup.getPrimaryKey();
222
223 if (getPrimaryKey() == pk) {
224 return true;
225 }
226 else {
227 return false;
228 }
229 }
230
231 public int hashCode() {
232 return (int)getPrimaryKey();
233 }
234
235 private long _userGroupId;
236 private long _companyId;
237 private long _parentUserGroupId;
238 private String _name;
239 private String _description;
240 }