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.DateUtil;
26  import com.liferay.portal.kernel.util.GetterUtil;
27  import com.liferay.portal.model.impl.BaseModelImpl;
28  import com.liferay.portal.util.PropsUtil;
29  
30  import com.liferay.util.XSSUtil;
31  
32  import java.io.Serializable;
33  
34  import java.sql.Types;
35  
36  import java.util.Date;
37  
38  /**
39   * <a href="DLFileRankModelImpl.java.html"><b><i>View Source</i></b></a>
40   *
41   * <p>
42   * ServiceBuilder generated this class. Modifications in this class will be overwritten
43   * the next time is generated.
44   * </p>
45   *
46   * <p>
47   * This class is a model that represents the <code>DLFileRank</code> table in the
48   * database.
49   * </p>
50   *
51   * @author Brian Wing Shun Chan
52   *
53   * @see com.liferay.portlet.documentlibrary.service.model.DLFileRank
54   * @see com.liferay.portlet.documentlibrary.service.model.DLFileRankModel
55   * @see com.liferay.portlet.documentlibrary.service.model.impl.DLFileRankImpl
56   *
57   */
58  public class DLFileRankModelImpl extends BaseModelImpl {
59      public static String TABLE_NAME = "DLFileRank";
60      public static Object[][] TABLE_COLUMNS = {
61              { "fileRankId", new Integer(Types.BIGINT) },
62              { "companyId", new Integer(Types.BIGINT) },
63              { "userId", new Integer(Types.BIGINT) },
64              { "createDate", new Integer(Types.TIMESTAMP) },
65              { "folderId", new Integer(Types.BIGINT) },
66              { "name", new Integer(Types.VARCHAR) }
67          };
68      public static String TABLE_SQL_CREATE = "create table DLFileRank (fileRankId LONG not null primary key,companyId LONG,userId LONG,createDate DATE null,folderId LONG,name VARCHAR(300) null)";
69      public static String TABLE_SQL_DROP = "drop table DLFileRank";
70      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
71                  "xss.allow.com.liferay.portlet.documentlibrary.model.DLFileRank"),
72              XSS_ALLOW);
73      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
74                  "xss.allow.com.liferay.portlet.documentlibrary.model.DLFileRank.name"),
75              XSS_ALLOW_BY_MODEL);
76      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
77                  "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileRankModel"));
78  
79      public DLFileRankModelImpl() {
80      }
81  
82      public long getPrimaryKey() {
83          return _fileRankId;
84      }
85  
86      public void setPrimaryKey(long pk) {
87          setFileRankId(pk);
88      }
89  
90      public Serializable getPrimaryKeyObj() {
91          return new Long(_fileRankId);
92      }
93  
94      public long getFileRankId() {
95          return _fileRankId;
96      }
97  
98      public void setFileRankId(long fileRankId) {
99          if (fileRankId != _fileRankId) {
100             _fileRankId = fileRankId;
101         }
102     }
103 
104     public long getCompanyId() {
105         return _companyId;
106     }
107 
108     public void setCompanyId(long companyId) {
109         if (companyId != _companyId) {
110             _companyId = companyId;
111         }
112     }
113 
114     public long getUserId() {
115         return _userId;
116     }
117 
118     public void setUserId(long userId) {
119         if (userId != _userId) {
120             _userId = userId;
121         }
122     }
123 
124     public Date getCreateDate() {
125         return _createDate;
126     }
127 
128     public void setCreateDate(Date createDate) {
129         if (((createDate == null) && (_createDate != null)) ||
130                 ((createDate != null) && (_createDate == null)) ||
131                 ((createDate != null) && (_createDate != null) &&
132                 !createDate.equals(_createDate))) {
133             _createDate = createDate;
134         }
135     }
136 
137     public long getFolderId() {
138         return _folderId;
139     }
140 
141     public void setFolderId(long folderId) {
142         if (folderId != _folderId) {
143             _folderId = folderId;
144         }
145     }
146 
147     public String getName() {
148         return GetterUtil.getString(_name);
149     }
150 
151     public void setName(String name) {
152         if (((name == null) && (_name != null)) ||
153                 ((name != null) && (_name == null)) ||
154                 ((name != null) && (_name != null) && !name.equals(_name))) {
155             if (!XSS_ALLOW_NAME) {
156                 name = XSSUtil.strip(name);
157             }
158 
159             _name = name;
160         }
161     }
162 
163     public Object clone() {
164         DLFileRankImpl clone = new DLFileRankImpl();
165         clone.setFileRankId(getFileRankId());
166         clone.setCompanyId(getCompanyId());
167         clone.setUserId(getUserId());
168         clone.setCreateDate(getCreateDate());
169         clone.setFolderId(getFolderId());
170         clone.setName(getName());
171 
172         return clone;
173     }
174 
175     public int compareTo(Object obj) {
176         if (obj == null) {
177             return -1;
178         }
179 
180         DLFileRankImpl dlFileRank = (DLFileRankImpl)obj;
181         int value = 0;
182         value = DateUtil.compareTo(getCreateDate(), dlFileRank.getCreateDate());
183         value = value * -1;
184 
185         if (value != 0) {
186             return value;
187         }
188 
189         return 0;
190     }
191 
192     public boolean equals(Object obj) {
193         if (obj == null) {
194             return false;
195         }
196 
197         DLFileRankImpl dlFileRank = null;
198 
199         try {
200             dlFileRank = (DLFileRankImpl)obj;
201         }
202         catch (ClassCastException cce) {
203             return false;
204         }
205 
206         long pk = dlFileRank.getPrimaryKey();
207 
208         if (getPrimaryKey() == pk) {
209             return true;
210         }
211         else {
212             return false;
213         }
214     }
215 
216     public int hashCode() {
217         return (int)getPrimaryKey();
218     }
219 
220     private long _fileRankId;
221     private long _companyId;
222     private long _userId;
223     private Date _createDate;
224     private long _folderId;
225     private String _name;
226 }