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.Organization;
29 import com.liferay.portal.model.OrganizationSoap;
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 OrganizationModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "Organization_";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "organizationId", new Integer(Types.BIGINT) },
64
65
66 { "companyId", new Integer(Types.BIGINT) },
67
68
69 { "parentOrganizationId", new Integer(Types.BIGINT) },
70
71
72 { "name", new Integer(Types.VARCHAR) },
73
74
75 { "location", new Integer(Types.BOOLEAN) },
76
77
78 { "recursable", new Integer(Types.BOOLEAN) },
79
80
81 { "regionId", new Integer(Types.BIGINT) },
82
83
84 { "countryId", new Integer(Types.BIGINT) },
85
86
87 { "statusId", new Integer(Types.INTEGER) },
88
89
90 { "comments", new Integer(Types.VARCHAR) }
91 };
92 public static final String TABLE_SQL_CREATE = "create table Organization_ (organizationId LONG not null primary key,companyId LONG,parentOrganizationId LONG,name VARCHAR(100) null,location BOOLEAN,recursable BOOLEAN,regionId LONG,countryId LONG,statusId INTEGER,comments STRING null)";
93 public static final String TABLE_SQL_DROP = "drop table Organization_";
94 public static final String DATA_SOURCE = "liferayDataSource";
95 public static final String SESSION_FACTORY = "liferaySessionFactory";
96 public static final String TX_MANAGER = "liferayTransactionManager";
97 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
98 "value.object.finder.cache.enabled.com.liferay.portal.model.Organization"),
99 true);
100
101 public static Organization toModel(OrganizationSoap soapModel) {
102 Organization model = new OrganizationImpl();
103
104 model.setOrganizationId(soapModel.getOrganizationId());
105 model.setCompanyId(soapModel.getCompanyId());
106 model.setParentOrganizationId(soapModel.getParentOrganizationId());
107 model.setName(soapModel.getName());
108 model.setLocation(soapModel.getLocation());
109 model.setRecursable(soapModel.getRecursable());
110 model.setRegionId(soapModel.getRegionId());
111 model.setCountryId(soapModel.getCountryId());
112 model.setStatusId(soapModel.getStatusId());
113 model.setComments(soapModel.getComments());
114
115 return model;
116 }
117
118 public static List<Organization> toModels(OrganizationSoap[] soapModels) {
119 List<Organization> models = new ArrayList<Organization>(soapModels.length);
120
121 for (OrganizationSoap soapModel : soapModels) {
122 models.add(toModel(soapModel));
123 }
124
125 return models;
126 }
127
128 public static final boolean CACHE_ENABLED_GROUPS_ORGS = com.liferay.portal.model.impl.GroupModelImpl.CACHE_ENABLED_GROUPS_ORGS;
129 public static final boolean CACHE_ENABLED_USERS_ORGS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_ORGS;
130 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
131 "lock.expiration.time.com.liferay.portal.model.Organization"));
132
133 public OrganizationModelImpl() {
134 }
135
136 public long getPrimaryKey() {
137 return _organizationId;
138 }
139
140 public void setPrimaryKey(long pk) {
141 setOrganizationId(pk);
142 }
143
144 public Serializable getPrimaryKeyObj() {
145 return new Long(_organizationId);
146 }
147
148 public long getOrganizationId() {
149 return _organizationId;
150 }
151
152 public void setOrganizationId(long organizationId) {
153 if (organizationId != _organizationId) {
154 _organizationId = organizationId;
155 }
156 }
157
158 public long getCompanyId() {
159 return _companyId;
160 }
161
162 public void setCompanyId(long companyId) {
163 if (companyId != _companyId) {
164 _companyId = companyId;
165 }
166 }
167
168 public long getParentOrganizationId() {
169 return _parentOrganizationId;
170 }
171
172 public void setParentOrganizationId(long parentOrganizationId) {
173 if (parentOrganizationId != _parentOrganizationId) {
174 _parentOrganizationId = parentOrganizationId;
175 }
176 }
177
178 public String getName() {
179 return GetterUtil.getString(_name);
180 }
181
182 public void setName(String name) {
183 if (((name == null) && (_name != null)) ||
184 ((name != null) && (_name == null)) ||
185 ((name != null) && (_name != null) && !name.equals(_name))) {
186 _name = name;
187 }
188 }
189
190 public boolean getLocation() {
191 return _location;
192 }
193
194 public boolean isLocation() {
195 return _location;
196 }
197
198 public void setLocation(boolean location) {
199 if (location != _location) {
200 _location = location;
201 }
202 }
203
204 public boolean getRecursable() {
205 return _recursable;
206 }
207
208 public boolean isRecursable() {
209 return _recursable;
210 }
211
212 public void setRecursable(boolean recursable) {
213 if (recursable != _recursable) {
214 _recursable = recursable;
215 }
216 }
217
218 public long getRegionId() {
219 return _regionId;
220 }
221
222 public void setRegionId(long regionId) {
223 if (regionId != _regionId) {
224 _regionId = regionId;
225 }
226 }
227
228 public long getCountryId() {
229 return _countryId;
230 }
231
232 public void setCountryId(long countryId) {
233 if (countryId != _countryId) {
234 _countryId = countryId;
235 }
236 }
237
238 public int getStatusId() {
239 return _statusId;
240 }
241
242 public void setStatusId(int statusId) {
243 if (statusId != _statusId) {
244 _statusId = statusId;
245 }
246 }
247
248 public String getComments() {
249 return GetterUtil.getString(_comments);
250 }
251
252 public void setComments(String comments) {
253 if (((comments == null) && (_comments != null)) ||
254 ((comments != null) && (_comments == null)) ||
255 ((comments != null) && (_comments != null) &&
256 !comments.equals(_comments))) {
257 _comments = comments;
258 }
259 }
260
261 public Organization toEscapedModel() {
262 if (isEscapedModel()) {
263 return (Organization)this;
264 }
265 else {
266 Organization model = new OrganizationImpl();
267
268 model.setNew(isNew());
269 model.setEscapedModel(true);
270
271 model.setOrganizationId(getOrganizationId());
272 model.setCompanyId(getCompanyId());
273 model.setParentOrganizationId(getParentOrganizationId());
274 model.setName(HtmlUtil.escape(getName()));
275 model.setLocation(getLocation());
276 model.setRecursable(getRecursable());
277 model.setRegionId(getRegionId());
278 model.setCountryId(getCountryId());
279 model.setStatusId(getStatusId());
280 model.setComments(HtmlUtil.escape(getComments()));
281
282 model = (Organization)Proxy.newProxyInstance(Organization.class.getClassLoader(),
283 new Class[] { Organization.class },
284 new ReadOnlyBeanHandler(model));
285
286 return model;
287 }
288 }
289
290 public Object clone() {
291 OrganizationImpl clone = new OrganizationImpl();
292
293 clone.setOrganizationId(getOrganizationId());
294 clone.setCompanyId(getCompanyId());
295 clone.setParentOrganizationId(getParentOrganizationId());
296 clone.setName(getName());
297 clone.setLocation(getLocation());
298 clone.setRecursable(getRecursable());
299 clone.setRegionId(getRegionId());
300 clone.setCountryId(getCountryId());
301 clone.setStatusId(getStatusId());
302 clone.setComments(getComments());
303
304 return clone;
305 }
306
307 public int compareTo(Object obj) {
308 if (obj == null) {
309 return -1;
310 }
311
312 OrganizationImpl organization = (OrganizationImpl)obj;
313
314 int value = 0;
315
316 value = getName().compareTo(organization.getName());
317
318 if (value != 0) {
319 return value;
320 }
321
322 return 0;
323 }
324
325 public boolean equals(Object obj) {
326 if (obj == null) {
327 return false;
328 }
329
330 OrganizationImpl organization = null;
331
332 try {
333 organization = (OrganizationImpl)obj;
334 }
335 catch (ClassCastException cce) {
336 return false;
337 }
338
339 long pk = organization.getPrimaryKey();
340
341 if (getPrimaryKey() == pk) {
342 return true;
343 }
344 else {
345 return false;
346 }
347 }
348
349 public int hashCode() {
350 return (int)getPrimaryKey();
351 }
352
353 private long _organizationId;
354 private long _companyId;
355 private long _parentOrganizationId;
356 private String _name;
357 private boolean _location;
358 private boolean _recursable;
359 private long _regionId;
360 private long _countryId;
361 private int _statusId;
362 private String _comments;
363 }