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.kernel.util.HtmlUtil;
28 import com.liferay.portal.kernel.util.StringPool;
29 import com.liferay.portal.model.Group;
30 import com.liferay.portal.model.GroupSoap;
31 import com.liferay.portal.util.PortalUtil;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.List;
41
42
62 public class GroupModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "Group_";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "groupId", new Integer(Types.BIGINT) },
66
67
68 { "companyId", new Integer(Types.BIGINT) },
69
70
71 { "creatorUserId", new Integer(Types.BIGINT) },
72
73
74 { "classNameId", new Integer(Types.BIGINT) },
75
76
77 { "classPK", new Integer(Types.BIGINT) },
78
79
80 { "parentGroupId", new Integer(Types.BIGINT) },
81
82
83 { "liveGroupId", new Integer(Types.BIGINT) },
84
85
86 { "name", new Integer(Types.VARCHAR) },
87
88
89 { "description", new Integer(Types.VARCHAR) },
90
91
92 { "type_", new Integer(Types.INTEGER) },
93
94
95 { "typeSettings", new Integer(Types.VARCHAR) },
96
97
98 { "friendlyURL", new Integer(Types.VARCHAR) },
99
100
101 { "active_", new Integer(Types.BOOLEAN) }
102 };
103 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)";
104 public static final String TABLE_SQL_DROP = "drop table Group_";
105 public static final String DATA_SOURCE = "liferayDataSource";
106 public static final String SESSION_FACTORY = "liferaySessionFactory";
107 public static final String TX_MANAGER = "liferayTransactionManager";
108 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109 "value.object.finder.cache.enabled.com.liferay.portal.model.Group"),
110 true);
111
112 public static Group toModel(GroupSoap soapModel) {
113 Group model = new GroupImpl();
114
115 model.setGroupId(soapModel.getGroupId());
116 model.setCompanyId(soapModel.getCompanyId());
117 model.setCreatorUserId(soapModel.getCreatorUserId());
118 model.setClassNameId(soapModel.getClassNameId());
119 model.setClassPK(soapModel.getClassPK());
120 model.setParentGroupId(soapModel.getParentGroupId());
121 model.setLiveGroupId(soapModel.getLiveGroupId());
122 model.setName(soapModel.getName());
123 model.setDescription(soapModel.getDescription());
124 model.setType(soapModel.getType());
125 model.setTypeSettings(soapModel.getTypeSettings());
126 model.setFriendlyURL(soapModel.getFriendlyURL());
127 model.setActive(soapModel.getActive());
128
129 return model;
130 }
131
132 public static List<Group> toModels(GroupSoap[] soapModels) {
133 List<Group> models = new ArrayList<Group>(soapModels.length);
134
135 for (GroupSoap soapModel : soapModels) {
136 models.add(toModel(soapModel));
137 }
138
139 return models;
140 }
141
142 public static final boolean CACHE_ENABLED_GROUPS_ORGS = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
143 "value.object.finder.cache.enabled.Groups_Orgs"), true);
144 public static final boolean CACHE_ENABLED_GROUPS_PERMISSIONS = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
145 "value.object.finder.cache.enabled.Groups_Permissions"), true);
146 public static final boolean CACHE_ENABLED_GROUPS_ROLES = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
147 "value.object.finder.cache.enabled.Groups_Roles"), true);
148 public static final boolean CACHE_ENABLED_GROUPS_USERGROUPS = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
149 "value.object.finder.cache.enabled.Groups_UserGroups"), true);
150 public static final boolean CACHE_ENABLED_USERS_GROUPS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_GROUPS;
151 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
152 "lock.expiration.time.com.liferay.portal.model.Group"));
153
154 public GroupModelImpl() {
155 }
156
157 public long getPrimaryKey() {
158 return _groupId;
159 }
160
161 public void setPrimaryKey(long pk) {
162 setGroupId(pk);
163 }
164
165 public Serializable getPrimaryKeyObj() {
166 return new Long(_groupId);
167 }
168
169 public long getGroupId() {
170 return _groupId;
171 }
172
173 public void setGroupId(long groupId) {
174 if (groupId != _groupId) {
175 _groupId = groupId;
176 }
177 }
178
179 public long getCompanyId() {
180 return _companyId;
181 }
182
183 public void setCompanyId(long companyId) {
184 if (companyId != _companyId) {
185 _companyId = companyId;
186 }
187 }
188
189 public long getCreatorUserId() {
190 return _creatorUserId;
191 }
192
193 public void setCreatorUserId(long creatorUserId) {
194 if (creatorUserId != _creatorUserId) {
195 _creatorUserId = creatorUserId;
196 }
197 }
198
199 public String getClassName() {
200 if (getClassNameId() <= 0) {
201 return StringPool.BLANK;
202 }
203
204 return PortalUtil.getClassName(getClassNameId());
205 }
206
207 public long getClassNameId() {
208 return _classNameId;
209 }
210
211 public void setClassNameId(long classNameId) {
212 if (classNameId != _classNameId) {
213 _classNameId = classNameId;
214 }
215 }
216
217 public long getClassPK() {
218 return _classPK;
219 }
220
221 public void setClassPK(long classPK) {
222 if (classPK != _classPK) {
223 _classPK = classPK;
224 }
225 }
226
227 public long getParentGroupId() {
228 return _parentGroupId;
229 }
230
231 public void setParentGroupId(long parentGroupId) {
232 if (parentGroupId != _parentGroupId) {
233 _parentGroupId = parentGroupId;
234 }
235 }
236
237 public long getLiveGroupId() {
238 return _liveGroupId;
239 }
240
241 public void setLiveGroupId(long liveGroupId) {
242 if (liveGroupId != _liveGroupId) {
243 _liveGroupId = liveGroupId;
244 }
245 }
246
247 public String getName() {
248 return GetterUtil.getString(_name);
249 }
250
251 public void setName(String name) {
252 if (((name == null) && (_name != null)) ||
253 ((name != null) && (_name == null)) ||
254 ((name != null) && (_name != null) && !name.equals(_name))) {
255 _name = name;
256 }
257 }
258
259 public String getDescription() {
260 return GetterUtil.getString(_description);
261 }
262
263 public void setDescription(String description) {
264 if (((description == null) && (_description != null)) ||
265 ((description != null) && (_description == null)) ||
266 ((description != null) && (_description != null) &&
267 !description.equals(_description))) {
268 _description = description;
269 }
270 }
271
272 public int getType() {
273 return _type;
274 }
275
276 public void setType(int type) {
277 if (type != _type) {
278 _type = type;
279 }
280 }
281
282 public String getTypeSettings() {
283 return GetterUtil.getString(_typeSettings);
284 }
285
286 public void setTypeSettings(String typeSettings) {
287 if (((typeSettings == null) && (_typeSettings != null)) ||
288 ((typeSettings != null) && (_typeSettings == null)) ||
289 ((typeSettings != null) && (_typeSettings != null) &&
290 !typeSettings.equals(_typeSettings))) {
291 _typeSettings = typeSettings;
292 }
293 }
294
295 public String getFriendlyURL() {
296 return GetterUtil.getString(_friendlyURL);
297 }
298
299 public void setFriendlyURL(String friendlyURL) {
300 if (((friendlyURL == null) && (_friendlyURL != null)) ||
301 ((friendlyURL != null) && (_friendlyURL == null)) ||
302 ((friendlyURL != null) && (_friendlyURL != null) &&
303 !friendlyURL.equals(_friendlyURL))) {
304 _friendlyURL = friendlyURL;
305 }
306 }
307
308 public boolean getActive() {
309 return _active;
310 }
311
312 public boolean isActive() {
313 return _active;
314 }
315
316 public void setActive(boolean active) {
317 if (active != _active) {
318 _active = active;
319 }
320 }
321
322 public Group toEscapedModel() {
323 if (isEscapedModel()) {
324 return (Group)this;
325 }
326 else {
327 Group model = new GroupImpl();
328
329 model.setNew(isNew());
330 model.setEscapedModel(true);
331
332 model.setGroupId(getGroupId());
333 model.setCompanyId(getCompanyId());
334 model.setCreatorUserId(getCreatorUserId());
335 model.setClassNameId(getClassNameId());
336 model.setClassPK(getClassPK());
337 model.setParentGroupId(getParentGroupId());
338 model.setLiveGroupId(getLiveGroupId());
339 model.setName(HtmlUtil.escape(getName()));
340 model.setDescription(HtmlUtil.escape(getDescription()));
341 model.setType(getType());
342 model.setTypeSettings(HtmlUtil.escape(getTypeSettings()));
343 model.setFriendlyURL(HtmlUtil.escape(getFriendlyURL()));
344 model.setActive(getActive());
345
346 model = (Group)Proxy.newProxyInstance(Group.class.getClassLoader(),
347 new Class[] { Group.class }, new ReadOnlyBeanHandler(model));
348
349 return model;
350 }
351 }
352
353 public Object clone() {
354 GroupImpl clone = new GroupImpl();
355
356 clone.setGroupId(getGroupId());
357 clone.setCompanyId(getCompanyId());
358 clone.setCreatorUserId(getCreatorUserId());
359 clone.setClassNameId(getClassNameId());
360 clone.setClassPK(getClassPK());
361 clone.setParentGroupId(getParentGroupId());
362 clone.setLiveGroupId(getLiveGroupId());
363 clone.setName(getName());
364 clone.setDescription(getDescription());
365 clone.setType(getType());
366 clone.setTypeSettings(getTypeSettings());
367 clone.setFriendlyURL(getFriendlyURL());
368 clone.setActive(getActive());
369
370 return clone;
371 }
372
373 public int compareTo(Object obj) {
374 if (obj == null) {
375 return -1;
376 }
377
378 GroupImpl group = (GroupImpl)obj;
379
380 int value = 0;
381
382 value = getName().toLowerCase().compareTo(group.getName().toLowerCase());
383
384 if (value != 0) {
385 return value;
386 }
387
388 return 0;
389 }
390
391 public boolean equals(Object obj) {
392 if (obj == null) {
393 return false;
394 }
395
396 GroupImpl group = null;
397
398 try {
399 group = (GroupImpl)obj;
400 }
401 catch (ClassCastException cce) {
402 return false;
403 }
404
405 long pk = group.getPrimaryKey();
406
407 if (getPrimaryKey() == pk) {
408 return true;
409 }
410 else {
411 return false;
412 }
413 }
414
415 public int hashCode() {
416 return (int)getPrimaryKey();
417 }
418
419 private long _groupId;
420 private long _companyId;
421 private long _creatorUserId;
422 private long _classNameId;
423 private long _classPK;
424 private long _parentGroupId;
425 private long _liveGroupId;
426 private String _name;
427 private String _description;
428 private int _type;
429 private String _typeSettings;
430 private String _friendlyURL;
431 private boolean _active;
432 }