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.kernel.util.HtmlUtil;
28  import com.liferay.portal.model.impl.BaseModelImpl;
29  
30  import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
31  import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
32  
33  import java.io.Serializable;
34  
35  import java.lang.reflect.Proxy;
36  
37  import java.sql.Types;
38  
39  import java.util.ArrayList;
40  import java.util.Date;
41  import java.util.List;
42  
43  /**
44   * <a href="DLFileShortcutModelImpl.java.html"><b><i>View Source</i></b></a>
45   *
46   * <p>
47   * ServiceBuilder generated this class. Modifications in this class will be
48   * overwritten the next time is generated.
49   * </p>
50   *
51   * <p>
52   * This class is a model that represents the <code>DLFileShortcut</code> table
53   * in the database.
54   * </p>
55   *
56   * @author Brian Wing Shun Chan
57   *
58   * @see com.liferay.portlet.documentlibrary.service.model.DLFileShortcut
59   * @see com.liferay.portlet.documentlibrary.service.model.DLFileShortcutModel
60   * @see com.liferay.portlet.documentlibrary.service.model.impl.DLFileShortcutImpl
61   *
62   */
63  public class DLFileShortcutModelImpl extends BaseModelImpl {
64      public static final String TABLE_NAME = "DLFileShortcut";
65      public static final Object[][] TABLE_COLUMNS = {
66              { "uuid_", new Integer(Types.VARCHAR) },
67              
68  
69              { "fileShortcutId", new Integer(Types.BIGINT) },
70              
71  
72              { "companyId", new Integer(Types.BIGINT) },
73              
74  
75              { "userId", new Integer(Types.BIGINT) },
76              
77  
78              { "userName", new Integer(Types.VARCHAR) },
79              
80  
81              { "createDate", new Integer(Types.TIMESTAMP) },
82              
83  
84              { "modifiedDate", new Integer(Types.TIMESTAMP) },
85              
86  
87              { "folderId", new Integer(Types.BIGINT) },
88              
89  
90              { "toFolderId", new Integer(Types.BIGINT) },
91              
92  
93              { "toName", new Integer(Types.VARCHAR) }
94          };
95      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)";
96      public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
97      public static final String DATA_SOURCE = "liferayDataSource";
98      public static final String SESSION_FACTORY = "liferaySessionFactory";
99      public static final String TX_MANAGER = "liferayTransactionManager";
100     public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101                 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
102             true);
103 
104     public static DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
105         DLFileShortcut model = new DLFileShortcutImpl();
106 
107         model.setUuid(soapModel.getUuid());
108         model.setFileShortcutId(soapModel.getFileShortcutId());
109         model.setCompanyId(soapModel.getCompanyId());
110         model.setUserId(soapModel.getUserId());
111         model.setUserName(soapModel.getUserName());
112         model.setCreateDate(soapModel.getCreateDate());
113         model.setModifiedDate(soapModel.getModifiedDate());
114         model.setFolderId(soapModel.getFolderId());
115         model.setToFolderId(soapModel.getToFolderId());
116         model.setToName(soapModel.getToName());
117 
118         return model;
119     }
120 
121     public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
122         List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
123 
124         for (DLFileShortcutSoap soapModel : soapModels) {
125             models.add(toModel(soapModel));
126         }
127 
128         return models;
129     }
130 
131     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
132                 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
133 
134     public DLFileShortcutModelImpl() {
135     }
136 
137     public long getPrimaryKey() {
138         return _fileShortcutId;
139     }
140 
141     public void setPrimaryKey(long pk) {
142         setFileShortcutId(pk);
143     }
144 
145     public Serializable getPrimaryKeyObj() {
146         return new Long(_fileShortcutId);
147     }
148 
149     public String getUuid() {
150         return GetterUtil.getString(_uuid);
151     }
152 
153     public void setUuid(String uuid) {
154         if ((uuid != null) && (uuid != _uuid)) {
155             _uuid = uuid;
156         }
157     }
158 
159     public long getFileShortcutId() {
160         return _fileShortcutId;
161     }
162 
163     public void setFileShortcutId(long fileShortcutId) {
164         if (fileShortcutId != _fileShortcutId) {
165             _fileShortcutId = fileShortcutId;
166         }
167     }
168 
169     public long getCompanyId() {
170         return _companyId;
171     }
172 
173     public void setCompanyId(long companyId) {
174         if (companyId != _companyId) {
175             _companyId = companyId;
176         }
177     }
178 
179     public long getUserId() {
180         return _userId;
181     }
182 
183     public void setUserId(long userId) {
184         if (userId != _userId) {
185             _userId = userId;
186         }
187     }
188 
189     public String getUserName() {
190         return GetterUtil.getString(_userName);
191     }
192 
193     public void setUserName(String userName) {
194         if (((userName == null) && (_userName != null)) ||
195                 ((userName != null) && (_userName == null)) ||
196                 ((userName != null) && (_userName != null) &&
197                 !userName.equals(_userName))) {
198             _userName = userName;
199         }
200     }
201 
202     public Date getCreateDate() {
203         return _createDate;
204     }
205 
206     public void setCreateDate(Date createDate) {
207         if (((createDate == null) && (_createDate != null)) ||
208                 ((createDate != null) && (_createDate == null)) ||
209                 ((createDate != null) && (_createDate != null) &&
210                 !createDate.equals(_createDate))) {
211             _createDate = createDate;
212         }
213     }
214 
215     public Date getModifiedDate() {
216         return _modifiedDate;
217     }
218 
219     public void setModifiedDate(Date modifiedDate) {
220         if (((modifiedDate == null) && (_modifiedDate != null)) ||
221                 ((modifiedDate != null) && (_modifiedDate == null)) ||
222                 ((modifiedDate != null) && (_modifiedDate != null) &&
223                 !modifiedDate.equals(_modifiedDate))) {
224             _modifiedDate = modifiedDate;
225         }
226     }
227 
228     public long getFolderId() {
229         return _folderId;
230     }
231 
232     public void setFolderId(long folderId) {
233         if (folderId != _folderId) {
234             _folderId = folderId;
235         }
236     }
237 
238     public long getToFolderId() {
239         return _toFolderId;
240     }
241 
242     public void setToFolderId(long toFolderId) {
243         if (toFolderId != _toFolderId) {
244             _toFolderId = toFolderId;
245         }
246     }
247 
248     public String getToName() {
249         return GetterUtil.getString(_toName);
250     }
251 
252     public void setToName(String toName) {
253         if (((toName == null) && (_toName != null)) ||
254                 ((toName != null) && (_toName == null)) ||
255                 ((toName != null) && (_toName != null) &&
256                 !toName.equals(_toName))) {
257             _toName = toName;
258         }
259     }
260 
261     public DLFileShortcut toEscapedModel() {
262         if (isEscapedModel()) {
263             return (DLFileShortcut)this;
264         }
265         else {
266             DLFileShortcut model = new DLFileShortcutImpl();
267 
268             model.setEscapedModel(true);
269 
270             model.setUuid(HtmlUtil.escape(getUuid()));
271             model.setFileShortcutId(getFileShortcutId());
272             model.setCompanyId(getCompanyId());
273             model.setUserId(getUserId());
274             model.setUserName(HtmlUtil.escape(getUserName()));
275             model.setCreateDate(getCreateDate());
276             model.setModifiedDate(getModifiedDate());
277             model.setFolderId(getFolderId());
278             model.setToFolderId(getToFolderId());
279             model.setToName(HtmlUtil.escape(getToName()));
280 
281             model = (DLFileShortcut)Proxy.newProxyInstance(DLFileShortcut.class.getClassLoader(),
282                     new Class[] { DLFileShortcut.class },
283                     new ReadOnlyBeanHandler(model));
284 
285             return model;
286         }
287     }
288 
289     public Object clone() {
290         DLFileShortcutImpl clone = new DLFileShortcutImpl();
291 
292         clone.setUuid(getUuid());
293         clone.setFileShortcutId(getFileShortcutId());
294         clone.setCompanyId(getCompanyId());
295         clone.setUserId(getUserId());
296         clone.setUserName(getUserName());
297         clone.setCreateDate(getCreateDate());
298         clone.setModifiedDate(getModifiedDate());
299         clone.setFolderId(getFolderId());
300         clone.setToFolderId(getToFolderId());
301         clone.setToName(getToName());
302 
303         return clone;
304     }
305 
306     public int compareTo(Object obj) {
307         if (obj == null) {
308             return -1;
309         }
310 
311         DLFileShortcutImpl dlFileShortcut = (DLFileShortcutImpl)obj;
312 
313         long pk = dlFileShortcut.getPrimaryKey();
314 
315         if (getPrimaryKey() < pk) {
316             return -1;
317         }
318         else if (getPrimaryKey() > pk) {
319             return 1;
320         }
321         else {
322             return 0;
323         }
324     }
325 
326     public boolean equals(Object obj) {
327         if (obj == null) {
328             return false;
329         }
330 
331         DLFileShortcutImpl dlFileShortcut = null;
332 
333         try {
334             dlFileShortcut = (DLFileShortcutImpl)obj;
335         }
336         catch (ClassCastException cce) {
337             return false;
338         }
339 
340         long pk = dlFileShortcut.getPrimaryKey();
341 
342         if (getPrimaryKey() == pk) {
343             return true;
344         }
345         else {
346             return false;
347         }
348     }
349 
350     public int hashCode() {
351         return (int)getPrimaryKey();
352     }
353 
354     private String _uuid;
355     private long _fileShortcutId;
356     private long _companyId;
357     private long _userId;
358     private String _userName;
359     private Date _createDate;
360     private Date _modifiedDate;
361     private long _folderId;
362     private long _toFolderId;
363     private String _toName;
364 }