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.tags.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.tags.model.TagsProperty;
28  import com.liferay.portlet.tags.model.TagsPropertySoap;
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="TagsPropertyModelImpl.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>TagsProperty</code> table
50   * in the database.
51   * </p>
52   *
53   * @author Brian Wing Shun Chan
54   *
55   * @see com.liferay.portlet.tags.model.TagsProperty
56   * @see com.liferay.portlet.tags.model.TagsPropertyModel
57   * @see com.liferay.portlet.tags.model.impl.TagsPropertyImpl
58   *
59   */
60  public class TagsPropertyModelImpl extends BaseModelImpl {
61      public static final String TABLE_NAME = "TagsProperty";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "propertyId", new Integer(Types.BIGINT) },
64              
65  
66              { "companyId", new Integer(Types.BIGINT) },
67              
68  
69              { "userId", new Integer(Types.BIGINT) },
70              
71  
72              { "userName", new Integer(Types.VARCHAR) },
73              
74  
75              { "createDate", new Integer(Types.TIMESTAMP) },
76              
77  
78              { "modifiedDate", new Integer(Types.TIMESTAMP) },
79              
80  
81              { "entryId", new Integer(Types.BIGINT) },
82              
83  
84              { "key_", new Integer(Types.VARCHAR) },
85              
86  
87              { "value", new Integer(Types.VARCHAR) }
88          };
89      public static final String TABLE_SQL_CREATE = "create table TagsProperty (propertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,entryId LONG,key_ VARCHAR(75) null,value VARCHAR(300) null)";
90      public static final String TABLE_SQL_DROP = "drop table TagsProperty";
91      public static final String DATA_SOURCE = "liferayDataSource";
92      public static final String SESSION_FACTORY = "liferaySessionFactory";
93      public static final String TX_MANAGER = "liferayTransactionManager";
94      public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
95                  "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsProperty"),
96              true);
97  
98      public static TagsProperty toModel(TagsPropertySoap soapModel) {
99          TagsProperty model = new TagsPropertyImpl();
100 
101         model.setPropertyId(soapModel.getPropertyId());
102         model.setCompanyId(soapModel.getCompanyId());
103         model.setUserId(soapModel.getUserId());
104         model.setUserName(soapModel.getUserName());
105         model.setCreateDate(soapModel.getCreateDate());
106         model.setModifiedDate(soapModel.getModifiedDate());
107         model.setEntryId(soapModel.getEntryId());
108         model.setKey(soapModel.getKey());
109         model.setValue(soapModel.getValue());
110 
111         return model;
112     }
113 
114     public static List<TagsProperty> toModels(TagsPropertySoap[] soapModels) {
115         List<TagsProperty> models = new ArrayList<TagsProperty>(soapModels.length);
116 
117         for (TagsPropertySoap soapModel : soapModels) {
118             models.add(toModel(soapModel));
119         }
120 
121         return models;
122     }
123 
124     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
125                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsProperty"));
126 
127     public TagsPropertyModelImpl() {
128     }
129 
130     public long getPrimaryKey() {
131         return _propertyId;
132     }
133 
134     public void setPrimaryKey(long pk) {
135         setPropertyId(pk);
136     }
137 
138     public Serializable getPrimaryKeyObj() {
139         return new Long(_propertyId);
140     }
141 
142     public long getPropertyId() {
143         return _propertyId;
144     }
145 
146     public void setPropertyId(long propertyId) {
147         if (propertyId != _propertyId) {
148             _propertyId = propertyId;
149         }
150     }
151 
152     public long getCompanyId() {
153         return _companyId;
154     }
155 
156     public void setCompanyId(long companyId) {
157         if (companyId != _companyId) {
158             _companyId = companyId;
159         }
160     }
161 
162     public long getUserId() {
163         return _userId;
164     }
165 
166     public void setUserId(long userId) {
167         if (userId != _userId) {
168             _userId = userId;
169         }
170     }
171 
172     public String getUserName() {
173         return GetterUtil.getString(_userName);
174     }
175 
176     public void setUserName(String userName) {
177         if (((userName == null) && (_userName != null)) ||
178                 ((userName != null) && (_userName == null)) ||
179                 ((userName != null) && (_userName != null) &&
180                 !userName.equals(_userName))) {
181             _userName = userName;
182         }
183     }
184 
185     public Date getCreateDate() {
186         return _createDate;
187     }
188 
189     public void setCreateDate(Date createDate) {
190         if (((createDate == null) && (_createDate != null)) ||
191                 ((createDate != null) && (_createDate == null)) ||
192                 ((createDate != null) && (_createDate != null) &&
193                 !createDate.equals(_createDate))) {
194             _createDate = createDate;
195         }
196     }
197 
198     public Date getModifiedDate() {
199         return _modifiedDate;
200     }
201 
202     public void setModifiedDate(Date modifiedDate) {
203         if (((modifiedDate == null) && (_modifiedDate != null)) ||
204                 ((modifiedDate != null) && (_modifiedDate == null)) ||
205                 ((modifiedDate != null) && (_modifiedDate != null) &&
206                 !modifiedDate.equals(_modifiedDate))) {
207             _modifiedDate = modifiedDate;
208         }
209     }
210 
211     public long getEntryId() {
212         return _entryId;
213     }
214 
215     public void setEntryId(long entryId) {
216         if (entryId != _entryId) {
217             _entryId = entryId;
218         }
219     }
220 
221     public String getKey() {
222         return GetterUtil.getString(_key);
223     }
224 
225     public void setKey(String key) {
226         if (((key == null) && (_key != null)) ||
227                 ((key != null) && (_key == null)) ||
228                 ((key != null) && (_key != null) && !key.equals(_key))) {
229             _key = key;
230         }
231     }
232 
233     public String getValue() {
234         return GetterUtil.getString(_value);
235     }
236 
237     public void setValue(String value) {
238         if (((value == null) && (_value != null)) ||
239                 ((value != null) && (_value == null)) ||
240                 ((value != null) && (_value != null) && !value.equals(_value))) {
241             _value = value;
242         }
243     }
244 
245     public TagsProperty toEscapedModel() {
246         if (isEscapedModel()) {
247             return (TagsProperty)this;
248         }
249         else {
250             TagsProperty model = new TagsPropertyImpl();
251 
252             model.setNew(isNew());
253             model.setEscapedModel(true);
254 
255             model.setPropertyId(getPropertyId());
256             model.setCompanyId(getCompanyId());
257             model.setUserId(getUserId());
258             model.setUserName(HtmlUtil.escape(getUserName()));
259             model.setCreateDate(getCreateDate());
260             model.setModifiedDate(getModifiedDate());
261             model.setEntryId(getEntryId());
262             model.setKey(HtmlUtil.escape(getKey()));
263             model.setValue(HtmlUtil.escape(getValue()));
264 
265             model = (TagsProperty)Proxy.newProxyInstance(TagsProperty.class.getClassLoader(),
266                     new Class[] { TagsProperty.class },
267                     new ReadOnlyBeanHandler(model));
268 
269             return model;
270         }
271     }
272 
273     public Object clone() {
274         TagsPropertyImpl clone = new TagsPropertyImpl();
275 
276         clone.setPropertyId(getPropertyId());
277         clone.setCompanyId(getCompanyId());
278         clone.setUserId(getUserId());
279         clone.setUserName(getUserName());
280         clone.setCreateDate(getCreateDate());
281         clone.setModifiedDate(getModifiedDate());
282         clone.setEntryId(getEntryId());
283         clone.setKey(getKey());
284         clone.setValue(getValue());
285 
286         return clone;
287     }
288 
289     public int compareTo(Object obj) {
290         if (obj == null) {
291             return -1;
292         }
293 
294         TagsPropertyImpl tagsProperty = (TagsPropertyImpl)obj;
295 
296         int value = 0;
297 
298         value = getKey().compareTo(tagsProperty.getKey());
299 
300         if (value != 0) {
301             return value;
302         }
303 
304         return 0;
305     }
306 
307     public boolean equals(Object obj) {
308         if (obj == null) {
309             return false;
310         }
311 
312         TagsPropertyImpl tagsProperty = null;
313 
314         try {
315             tagsProperty = (TagsPropertyImpl)obj;
316         }
317         catch (ClassCastException cce) {
318             return false;
319         }
320 
321         long pk = tagsProperty.getPrimaryKey();
322 
323         if (getPrimaryKey() == pk) {
324             return true;
325         }
326         else {
327             return false;
328         }
329     }
330 
331     public int hashCode() {
332         return (int)getPrimaryKey();
333     }
334 
335     private long _propertyId;
336     private long _companyId;
337     private long _userId;
338     private String _userName;
339     private Date _createDate;
340     private Date _modifiedDate;
341     private long _entryId;
342     private String _key;
343     private String _value;
344 }