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.setEscapedModel(true);
190
191 model.setUserGroupId(getUserGroupId());
192 model.setCompanyId(getCompanyId());
193 model.setParentUserGroupId(getParentUserGroupId());
194 model.setName(HtmlUtil.escape(getName()));
195 model.setDescription(HtmlUtil.escape(getDescription()));
196
197 model = (UserGroup)Proxy.newProxyInstance(UserGroup.class.getClassLoader(),
198 new Class[] { UserGroup.class },
199 new ReadOnlyBeanHandler(model));
200
201 return model;
202 }
203 }
204
205 public Object clone() {
206 UserGroupImpl clone = new UserGroupImpl();
207
208 clone.setUserGroupId(getUserGroupId());
209 clone.setCompanyId(getCompanyId());
210 clone.setParentUserGroupId(getParentUserGroupId());
211 clone.setName(getName());
212 clone.setDescription(getDescription());
213
214 return clone;
215 }
216
217 public int compareTo(Object obj) {
218 if (obj == null) {
219 return -1;
220 }
221
222 UserGroupImpl userGroup = (UserGroupImpl)obj;
223
224 int value = 0;
225
226 value = getName().compareTo(userGroup.getName());
227
228 if (value != 0) {
229 return value;
230 }
231
232 return 0;
233 }
234
235 public boolean equals(Object obj) {
236 if (obj == null) {
237 return false;
238 }
239
240 UserGroupImpl userGroup = null;
241
242 try {
243 userGroup = (UserGroupImpl)obj;
244 }
245 catch (ClassCastException cce) {
246 return false;
247 }
248
249 long pk = userGroup.getPrimaryKey();
250
251 if (getPrimaryKey() == pk) {
252 return true;
253 }
254 else {
255 return false;
256 }
257 }
258
259 public int hashCode() {
260 return (int)getPrimaryKey();
261 }
262
263 private long _userGroupId;
264 private long _companyId;
265 private long _parentUserGroupId;
266 private String _name;
267 private String _description;
268 }