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