1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portlet.documentlibrary.model.impl;
21  
22  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23  import com.liferay.portal.kernel.util.GetterUtil;
24  import com.liferay.portal.kernel.util.HtmlUtil;
25  import com.liferay.portal.model.impl.BaseModelImpl;
26  
27  import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
28  import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
29  
30  import java.io.Serializable;
31  
32  import java.lang.reflect.Proxy;
33  
34  import java.sql.Types;
35  
36  import java.util.ArrayList;
37  import java.util.Date;
38  import java.util.List;
39  
40  /**
41   * <a href="DLFileShortcutModelImpl.java.html"><b><i>View Source</i></b></a>
42   *
43   * <p>
44   * ServiceBuilder generated this class. Modifications in this class will be
45   * overwritten the next time is generated.
46   * </p>
47   *
48   * <p>
49   * This class is a model that represents the <code>DLFileShortcut</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portlet.documentlibrary.model.DLFileShortcut
56   * @see com.liferay.portlet.documentlibrary.model.DLFileShortcutModel
57   * @see com.liferay.portlet.documentlibrary.model.impl.DLFileShortcutImpl
58   *
59   */
60  public class DLFileShortcutModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "DLFileShortcut";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "uuid_", new Integer(Types.VARCHAR) },
64              
65  
66              { "fileShortcutId", new Integer(Types.BIGINT) },
67              
68  
69              { "companyId", new Integer(Types.BIGINT) },
70              
71  
72              { "userId", new Integer(Types.BIGINT) },
73              
74  
75              { "userName", new Integer(Types.VARCHAR) },
76              
77  
78              { "createDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "modifiedDate", new Integer(Types.TIMESTAMP) },
82              
83  
84              { "folderId", new Integer(Types.BIGINT) },
85              
86  
87              { "toFolderId", new Integer(Types.BIGINT) },
88              
89  
90              { "toName", new Integer(Types.VARCHAR) }
91          };
92      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)";
93      public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
94      public static final String DATA_SOURCE = "liferayDataSource";
95      public static final String SESSION_FACTORY = "liferaySessionFactory";
96      public static final String TX_MANAGER = "liferayTransactionManager";
97      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
98                  "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
99              true);
100 
101     public static DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
102         DLFileShortcut model = new DLFileShortcutImpl();
103 
104         model.setUuid(soapModel.getUuid());
105         model.setFileShortcutId(soapModel.getFileShortcutId());
106         model.setCompanyId(soapModel.getCompanyId());
107         model.setUserId(soapModel.getUserId());
108         model.setUserName(soapModel.getUserName());
109         model.setCreateDate(soapModel.getCreateDate());
110         model.setModifiedDate(soapModel.getModifiedDate());
111         model.setFolderId(soapModel.getFolderId());
112         model.setToFolderId(soapModel.getToFolderId());
113         model.setToName(soapModel.getToName());
114 
115         return model;
116     }
117 
118     public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
119         List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
120 
121         for (DLFileShortcutSoap soapModel : soapModels) {
122             models.add(toModel(soapModel));
123         }
124 
125         return models;
126     }
127 
128     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
129                 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
130 
131     public DLFileShortcutModelImpl() {
132     }
133 
134     public long getPrimaryKey() {
135         return _fileShortcutId;
136     }
137 
138     public void setPrimaryKey(long pk) {
139         setFileShortcutId(pk);
140     }
141 
142     public Serializable getPrimaryKeyObj() {
143         return new Long(_fileShortcutId);
144     }
145 
146     public String getUuid() {
147         return GetterUtil.getString(_uuid);
148     }
149 
150     public void setUuid(String uuid) {
151         if ((uuid != null) && (uuid != _uuid)) {
152             _uuid = uuid;
153         }
154     }
155 
156     public long getFileShortcutId() {
157         return _fileShortcutId;
158     }
159 
160     public void setFileShortcutId(long fileShortcutId) {
161         if (fileShortcutId != _fileShortcutId) {
162             _fileShortcutId = fileShortcutId;
163         }
164     }
165 
166     public long getCompanyId() {
167         return _companyId;
168     }
169 
170     public void setCompanyId(long companyId) {
171         if (companyId != _companyId) {
172             _companyId = companyId;
173         }
174     }
175 
176     public long getUserId() {
177         return _userId;
178     }
179 
180     public void setUserId(long userId) {
181         if (userId != _userId) {
182             _userId = userId;
183         }
184     }
185 
186     public String getUserName() {
187         return GetterUtil.getString(_userName);
188     }
189 
190     public void setUserName(String userName) {
191         if (((userName == null) && (_userName != null)) ||
192                 ((userName != null) && (_userName == null)) ||
193                 ((userName != null) && (_userName != null) &&
194                 !userName.equals(_userName))) {
195             _userName = userName;
196         }
197     }
198 
199     public Date getCreateDate() {
200         return _createDate;
201     }
202 
203     public void setCreateDate(Date createDate) {
204         if (((createDate == null) && (_createDate != null)) ||
205                 ((createDate != null) && (_createDate == null)) ||
206                 ((createDate != null) && (_createDate != null) &&
207                 !createDate.equals(_createDate))) {
208             _createDate = createDate;
209         }
210     }
211 
212     public Date getModifiedDate() {
213         return _modifiedDate;
214     }
215 
216     public void setModifiedDate(Date modifiedDate) {
217         if (((modifiedDate == null) && (_modifiedDate != null)) ||
218                 ((modifiedDate != null) && (_modifiedDate == null)) ||
219                 ((modifiedDate != null) && (_modifiedDate != null) &&
220                 !modifiedDate.equals(_modifiedDate))) {
221             _modifiedDate = modifiedDate;
222         }
223     }
224 
225     public long getFolderId() {
226         return _folderId;
227     }
228 
229     public void setFolderId(long folderId) {
230         if (folderId != _folderId) {
231             _folderId = folderId;
232         }
233     }
234 
235     public long getToFolderId() {
236         return _toFolderId;
237     }
238 
239     public void setToFolderId(long toFolderId) {
240         if (toFolderId != _toFolderId) {
241             _toFolderId = toFolderId;
242         }
243     }
244 
245     public String getToName() {
246         return GetterUtil.getString(_toName);
247     }
248 
249     public void setToName(String toName) {
250         if (((toName == null) && (_toName != null)) ||
251                 ((toName != null) && (_toName == null)) ||
252                 ((toName != null) && (_toName != null) &&
253                 !toName.equals(_toName))) {
254             _toName = toName;
255         }
256     }
257 
258     public DLFileShortcut toEscapedModel() {
259         if (isEscapedModel()) {
260             return (DLFileShortcut)this;
261         }
262         else {
263             DLFileShortcut model = new DLFileShortcutImpl();
264 
265             model.setNew(isNew());
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 }