001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.GetterUtil;
025: import com.liferay.portal.model.Organization;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.util.Html;
029:
030: import java.io.Serializable;
031:
032: import java.lang.reflect.Proxy;
033:
034: import java.sql.Types;
035:
036: /**
037: * <a href="OrganizationModelImpl.java.html"><b><i>View Source</i></b></a>
038: *
039: * <p>
040: * ServiceBuilder generated this class. Modifications in this class will be
041: * overwritten the next time is generated.
042: * </p>
043: *
044: * <p>
045: * This class is a model that represents the <code>Organization</code> table
046: * in the database.
047: * </p>
048: *
049: * @author Brian Wing Shun Chan
050: *
051: * @see com.liferay.portal.service.model.Organization
052: * @see com.liferay.portal.service.model.OrganizationModel
053: * @see com.liferay.portal.service.model.impl.OrganizationImpl
054: *
055: */
056: public class OrganizationModelImpl extends BaseModelImpl {
057: public static final String TABLE_NAME = "Organization_";
058: public static final Object[][] TABLE_COLUMNS = {
059: { "organizationId", new Integer(Types.BIGINT) },
060:
061: { "companyId", new Integer(Types.BIGINT) },
062:
063: { "parentOrganizationId", new Integer(Types.BIGINT) },
064:
065: { "name", new Integer(Types.VARCHAR) },
066:
067: { "location", new Integer(Types.BOOLEAN) },
068:
069: { "recursable", new Integer(Types.BOOLEAN) },
070:
071: { "regionId", new Integer(Types.BIGINT) },
072:
073: { "countryId", new Integer(Types.BIGINT) },
074:
075: { "statusId", new Integer(Types.INTEGER) },
076:
077: { "comments", new Integer(Types.VARCHAR) } };
078: 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)";
079: public static final String TABLE_SQL_DROP = "drop table Organization_";
080: public static final boolean CACHE_ENABLED = GetterUtil
081: .getBoolean(
082: PropsUtil
083: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Organization"),
084: true);
085: public static final boolean CACHE_ENABLED_GROUPS_ORGS = com.liferay.portal.model.impl.GroupModelImpl.CACHE_ENABLED_GROUPS_ORGS;
086: public static final boolean CACHE_ENABLED_USERS_ORGS = com.liferay.portal.model.impl.UserModelImpl.CACHE_ENABLED_USERS_ORGS;
087: public static final long LOCK_EXPIRATION_TIME = GetterUtil
088: .getLong(PropsUtil
089: .get("lock.expiration.time.com.liferay.portal.model.Organization"));
090:
091: public OrganizationModelImpl() {
092: }
093:
094: public long getPrimaryKey() {
095: return _organizationId;
096: }
097:
098: public void setPrimaryKey(long pk) {
099: setOrganizationId(pk);
100: }
101:
102: public Serializable getPrimaryKeyObj() {
103: return new Long(_organizationId);
104: }
105:
106: public long getOrganizationId() {
107: return _organizationId;
108: }
109:
110: public void setOrganizationId(long organizationId) {
111: if (organizationId != _organizationId) {
112: _organizationId = organizationId;
113: }
114: }
115:
116: public long getCompanyId() {
117: return _companyId;
118: }
119:
120: public void setCompanyId(long companyId) {
121: if (companyId != _companyId) {
122: _companyId = companyId;
123: }
124: }
125:
126: public long getParentOrganizationId() {
127: return _parentOrganizationId;
128: }
129:
130: public void setParentOrganizationId(long parentOrganizationId) {
131: if (parentOrganizationId != _parentOrganizationId) {
132: _parentOrganizationId = parentOrganizationId;
133: }
134: }
135:
136: public String getName() {
137: return GetterUtil.getString(_name);
138: }
139:
140: public void setName(String name) {
141: if (((name == null) && (_name != null))
142: || ((name != null) && (_name == null))
143: || ((name != null) && (_name != null) && !name
144: .equals(_name))) {
145: _name = name;
146: }
147: }
148:
149: public boolean getLocation() {
150: return _location;
151: }
152:
153: public boolean isLocation() {
154: return _location;
155: }
156:
157: public void setLocation(boolean location) {
158: if (location != _location) {
159: _location = location;
160: }
161: }
162:
163: public boolean getRecursable() {
164: return _recursable;
165: }
166:
167: public boolean isRecursable() {
168: return _recursable;
169: }
170:
171: public void setRecursable(boolean recursable) {
172: if (recursable != _recursable) {
173: _recursable = recursable;
174: }
175: }
176:
177: public long getRegionId() {
178: return _regionId;
179: }
180:
181: public void setRegionId(long regionId) {
182: if (regionId != _regionId) {
183: _regionId = regionId;
184: }
185: }
186:
187: public long getCountryId() {
188: return _countryId;
189: }
190:
191: public void setCountryId(long countryId) {
192: if (countryId != _countryId) {
193: _countryId = countryId;
194: }
195: }
196:
197: public int getStatusId() {
198: return _statusId;
199: }
200:
201: public void setStatusId(int statusId) {
202: if (statusId != _statusId) {
203: _statusId = statusId;
204: }
205: }
206:
207: public String getComments() {
208: return GetterUtil.getString(_comments);
209: }
210:
211: public void setComments(String comments) {
212: if (((comments == null) && (_comments != null))
213: || ((comments != null) && (_comments == null))
214: || ((comments != null) && (_comments != null) && !comments
215: .equals(_comments))) {
216: _comments = comments;
217: }
218: }
219:
220: public Organization toEscapedModel() {
221: if (isEscapedModel()) {
222: return (Organization) this ;
223: } else {
224: Organization model = new OrganizationImpl();
225:
226: model.setEscapedModel(true);
227:
228: model.setOrganizationId(getOrganizationId());
229: model.setCompanyId(getCompanyId());
230: model.setParentOrganizationId(getParentOrganizationId());
231: model.setName(Html.escape(getName()));
232: model.setLocation(getLocation());
233: model.setRecursable(getRecursable());
234: model.setRegionId(getRegionId());
235: model.setCountryId(getCountryId());
236: model.setStatusId(getStatusId());
237: model.setComments(Html.escape(getComments()));
238:
239: model = (Organization) Proxy.newProxyInstance(
240: Organization.class.getClassLoader(),
241: new Class[] { Organization.class },
242: new ReadOnlyBeanHandler(model));
243:
244: return model;
245: }
246: }
247:
248: public Object clone() {
249: OrganizationImpl clone = new OrganizationImpl();
250:
251: clone.setOrganizationId(getOrganizationId());
252: clone.setCompanyId(getCompanyId());
253: clone.setParentOrganizationId(getParentOrganizationId());
254: clone.setName(getName());
255: clone.setLocation(getLocation());
256: clone.setRecursable(getRecursable());
257: clone.setRegionId(getRegionId());
258: clone.setCountryId(getCountryId());
259: clone.setStatusId(getStatusId());
260: clone.setComments(getComments());
261:
262: return clone;
263: }
264:
265: public int compareTo(Object obj) {
266: if (obj == null) {
267: return -1;
268: }
269:
270: OrganizationImpl organization = (OrganizationImpl) obj;
271:
272: int value = 0;
273:
274: value = getName().compareTo(organization.getName());
275:
276: if (value != 0) {
277: return value;
278: }
279:
280: return 0;
281: }
282:
283: public boolean equals(Object obj) {
284: if (obj == null) {
285: return false;
286: }
287:
288: OrganizationImpl organization = null;
289:
290: try {
291: organization = (OrganizationImpl) obj;
292: } catch (ClassCastException cce) {
293: return false;
294: }
295:
296: long pk = organization.getPrimaryKey();
297:
298: if (getPrimaryKey() == pk) {
299: return true;
300: } else {
301: return false;
302: }
303: }
304:
305: public int hashCode() {
306: return (int) getPrimaryKey();
307: }
308:
309: private long _organizationId;
310: private long _companyId;
311: private long _parentOrganizationId;
312: private String _name;
313: private boolean _location;
314: private boolean _recursable;
315: private long _regionId;
316: private long _countryId;
317: private int _statusId;
318: private String _comments;
319: }
|