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