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.tags.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="TagsEntryModelImpl.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>TagsEntry</code> table in the
47   * database.
48   * </p>
49   *
50   * @author Brian Wing Shun Chan
51   *
52   * @see com.liferay.portlet.tags.service.model.TagsEntry
53   * @see com.liferay.portlet.tags.service.model.TagsEntryModel
54   * @see com.liferay.portlet.tags.service.model.impl.TagsEntryImpl
55   *
56   */
57  public class TagsEntryModelImpl extends BaseModelImpl {
58      public static String TABLE_NAME = "TagsEntry";
59      public static Object[][] TABLE_COLUMNS = {
60              { "entryId", 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              { "name", new Integer(Types.VARCHAR) }
67          };
68      public static String TABLE_SQL_CREATE = "create table TagsEntry (entryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null)";
69      public static String TABLE_SQL_DROP = "drop table TagsEntry";
70      public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
71                  "xss.allow.com.liferay.portlet.tags.model.TagsEntry"), XSS_ALLOW);
72      public static boolean XSS_ALLOW_USERNAME = GetterUtil.getBoolean(PropsUtil.get(
73                  "xss.allow.com.liferay.portlet.tags.model.TagsEntry.userName"),
74              XSS_ALLOW_BY_MODEL);
75      public static boolean XSS_ALLOW_NAME = GetterUtil.getBoolean(PropsUtil.get(
76                  "xss.allow.com.liferay.portlet.tags.model.TagsEntry.name"),
77              XSS_ALLOW_BY_MODEL);
78      public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
79                  "lock.expiration.time.com.liferay.portlet.tags.model.TagsEntryModel"));
80  
81      public TagsEntryModelImpl() {
82      }
83  
84      public long getPrimaryKey() {
85          return _entryId;
86      }
87  
88      public void setPrimaryKey(long pk) {
89          setEntryId(pk);
90      }
91  
92      public Serializable getPrimaryKeyObj() {
93          return new Long(_entryId);
94      }
95  
96      public long getEntryId() {
97          return _entryId;
98      }
99  
100     public void setEntryId(long entryId) {
101         if (entryId != _entryId) {
102             _entryId = entryId;
103         }
104     }
105 
106     public long getCompanyId() {
107         return _companyId;
108     }
109 
110     public void setCompanyId(long companyId) {
111         if (companyId != _companyId) {
112             _companyId = companyId;
113         }
114     }
115 
116     public long getUserId() {
117         return _userId;
118     }
119 
120     public void setUserId(long userId) {
121         if (userId != _userId) {
122             _userId = userId;
123         }
124     }
125 
126     public String getUserName() {
127         return GetterUtil.getString(_userName);
128     }
129 
130     public void setUserName(String userName) {
131         if (((userName == null) && (_userName != null)) ||
132                 ((userName != null) && (_userName == null)) ||
133                 ((userName != null) && (_userName != null) &&
134                 !userName.equals(_userName))) {
135             if (!XSS_ALLOW_USERNAME) {
136                 userName = XSSUtil.strip(userName);
137             }
138 
139             _userName = userName;
140         }
141     }
142 
143     public Date getCreateDate() {
144         return _createDate;
145     }
146 
147     public void setCreateDate(Date createDate) {
148         if (((createDate == null) && (_createDate != null)) ||
149                 ((createDate != null) && (_createDate == null)) ||
150                 ((createDate != null) && (_createDate != null) &&
151                 !createDate.equals(_createDate))) {
152             _createDate = createDate;
153         }
154     }
155 
156     public Date getModifiedDate() {
157         return _modifiedDate;
158     }
159 
160     public void setModifiedDate(Date modifiedDate) {
161         if (((modifiedDate == null) && (_modifiedDate != null)) ||
162                 ((modifiedDate != null) && (_modifiedDate == null)) ||
163                 ((modifiedDate != null) && (_modifiedDate != null) &&
164                 !modifiedDate.equals(_modifiedDate))) {
165             _modifiedDate = modifiedDate;
166         }
167     }
168 
169     public String getName() {
170         return GetterUtil.getString(_name);
171     }
172 
173     public void setName(String name) {
174         if (((name == null) && (_name != null)) ||
175                 ((name != null) && (_name == null)) ||
176                 ((name != null) && (_name != null) && !name.equals(_name))) {
177             if (!XSS_ALLOW_NAME) {
178                 name = XSSUtil.strip(name);
179             }
180 
181             _name = name;
182         }
183     }
184 
185     public Object clone() {
186         TagsEntryImpl clone = new TagsEntryImpl();
187         clone.setEntryId(getEntryId());
188         clone.setCompanyId(getCompanyId());
189         clone.setUserId(getUserId());
190         clone.setUserName(getUserName());
191         clone.setCreateDate(getCreateDate());
192         clone.setModifiedDate(getModifiedDate());
193         clone.setName(getName());
194 
195         return clone;
196     }
197 
198     public int compareTo(Object obj) {
199         if (obj == null) {
200             return -1;
201         }
202 
203         TagsEntryImpl tagsEntry = (TagsEntryImpl)obj;
204         int value = 0;
205         value = getName().compareTo(tagsEntry.getName());
206 
207         if (value != 0) {
208             return value;
209         }
210 
211         return 0;
212     }
213 
214     public boolean equals(Object obj) {
215         if (obj == null) {
216             return false;
217         }
218 
219         TagsEntryImpl tagsEntry = null;
220 
221         try {
222             tagsEntry = (TagsEntryImpl)obj;
223         }
224         catch (ClassCastException cce) {
225             return false;
226         }
227 
228         long pk = tagsEntry.getPrimaryKey();
229 
230         if (getPrimaryKey() == pk) {
231             return true;
232         }
233         else {
234             return false;
235         }
236     }
237 
238     public int hashCode() {
239         return (int)getPrimaryKey();
240     }
241 
242     private long _entryId;
243     private long _companyId;
244     private long _userId;
245     private String _userName;
246     private Date _createDate;
247     private Date _modifiedDate;
248     private String _name;
249 }