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.Group;
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 GroupModelImpl extends BaseModelImpl {
59 public static final String TABLE_NAME = "Group_";
60 public static final Object[][] TABLE_COLUMNS = {
61 { "groupId", new Integer(Types.BIGINT) },
62
63
64 { "companyId", new Integer(Types.BIGINT) },
65
66
67 { "creatorUserId", new Integer(Types.BIGINT) },
68
69
70 { "classNameId", new Integer(Types.BIGINT) },
71
72
73 { "classPK", new Integer(Types.BIGINT) },
74
75
76 { "parentGroupId", new Integer(Types.BIGINT) },
77
78
79 { "liveGroupId", new Integer(Types.BIGINT) },
80
81
82 { "name", new Integer(Types.VARCHAR) },
83
84
85 { "description", new Integer(Types.VARCHAR) },
86
87
88 { "type_", new Integer(Types.INTEGER) },
89
90
91 { "typeSettings", new Integer(Types.VARCHAR) },
92
93
94 { "friendlyURL", new Integer(Types.VARCHAR) },
95
96
97 { "active_", new Integer(Types.BOOLEAN) }
98 };
99 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)";
100 public static final String TABLE_SQL_DROP = "drop table Group_";
101 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
102 "value.object.finder.cache.enabled.com.liferay.portal.model.Group"),
103 true);
104 public static final boolean CACHE_ENABLED_GROUPS_ORGS = GetterUtil.getBoolean(PropsUtil.get(
105 "value.object.finder.cache.enabled.Groups_Orgs"), true);
106 public static final boolean CACHE_ENABLED_GROUPS_PERMISSIONS = GetterUtil.getBoolean(PropsUtil.get(
107 "value.object.finder.cache.enabled.Groups_Permissions"), true);
108 public static final boolean CACHE_ENABLED_GROUPS_ROLES = GetterUtil.getBoolean(PropsUtil.get(
109 "value.object.finder.cache.enabled.Groups_Roles"), true);
110 public static final boolean CACHE_ENABLED_GROUPS_USERGROUPS = GetterUtil.getBoolean(PropsUtil.get(
111 "value.object.finder.cache.enabled.Groups_UserGroups"), true);
112 public static final boolean CACHE_ENABLED_USERS_GROUPS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_GROUPS;
113 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
114 "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.equals(_name))) {
209 _name = name;
210 }
211 }
212
213 public String getDescription() {
214 return GetterUtil.getString(_description);
215 }
216
217 public void setDescription(String description) {
218 if (((description == null) && (_description != null)) ||
219 ((description != null) && (_description == null)) ||
220 ((description != null) && (_description != null) &&
221 !description.equals(_description))) {
222 _description = description;
223 }
224 }
225
226 public int getType() {
227 return _type;
228 }
229
230 public void setType(int type) {
231 if (type != _type) {
232 _type = type;
233 }
234 }
235
236 public String getTypeSettings() {
237 return GetterUtil.getString(_typeSettings);
238 }
239
240 public void setTypeSettings(String typeSettings) {
241 if (((typeSettings == null) && (_typeSettings != null)) ||
242 ((typeSettings != null) && (_typeSettings == null)) ||
243 ((typeSettings != null) && (_typeSettings != null) &&
244 !typeSettings.equals(_typeSettings))) {
245 _typeSettings = typeSettings;
246 }
247 }
248
249 public String getFriendlyURL() {
250 return GetterUtil.getString(_friendlyURL);
251 }
252
253 public void setFriendlyURL(String friendlyURL) {
254 if (((friendlyURL == null) && (_friendlyURL != null)) ||
255 ((friendlyURL != null) && (_friendlyURL == null)) ||
256 ((friendlyURL != null) && (_friendlyURL != null) &&
257 !friendlyURL.equals(_friendlyURL))) {
258 _friendlyURL = friendlyURL;
259 }
260 }
261
262 public boolean getActive() {
263 return _active;
264 }
265
266 public boolean isActive() {
267 return _active;
268 }
269
270 public void setActive(boolean active) {
271 if (active != _active) {
272 _active = active;
273 }
274 }
275
276 public Group toEscapedModel() {
277 if (isEscapedModel()) {
278 return (Group)this;
279 }
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.getClassLoader(),
300 new Class[] { Group.class }, new ReadOnlyBeanHandler(model));
301
302 return model;
303 }
304 }
305
306 public Object clone() {
307 GroupImpl clone = new GroupImpl();
308
309 clone.setGroupId(getGroupId());
310 clone.setCompanyId(getCompanyId());
311 clone.setCreatorUserId(getCreatorUserId());
312 clone.setClassNameId(getClassNameId());
313 clone.setClassPK(getClassPK());
314 clone.setParentGroupId(getParentGroupId());
315 clone.setLiveGroupId(getLiveGroupId());
316 clone.setName(getName());
317 clone.setDescription(getDescription());
318 clone.setType(getType());
319 clone.setTypeSettings(getTypeSettings());
320 clone.setFriendlyURL(getFriendlyURL());
321 clone.setActive(getActive());
322
323 return clone;
324 }
325
326 public int compareTo(Object obj) {
327 if (obj == null) {
328 return -1;
329 }
330
331 GroupImpl group = (GroupImpl)obj;
332
333 int value = 0;
334
335 value = getName().toLowerCase().compareTo(group.getName().toLowerCase());
336
337 if (value != 0) {
338 return value;
339 }
340
341 return 0;
342 }
343
344 public boolean equals(Object obj) {
345 if (obj == null) {
346 return false;
347 }
348
349 GroupImpl group = null;
350
351 try {
352 group = (GroupImpl)obj;
353 }
354 catch (ClassCastException cce) {
355 return false;
356 }
357
358 long pk = group.getPrimaryKey();
359
360 if (getPrimaryKey() == pk) {
361 return true;
362 }
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 }