1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.documentlibrary.model.impl;
24  
25  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
31  
32  import com.liferay.util.Html;
33  
34  import java.io.Serializable;
35  
36  import java.lang.reflect.Proxy;
37  
38  import java.sql.Types;
39  
40  import java.util.Date;
41  
42  /**
43   * <a href="DLFileShortcutModelImpl.java.html"><b><i>View Source</i></b></a>
44   *
45   * <p>
46   * ServiceBuilder generated this class. Modifications in this class will be
47   * overwritten the next time is generated.
48   * </p>
49   *
50   * <p>
51   * This class is a model that represents the <code>DLFileShortcut</code> table
52   * in the database.
53   * </p>
54   *
55   * @author Brian Wing Shun Chan
56   *
57   * @see com.liferay.portlet.documentlibrary.service.model.DLFileShortcut
58   * @see com.liferay.portlet.documentlibrary.service.model.DLFileShortcutModel
59   * @see com.liferay.portlet.documentlibrary.service.model.impl.DLFileShortcutImpl
60   *
61   */
62  public class DLFileShortcutModelImpl extends BaseModelImpl {
63      public static final String TABLE_NAME = "DLFileShortcut";
64      public static final Object[][] TABLE_COLUMNS = {
65              { "uuid_", new Integer(Types.VARCHAR) },
66              
67  
68              { "fileShortcutId", new Integer(Types.BIGINT) },
69              
70  
71              { "companyId", new Integer(Types.BIGINT) },
72              
73  
74              { "userId", new Integer(Types.BIGINT) },
75              
76  
77              { "userName", new Integer(Types.VARCHAR) },
78              
79  
80              { "createDate", new Integer(Types.TIMESTAMP) },
81              
82  
83              { "modifiedDate", new Integer(Types.TIMESTAMP) },
84              
85  
86              { "folderId", new Integer(Types.BIGINT) },
87              
88  
89              { "toFolderId", new Integer(Types.BIGINT) },
90              
91  
92              { "toName", new Integer(Types.VARCHAR) }
93          };
94      public static final String TABLE_SQL_CREATE = "create table DLFileShortcut (uuid_ VARCHAR(75) null,fileShortcutId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,folderId LONG,toFolderId LONG,toName VARCHAR(300) null)";
95      public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
96      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
97                  "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
98              true);
99      public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
100                 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
101 
102     public DLFileShortcutModelImpl() {
103     }
104 
105     public long getPrimaryKey() {
106         return _fileShortcutId;
107     }
108 
109     public void setPrimaryKey(long pk) {
110         setFileShortcutId(pk);
111     }
112 
113     public Serializable getPrimaryKeyObj() {
114         return new Long(_fileShortcutId);
115     }
116 
117     public String getUuid() {
118         return GetterUtil.getString(_uuid);
119     }
120 
121     public void setUuid(String uuid) {
122         if ((uuid != null) && (uuid != _uuid)) {
123             _uuid = uuid;
124         }
125     }
126 
127     public long getFileShortcutId() {
128         return _fileShortcutId;
129     }
130 
131     public void setFileShortcutId(long fileShortcutId) {
132         if (fileShortcutId != _fileShortcutId) {
133             _fileShortcutId = fileShortcutId;
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 getUserId() {
148         return _userId;
149     }
150 
151     public void setUserId(long userId) {
152         if (userId != _userId) {
153             _userId = userId;
154         }
155     }
156 
157     public String getUserName() {
158         return GetterUtil.getString(_userName);
159     }
160 
161     public void setUserName(String userName) {
162         if (((userName == null) && (_userName != null)) ||
163                 ((userName != null) && (_userName == null)) ||
164                 ((userName != null) && (_userName != null) &&
165                 !userName.equals(_userName))) {
166             _userName = userName;
167         }
168     }
169 
170     public Date getCreateDate() {
171         return _createDate;
172     }
173 
174     public void setCreateDate(Date createDate) {
175         if (((createDate == null) && (_createDate != null)) ||
176                 ((createDate != null) && (_createDate == null)) ||
177                 ((createDate != null) && (_createDate != null) &&
178                 !createDate.equals(_createDate))) {
179             _createDate = createDate;
180         }
181     }
182 
183     public Date getModifiedDate() {
184         return _modifiedDate;
185     }
186 
187     public void setModifiedDate(Date modifiedDate) {
188         if (((modifiedDate == null) && (_modifiedDate != null)) ||
189                 ((modifiedDate != null) && (_modifiedDate == null)) ||
190                 ((modifiedDate != null) && (_modifiedDate != null) &&
191                 !modifiedDate.equals(_modifiedDate))) {
192             _modifiedDate = modifiedDate;
193         }
194     }
195 
196     public long getFolderId() {
197         return _folderId;
198     }
199 
200     public void setFolderId(long folderId) {
201         if (folderId != _folderId) {
202             _folderId = folderId;
203         }
204     }
205 
206     public long getToFolderId() {
207         return _toFolderId;
208     }
209 
210     public void setToFolderId(long toFolderId) {
211         if (toFolderId != _toFolderId) {
212             _toFolderId = toFolderId;
213         }
214     }
215 
216     public String getToName() {
217         return GetterUtil.getString(_toName);
218     }
219 
220     public void setToName(String toName) {
221         if (((toName == null) && (_toName != null)) ||
222                 ((toName != null) && (_toName == null)) ||
223                 ((toName != null) && (_toName != null) &&
224                 !toName.equals(_toName))) {
225             _toName = toName;
226         }
227     }
228 
229     public DLFileShortcut toEscapedModel() {
230         if (isEscapedModel()) {
231             return (DLFileShortcut)this;
232         }
233         else {
234             DLFileShortcut model = new DLFileShortcutImpl();
235 
236             model.setEscapedModel(true);
237 
238             model.setUuid(Html.escape(getUuid()));
239             model.setFileShortcutId(getFileShortcutId());
240             model.setCompanyId(getCompanyId());
241             model.setUserId(getUserId());
242             model.setUserName(Html.escape(getUserName()));
243             model.setCreateDate(getCreateDate());
244             model.setModifiedDate(getModifiedDate());
245             model.setFolderId(getFolderId());
246             model.setToFolderId(getToFolderId());
247             model.setToName(Html.escape(getToName()));
248 
249             model = (DLFileShortcut)Proxy.newProxyInstance(DLFileShortcut.class.getClassLoader(),
250                     new Class[] { DLFileShortcut.class },
251                     new ReadOnlyBeanHandler(model));
252 
253             return model;
254         }
255     }
256 
257     public Object clone() {
258         DLFileShortcutImpl clone = new DLFileShortcutImpl();
259 
260         clone.setUuid(getUuid());
261         clone.setFileShortcutId(getFileShortcutId());
262         clone.setCompanyId(getCompanyId());
263         clone.setUserId(getUserId());
264         clone.setUserName(getUserName());
265         clone.setCreateDate(getCreateDate());
266         clone.setModifiedDate(getModifiedDate());
267         clone.setFolderId(getFolderId());
268         clone.setToFolderId(getToFolderId());
269         clone.setToName(getToName());
270 
271         return clone;
272     }
273 
274     public int compareTo(Object obj) {
275         if (obj == null) {
276             return -1;
277         }
278 
279         DLFileShortcutImpl dlFileShortcut = (DLFileShortcutImpl)obj;
280 
281         long pk = dlFileShortcut.getPrimaryKey();
282 
283         if (getPrimaryKey() < pk) {
284             return -1;
285         }
286         else if (getPrimaryKey() > pk) {
287             return 1;
288         }
289         else {
290             return 0;
291         }
292     }
293 
294     public boolean equals(Object obj) {
295         if (obj == null) {
296             return false;
297         }
298 
299         DLFileShortcutImpl dlFileShortcut = null;
300 
301         try {
302             dlFileShortcut = (DLFileShortcutImpl)obj;
303         }
304         catch (ClassCastException cce) {
305             return false;
306         }
307 
308         long pk = dlFileShortcut.getPrimaryKey();
309 
310         if (getPrimaryKey() == pk) {
311             return true;
312         }
313         else {
314             return false;
315         }
316     }
317 
318     public int hashCode() {
319         return (int)getPrimaryKey();
320     }
321 
322     private String _uuid;
323     private long _fileShortcutId;
324     private long _companyId;
325     private long _userId;
326     private String _userName;
327     private Date _createDate;
328     private Date _modifiedDate;
329     private long _folderId;
330     private long _toFolderId;
331     private String _toName;
332 }