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.portlet.imagegallery.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.impl.BaseModelImpl;
026: import com.liferay.portal.util.PropsUtil;
027:
028: import com.liferay.portlet.imagegallery.model.IGFolder;
029:
030: import com.liferay.util.Html;
031:
032: import java.io.Serializable;
033:
034: import java.lang.reflect.Proxy;
035:
036: import java.sql.Types;
037:
038: import java.util.Date;
039:
040: /**
041: * <a href="IGFolderModelImpl.java.html"><b><i>View Source</i></b></a>
042: *
043: * <p>
044: * ServiceBuilder generated this class. Modifications in this class will be
045: * overwritten the next time is generated.
046: * </p>
047: *
048: * <p>
049: * This class is a model that represents the <code>IGFolder</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.imagegallery.service.model.IGFolder
056: * @see com.liferay.portlet.imagegallery.service.model.IGFolderModel
057: * @see com.liferay.portlet.imagegallery.service.model.impl.IGFolderImpl
058: *
059: */
060: public class IGFolderModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "IGFolder";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "folderId", new Integer(Types.BIGINT) },
066:
067: { "groupId", new Integer(Types.BIGINT) },
068:
069: { "companyId", new Integer(Types.BIGINT) },
070:
071: { "userId", new Integer(Types.BIGINT) },
072:
073: { "createDate", new Integer(Types.TIMESTAMP) },
074:
075: { "modifiedDate", new Integer(Types.TIMESTAMP) },
076:
077: { "parentFolderId", new Integer(Types.BIGINT) },
078:
079: { "name", new Integer(Types.VARCHAR) },
080:
081: { "description", new Integer(Types.VARCHAR) } };
082: public static final String TABLE_SQL_CREATE = "create table IGFolder (uuid_ VARCHAR(75) null,folderId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,parentFolderId LONG,name VARCHAR(75) null,description STRING null)";
083: public static final String TABLE_SQL_DROP = "drop table IGFolder";
084: public static final boolean CACHE_ENABLED = GetterUtil
085: .getBoolean(
086: PropsUtil
087: .get("value.object.finder.cache.enabled.com.liferay.portlet.imagegallery.model.IGFolder"),
088: true);
089: public static final long LOCK_EXPIRATION_TIME = GetterUtil
090: .getLong(PropsUtil
091: .get("lock.expiration.time.com.liferay.portlet.imagegallery.model.IGFolder"));
092:
093: public IGFolderModelImpl() {
094: }
095:
096: public long getPrimaryKey() {
097: return _folderId;
098: }
099:
100: public void setPrimaryKey(long pk) {
101: setFolderId(pk);
102: }
103:
104: public Serializable getPrimaryKeyObj() {
105: return new Long(_folderId);
106: }
107:
108: public String getUuid() {
109: return GetterUtil.getString(_uuid);
110: }
111:
112: public void setUuid(String uuid) {
113: if ((uuid != null) && (uuid != _uuid)) {
114: _uuid = uuid;
115: }
116: }
117:
118: public long getFolderId() {
119: return _folderId;
120: }
121:
122: public void setFolderId(long folderId) {
123: if (folderId != _folderId) {
124: _folderId = folderId;
125: }
126: }
127:
128: public long getGroupId() {
129: return _groupId;
130: }
131:
132: public void setGroupId(long groupId) {
133: if (groupId != _groupId) {
134: _groupId = groupId;
135: }
136: }
137:
138: public long getCompanyId() {
139: return _companyId;
140: }
141:
142: public void setCompanyId(long companyId) {
143: if (companyId != _companyId) {
144: _companyId = companyId;
145: }
146: }
147:
148: public long getUserId() {
149: return _userId;
150: }
151:
152: public void setUserId(long userId) {
153: if (userId != _userId) {
154: _userId = userId;
155: }
156: }
157:
158: public Date getCreateDate() {
159: return _createDate;
160: }
161:
162: public void setCreateDate(Date createDate) {
163: if (((createDate == null) && (_createDate != null))
164: || ((createDate != null) && (_createDate == null))
165: || ((createDate != null) && (_createDate != null) && !createDate
166: .equals(_createDate))) {
167: _createDate = createDate;
168: }
169: }
170:
171: public Date getModifiedDate() {
172: return _modifiedDate;
173: }
174:
175: public void setModifiedDate(Date modifiedDate) {
176: if (((modifiedDate == null) && (_modifiedDate != null))
177: || ((modifiedDate != null) && (_modifiedDate == null))
178: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
179: .equals(_modifiedDate))) {
180: _modifiedDate = modifiedDate;
181: }
182: }
183:
184: public long getParentFolderId() {
185: return _parentFolderId;
186: }
187:
188: public void setParentFolderId(long parentFolderId) {
189: if (parentFolderId != _parentFolderId) {
190: _parentFolderId = parentFolderId;
191: }
192: }
193:
194: public String getName() {
195: return GetterUtil.getString(_name);
196: }
197:
198: public void setName(String name) {
199: if (((name == null) && (_name != null))
200: || ((name != null) && (_name == null))
201: || ((name != null) && (_name != null) && !name
202: .equals(_name))) {
203: _name = name;
204: }
205: }
206:
207: public String getDescription() {
208: return GetterUtil.getString(_description);
209: }
210:
211: public void setDescription(String description) {
212: if (((description == null) && (_description != null))
213: || ((description != null) && (_description == null))
214: || ((description != null) && (_description != null) && !description
215: .equals(_description))) {
216: _description = description;
217: }
218: }
219:
220: public IGFolder toEscapedModel() {
221: if (isEscapedModel()) {
222: return (IGFolder) this ;
223: } else {
224: IGFolder model = new IGFolderImpl();
225:
226: model.setEscapedModel(true);
227:
228: model.setUuid(Html.escape(getUuid()));
229: model.setFolderId(getFolderId());
230: model.setGroupId(getGroupId());
231: model.setCompanyId(getCompanyId());
232: model.setUserId(getUserId());
233: model.setCreateDate(getCreateDate());
234: model.setModifiedDate(getModifiedDate());
235: model.setParentFolderId(getParentFolderId());
236: model.setName(Html.escape(getName()));
237: model.setDescription(Html.escape(getDescription()));
238:
239: model = (IGFolder) Proxy.newProxyInstance(IGFolder.class
240: .getClassLoader(), new Class[] { IGFolder.class },
241: new ReadOnlyBeanHandler(model));
242:
243: return model;
244: }
245: }
246:
247: public Object clone() {
248: IGFolderImpl clone = new IGFolderImpl();
249:
250: clone.setUuid(getUuid());
251: clone.setFolderId(getFolderId());
252: clone.setGroupId(getGroupId());
253: clone.setCompanyId(getCompanyId());
254: clone.setUserId(getUserId());
255: clone.setCreateDate(getCreateDate());
256: clone.setModifiedDate(getModifiedDate());
257: clone.setParentFolderId(getParentFolderId());
258: clone.setName(getName());
259: clone.setDescription(getDescription());
260:
261: return clone;
262: }
263:
264: public int compareTo(Object obj) {
265: if (obj == null) {
266: return -1;
267: }
268:
269: IGFolderImpl igFolder = (IGFolderImpl) obj;
270:
271: int value = 0;
272:
273: if (getFolderId() < igFolder.getFolderId()) {
274: value = -1;
275: } else if (getFolderId() > igFolder.getFolderId()) {
276: value = 1;
277: } else {
278: value = 0;
279: }
280:
281: if (value != 0) {
282: return value;
283: }
284:
285: value = getName().toLowerCase().compareTo(
286: igFolder.getName().toLowerCase());
287:
288: if (value != 0) {
289: return value;
290: }
291:
292: return 0;
293: }
294:
295: public boolean equals(Object obj) {
296: if (obj == null) {
297: return false;
298: }
299:
300: IGFolderImpl igFolder = null;
301:
302: try {
303: igFolder = (IGFolderImpl) obj;
304: } catch (ClassCastException cce) {
305: return false;
306: }
307:
308: long pk = igFolder.getPrimaryKey();
309:
310: if (getPrimaryKey() == pk) {
311: return true;
312: } else {
313: return false;
314: }
315: }
316:
317: public int hashCode() {
318: return (int) getPrimaryKey();
319: }
320:
321: private String _uuid;
322: private long _folderId;
323: private long _groupId;
324: private long _companyId;
325: private long _userId;
326: private Date _createDate;
327: private Date _modifiedDate;
328: private long _parentFolderId;
329: private String _name;
330: private String _description;
331: }
|