1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.SystemException;
26  import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
27  import com.liferay.portal.kernel.util.GetterUtil;
28  import com.liferay.portal.kernel.util.HtmlUtil;
29  import com.liferay.portal.model.impl.BaseModelImpl;
30  import com.liferay.portal.util.PortalUtil;
31  
32  import com.liferay.portlet.tags.model.TagsProperty;
33  import com.liferay.portlet.tags.model.TagsPropertySoap;
34  
35  import java.io.Serializable;
36  
37  import java.lang.reflect.Proxy;
38  
39  import java.sql.Types;
40  
41  import java.util.ArrayList;
42  import java.util.Date;
43  import java.util.List;
44  
45  /**
46   * <a href="TagsPropertyModelImpl.java.html"><b><i>View Source</i></b></a>
47   *
48   * <p>
49   * ServiceBuilder generated this class. Modifications in this class will be
50   * overwritten the next time is generated.
51   * </p>
52   *
53   * <p>
54   * This interface is a model that represents the TagsProperty table in the
55   * database.
56   * </p>
57   *
58   * @author    Brian Wing Shun Chan
59   * @see       TagsPropertyImpl
60   * @see       com.liferay.portlet.tags.model.TagsProperty
61   * @see       com.liferay.portlet.tags.model.TagsPropertyModel
62   * @generated
63   */
64  public class TagsPropertyModelImpl extends BaseModelImpl<TagsProperty> {
65      public static final String TABLE_NAME = "TagsProperty";
66      public static final Object[][] TABLE_COLUMNS = {
67              { "propertyId", new Integer(Types.BIGINT) },
68              { "companyId", new Integer(Types.BIGINT) },
69              { "userId", new Integer(Types.BIGINT) },
70              { "userName", new Integer(Types.VARCHAR) },
71              { "createDate", new Integer(Types.TIMESTAMP) },
72              { "modifiedDate", new Integer(Types.TIMESTAMP) },
73              { "entryId", new Integer(Types.BIGINT) },
74              { "key_", new Integer(Types.VARCHAR) },
75              { "value", new Integer(Types.VARCHAR) }
76          };
77      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(255) null)";
78      public static final String TABLE_SQL_DROP = "drop table TagsProperty";
79      public static final String DATA_SOURCE = "liferayDataSource";
80      public static final String SESSION_FACTORY = "liferaySessionFactory";
81      public static final String TX_MANAGER = "liferayTransactionManager";
82      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
83                  "value.object.entity.cache.enabled.com.liferay.portlet.tags.model.TagsProperty"),
84              true);
85      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
86                  "value.object.finder.cache.enabled.com.liferay.portlet.tags.model.TagsProperty"),
87              true);
88  
89      public static TagsProperty toModel(TagsPropertySoap soapModel) {
90          TagsProperty model = new TagsPropertyImpl();
91  
92          model.setPropertyId(soapModel.getPropertyId());
93          model.setCompanyId(soapModel.getCompanyId());
94          model.setUserId(soapModel.getUserId());
95          model.setUserName(soapModel.getUserName());
96          model.setCreateDate(soapModel.getCreateDate());
97          model.setModifiedDate(soapModel.getModifiedDate());
98          model.setEntryId(soapModel.getEntryId());
99          model.setKey(soapModel.getKey());
100         model.setValue(soapModel.getValue());
101 
102         return model;
103     }
104 
105     public static List<TagsProperty> toModels(TagsPropertySoap[] soapModels) {
106         List<TagsProperty> models = new ArrayList<TagsProperty>(soapModels.length);
107 
108         for (TagsPropertySoap soapModel : soapModels) {
109             models.add(toModel(soapModel));
110         }
111 
112         return models;
113     }
114 
115     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
116                 "lock.expiration.time.com.liferay.portlet.tags.model.TagsProperty"));
117 
118     public TagsPropertyModelImpl() {
119     }
120 
121     public long getPrimaryKey() {
122         return _propertyId;
123     }
124 
125     public void setPrimaryKey(long pk) {
126         setPropertyId(pk);
127     }
128 
129     public Serializable getPrimaryKeyObj() {
130         return new Long(_propertyId);
131     }
132 
133     public long getPropertyId() {
134         return _propertyId;
135     }
136 
137     public void setPropertyId(long propertyId) {
138         _propertyId = propertyId;
139     }
140 
141     public long getCompanyId() {
142         return _companyId;
143     }
144 
145     public void setCompanyId(long companyId) {
146         _companyId = companyId;
147     }
148 
149     public long getUserId() {
150         return _userId;
151     }
152 
153     public void setUserId(long userId) {
154         _userId = userId;
155     }
156 
157     public String getUserUuid() throws SystemException {
158         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
159     }
160 
161     public void setUserUuid(String userUuid) {
162         _userUuid = userUuid;
163     }
164 
165     public String getUserName() {
166         return GetterUtil.getString(_userName);
167     }
168 
169     public void setUserName(String userName) {
170         _userName = userName;
171     }
172 
173     public Date getCreateDate() {
174         return _createDate;
175     }
176 
177     public void setCreateDate(Date createDate) {
178         _createDate = createDate;
179     }
180 
181     public Date getModifiedDate() {
182         return _modifiedDate;
183     }
184 
185     public void setModifiedDate(Date modifiedDate) {
186         _modifiedDate = modifiedDate;
187     }
188 
189     public long getEntryId() {
190         return _entryId;
191     }
192 
193     public void setEntryId(long entryId) {
194         _entryId = entryId;
195 
196         if (!_setOriginalEntryId) {
197             _setOriginalEntryId = true;
198 
199             _originalEntryId = entryId;
200         }
201     }
202 
203     public long getOriginalEntryId() {
204         return _originalEntryId;
205     }
206 
207     public String getKey() {
208         return GetterUtil.getString(_key);
209     }
210 
211     public void setKey(String key) {
212         _key = key;
213 
214         if (_originalKey == null) {
215             _originalKey = key;
216         }
217     }
218 
219     public String getOriginalKey() {
220         return GetterUtil.getString(_originalKey);
221     }
222 
223     public String getValue() {
224         return GetterUtil.getString(_value);
225     }
226 
227     public void setValue(String value) {
228         _value = value;
229     }
230 
231     public TagsProperty toEscapedModel() {
232         if (isEscapedModel()) {
233             return (TagsProperty)this;
234         }
235         else {
236             TagsProperty model = new TagsPropertyImpl();
237 
238             model.setNew(isNew());
239             model.setEscapedModel(true);
240 
241             model.setPropertyId(getPropertyId());
242             model.setCompanyId(getCompanyId());
243             model.setUserId(getUserId());
244             model.setUserName(HtmlUtil.escape(getUserName()));
245             model.setCreateDate(getCreateDate());
246             model.setModifiedDate(getModifiedDate());
247             model.setEntryId(getEntryId());
248             model.setKey(HtmlUtil.escape(getKey()));
249             model.setValue(HtmlUtil.escape(getValue()));
250 
251             model = (TagsProperty)Proxy.newProxyInstance(TagsProperty.class.getClassLoader(),
252                     new Class[] { TagsProperty.class },
253                     new ReadOnlyBeanHandler(model));
254 
255             return model;
256         }
257     }
258 
259     public Object clone() {
260         TagsPropertyImpl clone = new TagsPropertyImpl();
261 
262         clone.setPropertyId(getPropertyId());
263         clone.setCompanyId(getCompanyId());
264         clone.setUserId(getUserId());
265         clone.setUserName(getUserName());
266         clone.setCreateDate(getCreateDate());
267         clone.setModifiedDate(getModifiedDate());
268         clone.setEntryId(getEntryId());
269         clone.setKey(getKey());
270         clone.setValue(getValue());
271 
272         return clone;
273     }
274 
275     public int compareTo(TagsProperty tagsProperty) {
276         int value = 0;
277 
278         value = getKey().compareTo(tagsProperty.getKey());
279 
280         if (value != 0) {
281             return value;
282         }
283 
284         return 0;
285     }
286 
287     public boolean equals(Object obj) {
288         if (obj == null) {
289             return false;
290         }
291 
292         TagsProperty tagsProperty = null;
293 
294         try {
295             tagsProperty = (TagsProperty)obj;
296         }
297         catch (ClassCastException cce) {
298             return false;
299         }
300 
301         long pk = tagsProperty.getPrimaryKey();
302 
303         if (getPrimaryKey() == pk) {
304             return true;
305         }
306         else {
307             return false;
308         }
309     }
310 
311     public int hashCode() {
312         return (int)getPrimaryKey();
313     }
314 
315     public String toString() {
316         StringBuilder sb = new StringBuilder();
317 
318         sb.append("{propertyId=");
319         sb.append(getPropertyId());
320         sb.append(", companyId=");
321         sb.append(getCompanyId());
322         sb.append(", userId=");
323         sb.append(getUserId());
324         sb.append(", userName=");
325         sb.append(getUserName());
326         sb.append(", createDate=");
327         sb.append(getCreateDate());
328         sb.append(", modifiedDate=");
329         sb.append(getModifiedDate());
330         sb.append(", entryId=");
331         sb.append(getEntryId());
332         sb.append(", key=");
333         sb.append(getKey());
334         sb.append(", value=");
335         sb.append(getValue());
336         sb.append("}");
337 
338         return sb.toString();
339     }
340 
341     public String toXmlString() {
342         StringBuilder sb = new StringBuilder();
343 
344         sb.append("<model><model-name>");
345         sb.append("com.liferay.portlet.tags.model.TagsProperty");
346         sb.append("</model-name>");
347 
348         sb.append(
349             "<column><column-name>propertyId</column-name><column-value><![CDATA[");
350         sb.append(getPropertyId());
351         sb.append("]]></column-value></column>");
352         sb.append(
353             "<column><column-name>companyId</column-name><column-value><![CDATA[");
354         sb.append(getCompanyId());
355         sb.append("]]></column-value></column>");
356         sb.append(
357             "<column><column-name>userId</column-name><column-value><![CDATA[");
358         sb.append(getUserId());
359         sb.append("]]></column-value></column>");
360         sb.append(
361             "<column><column-name>userName</column-name><column-value><![CDATA[");
362         sb.append(getUserName());
363         sb.append("]]></column-value></column>");
364         sb.append(
365             "<column><column-name>createDate</column-name><column-value><![CDATA[");
366         sb.append(getCreateDate());
367         sb.append("]]></column-value></column>");
368         sb.append(
369             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
370         sb.append(getModifiedDate());
371         sb.append("]]></column-value></column>");
372         sb.append(
373             "<column><column-name>entryId</column-name><column-value><![CDATA[");
374         sb.append(getEntryId());
375         sb.append("]]></column-value></column>");
376         sb.append(
377             "<column><column-name>key</column-name><column-value><![CDATA[");
378         sb.append(getKey());
379         sb.append("]]></column-value></column>");
380         sb.append(
381             "<column><column-name>value</column-name><column-value><![CDATA[");
382         sb.append(getValue());
383         sb.append("]]></column-value></column>");
384 
385         sb.append("</model>");
386 
387         return sb.toString();
388     }
389 
390     private long _propertyId;
391     private long _companyId;
392     private long _userId;
393     private String _userUuid;
394     private String _userName;
395     private Date _createDate;
396     private Date _modifiedDate;
397     private long _entryId;
398     private long _originalEntryId;
399     private boolean _setOriginalEntryId;
400     private String _key;
401     private String _originalKey;
402     private String _value;
403 }