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