1   /**
2    * Copyright (c) 2000-2007 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.util.GetterUtil;
26  import com.liferay.portal.model.impl.BaseModelImpl;
27  import com.liferay.portal.util.PropsUtil;
28  
29  import com.liferay.util.XSSUtil;
30  
31  import java.io.Serializable;
32  
33  import java.sql.Types;
34  
35  import java.util.Date;
36  
37  /**
38   * <a href="DLFileShortcutModelImpl.java.html"><b><i>View Source</i></b></a>
39   *
40   * <p>
41   * ServiceBuilder generated this class. Modifications in this class will be overwritten
42   * the next time is generated.
43   * </p>
44   *
45   * <p>
46   * This class is a model that represents the <code>DLFileShortcut</code> table in
47   * the database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portlet.documentlibrary.service.model.DLFileShortcut
53   * @see com.liferay.portlet.documentlibrary.service.model.DLFileShortcutModel
54   * @see com.liferay.portlet.documentlibrary.service.model.impl.DLFileShortcutImpl
55   *
56   */
57  public class DLFileShortcutModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "DLFileShortcut";
59      public static Object[][] TABLE_COLUMNS = {
60              { "fileShortcutId", new Integer(Types.BIGINT) },
61              { "companyId", new Integer(Types.BIGINT) },
62              { "userId", new Integer(Types.BIGINT) },
63              { "userName", new Integer(Types.VARCHAR) },
64              { "createDate", new Integer(Types.TIMESTAMP) },
65              { "modifiedDate", new Integer(Types.TIMESTAMP) },
66              { "folderId", new Integer(Types.BIGINT) },
67              { "toFolderId", new Integer(Types.BIGINT) },
68              { "toName", new Integer(Types.VARCHAR) }
69          };
70      public static String TABLE_SQL_CREATE = "create table DLFileShortcut (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)";
71      public static String TABLE_SQL_DROP = "drop table DLFileShortcut";
72      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
73                  "xss.allow.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
74              XSS_ALLOW);
75      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
76                  "xss.allow.com.liferay.portlet.documentlibrary.model.DLFileShortcut.userName"),
77              XSS_ALLOW_BY_MODEL);
78      public static boolean XSS_ALLOW_TONAME = GetterUtil.getBoolean(PropsUtil.get(
79                  "xss.allow.com.liferay.portlet.documentlibrary.model.DLFileShortcut.toName"),
80              XSS_ALLOW_BY_MODEL);
81      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
82                  "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcutModel"));
83  
84      public DLFileShortcutModelImpl() {
85      }
86  
87      public long getPrimaryKey() {
88          return _fileShortcutId;
89      }
90  
91      public void setPrimaryKey(long pk) {
92          setFileShortcutId(pk);
93      }
94  
95      public Serializable getPrimaryKeyObj() {
96          return new Long(_fileShortcutId);
97      }
98  
99      public long getFileShortcutId() {
100         return _fileShortcutId;
101     }
102 
103     public void setFileShortcutId(long fileShortcutId) {
104         if (fileShortcutId != _fileShortcutId) {
105             _fileShortcutId = fileShortcutId;
106         }
107     }
108 
109     public long getCompanyId() {
110         return _companyId;
111     }
112 
113     public void setCompanyId(long companyId) {
114         if (companyId != _companyId) {
115             _companyId = companyId;
116         }
117     }
118 
119     public long getUserId() {
120         return _userId;
121     }
122 
123     public void setUserId(long userId) {
124         if (userId != _userId) {
125             _userId = userId;
126         }
127     }
128 
129     public String getUserName() {
130         return GetterUtil.getString(_userName);
131     }
132 
133     public void setUserName(String userName) {
134         if (((userName == null) && (_userName != null)) ||
135                 ((userName != null) && (_userName == null)) ||
136                 ((userName != null) && (_userName != null) &&
137                 !userName.equals(_userName))) {
138             if (!XSS_ALLOW_USERNAME) {
139                 userName = XSSUtil.strip(userName);
140             }
141 
142             _userName = userName;
143         }
144     }
145 
146     public Date getCreateDate() {
147         return _createDate;
148     }
149 
150     public void setCreateDate(Date createDate) {
151         if (((createDate == null) && (_createDate != null)) ||
152                 ((createDate != null) && (_createDate == null)) ||
153                 ((createDate != null) && (_createDate != null) &&
154                 !createDate.equals(_createDate))) {
155             _createDate = createDate;
156         }
157     }
158 
159     public Date getModifiedDate() {
160         return _modifiedDate;
161     }
162 
163     public void setModifiedDate(Date modifiedDate) {
164         if (((modifiedDate == null) && (_modifiedDate != null)) ||
165                 ((modifiedDate != null) && (_modifiedDate == null)) ||
166                 ((modifiedDate != null) && (_modifiedDate != null) &&
167                 !modifiedDate.equals(_modifiedDate))) {
168             _modifiedDate = modifiedDate;
169         }
170     }
171 
172     public long getFolderId() {
173         return _folderId;
174     }
175 
176     public void setFolderId(long folderId) {
177         if (folderId != _folderId) {
178             _folderId = folderId;
179         }
180     }
181 
182     public long getToFolderId() {
183         return _toFolderId;
184     }
185 
186     public void setToFolderId(long toFolderId) {
187         if (toFolderId != _toFolderId) {
188             _toFolderId = toFolderId;
189         }
190     }
191 
192     public String getToName() {
193         return GetterUtil.getString(_toName);
194     }
195 
196     public void setToName(String toName) {
197         if (((toName == null) && (_toName != null)) ||
198                 ((toName != null) && (_toName == null)) ||
199                 ((toName != null) && (_toName != null) &&
200                 !toName.equals(_toName))) {
201             if (!XSS_ALLOW_TONAME) {
202                 toName = XSSUtil.strip(toName);
203             }
204 
205             _toName = toName;
206         }
207     }
208 
209     public Object clone() {
210         DLFileShortcutImpl clone = new DLFileShortcutImpl();
211         clone.setFileShortcutId(getFileShortcutId());
212         clone.setCompanyId(getCompanyId());
213         clone.setUserId(getUserId());
214         clone.setUserName(getUserName());
215         clone.setCreateDate(getCreateDate());
216         clone.setModifiedDate(getModifiedDate());
217         clone.setFolderId(getFolderId());
218         clone.setToFolderId(getToFolderId());
219         clone.setToName(getToName());
220 
221         return clone;
222     }
223 
224     public int compareTo(Object obj) {
225         if (obj == null) {
226             return -1;
227         }
228 
229         DLFileShortcutImpl dlFileShortcut = (DLFileShortcutImpl)obj;
230         long pk = dlFileShortcut.getPrimaryKey();
231 
232         if (getPrimaryKey() < pk) {
233             return -1;
234         }
235         else if (getPrimaryKey() > pk) {
236             return 1;
237         }
238         else {
239             return 0;
240         }
241     }
242 
243     public boolean equals(Object obj) {
244         if (obj == null) {
245             return false;
246         }
247 
248         DLFileShortcutImpl dlFileShortcut = null;
249 
250         try {
251             dlFileShortcut = (DLFileShortcutImpl)obj;
252         }
253         catch (ClassCastException cce) {
254             return false;
255         }
256 
257         long pk = dlFileShortcut.getPrimaryKey();
258 
259         if (getPrimaryKey() == pk) {
260             return true;
261         }
262         else {
263             return false;
264         }
265     }
266 
267     public int hashCode() {
268         return (int)getPrimaryKey();
269     }
270 
271     private long _fileShortcutId;
272     private long _companyId;
273     private long _userId;
274     private String _userName;
275     private Date _createDate;
276     private Date _modifiedDate;
277     private long _folderId;
278     private long _toFolderId;
279     private String _toName;
280 }