001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.asset.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.impl.BaseModelImpl;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.asset.model.AssetTagProperty;
027    import com.liferay.portlet.asset.model.AssetTagPropertyModel;
028    import com.liferay.portlet.asset.model.AssetTagPropertySoap;
029    import com.liferay.portlet.expando.model.ExpandoBridge;
030    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031    
032    import java.io.Serializable;
033    
034    import java.lang.reflect.Proxy;
035    
036    import java.sql.Types;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.List;
041    
042    /**
043     * <p>
044     * This interface is a model that represents the AssetTagProperty table in the
045     * database.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       AssetTagPropertyImpl
050     * @see       com.liferay.portlet.asset.model.AssetTagProperty
051     * @see       com.liferay.portlet.asset.model.AssetTagPropertyModel
052     * @generated
053     */
054    public class AssetTagPropertyModelImpl extends BaseModelImpl<AssetTagProperty>
055            implements AssetTagPropertyModel {
056            public static final String TABLE_NAME = "AssetTagProperty";
057            public static final Object[][] TABLE_COLUMNS = {
058                            { "tagPropertyId", new Integer(Types.BIGINT) },
059                            { "companyId", new Integer(Types.BIGINT) },
060                            { "userId", new Integer(Types.BIGINT) },
061                            { "userName", new Integer(Types.VARCHAR) },
062                            { "createDate", new Integer(Types.TIMESTAMP) },
063                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
064                            { "tagId", new Integer(Types.BIGINT) },
065                            { "key_", new Integer(Types.VARCHAR) },
066                            { "value", new Integer(Types.VARCHAR) }
067                    };
068            public static final String TABLE_SQL_CREATE = "create table AssetTagProperty (tagPropertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,tagId LONG,key_ VARCHAR(75) null,value VARCHAR(255) null)";
069            public static final String TABLE_SQL_DROP = "drop table AssetTagProperty";
070            public static final String ORDER_BY_JPQL = " ORDER BY assetTagProperty.key ASC";
071            public static final String ORDER_BY_SQL = " ORDER BY AssetTagProperty.key_ ASC";
072            public static final String DATA_SOURCE = "liferayDataSource";
073            public static final String SESSION_FACTORY = "liferaySessionFactory";
074            public static final String TX_MANAGER = "liferayTransactionManager";
075            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
076                                    "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetTagProperty"),
077                            true);
078            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
079                                    "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetTagProperty"),
080                            true);
081    
082            public static AssetTagProperty toModel(AssetTagPropertySoap soapModel) {
083                    AssetTagProperty model = new AssetTagPropertyImpl();
084    
085                    model.setTagPropertyId(soapModel.getTagPropertyId());
086                    model.setCompanyId(soapModel.getCompanyId());
087                    model.setUserId(soapModel.getUserId());
088                    model.setUserName(soapModel.getUserName());
089                    model.setCreateDate(soapModel.getCreateDate());
090                    model.setModifiedDate(soapModel.getModifiedDate());
091                    model.setTagId(soapModel.getTagId());
092                    model.setKey(soapModel.getKey());
093                    model.setValue(soapModel.getValue());
094    
095                    return model;
096            }
097    
098            public static List<AssetTagProperty> toModels(
099                    AssetTagPropertySoap[] soapModels) {
100                    List<AssetTagProperty> models = new ArrayList<AssetTagProperty>(soapModels.length);
101    
102                    for (AssetTagPropertySoap soapModel : soapModels) {
103                            models.add(toModel(soapModel));
104                    }
105    
106                    return models;
107            }
108    
109            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
110                                    "lock.expiration.time.com.liferay.portlet.asset.model.AssetTagProperty"));
111    
112            public AssetTagPropertyModelImpl() {
113            }
114    
115            public long getPrimaryKey() {
116                    return _tagPropertyId;
117            }
118    
119            public void setPrimaryKey(long pk) {
120                    setTagPropertyId(pk);
121            }
122    
123            public Serializable getPrimaryKeyObj() {
124                    return new Long(_tagPropertyId);
125            }
126    
127            public long getTagPropertyId() {
128                    return _tagPropertyId;
129            }
130    
131            public void setTagPropertyId(long tagPropertyId) {
132                    _tagPropertyId = tagPropertyId;
133            }
134    
135            public long getCompanyId() {
136                    return _companyId;
137            }
138    
139            public void setCompanyId(long companyId) {
140                    _companyId = companyId;
141            }
142    
143            public long getUserId() {
144                    return _userId;
145            }
146    
147            public void setUserId(long userId) {
148                    _userId = userId;
149            }
150    
151            public String getUserUuid() throws SystemException {
152                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
153            }
154    
155            public void setUserUuid(String userUuid) {
156                    _userUuid = userUuid;
157            }
158    
159            public String getUserName() {
160                    if (_userName == null) {
161                            return StringPool.BLANK;
162                    }
163                    else {
164                            return _userName;
165                    }
166            }
167    
168            public void setUserName(String userName) {
169                    _userName = userName;
170            }
171    
172            public Date getCreateDate() {
173                    return _createDate;
174            }
175    
176            public void setCreateDate(Date createDate) {
177                    _createDate = createDate;
178            }
179    
180            public Date getModifiedDate() {
181                    return _modifiedDate;
182            }
183    
184            public void setModifiedDate(Date modifiedDate) {
185                    _modifiedDate = modifiedDate;
186            }
187    
188            public long getTagId() {
189                    return _tagId;
190            }
191    
192            public void setTagId(long tagId) {
193                    _tagId = tagId;
194    
195                    if (!_setOriginalTagId) {
196                            _setOriginalTagId = true;
197    
198                            _originalTagId = tagId;
199                    }
200            }
201    
202            public long getOriginalTagId() {
203                    return _originalTagId;
204            }
205    
206            public String getKey() {
207                    if (_key == null) {
208                            return StringPool.BLANK;
209                    }
210                    else {
211                            return _key;
212                    }
213            }
214    
215            public void setKey(String key) {
216                    _key = key;
217    
218                    if (_originalKey == null) {
219                            _originalKey = key;
220                    }
221            }
222    
223            public String getOriginalKey() {
224                    return GetterUtil.getString(_originalKey);
225            }
226    
227            public String getValue() {
228                    if (_value == null) {
229                            return StringPool.BLANK;
230                    }
231                    else {
232                            return _value;
233                    }
234            }
235    
236            public void setValue(String value) {
237                    _value = value;
238            }
239    
240            public AssetTagProperty toEscapedModel() {
241                    if (isEscapedModel()) {
242                            return (AssetTagProperty)this;
243                    }
244                    else {
245                            return (AssetTagProperty)Proxy.newProxyInstance(AssetTagProperty.class.getClassLoader(),
246                                    new Class[] { AssetTagProperty.class },
247                                    new AutoEscapeBeanHandler(this));
248                    }
249            }
250    
251            public ExpandoBridge getExpandoBridge() {
252                    if (_expandoBridge == null) {
253                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
254                                            AssetTagProperty.class.getName(), getPrimaryKey());
255                    }
256    
257                    return _expandoBridge;
258            }
259    
260            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
261                    getExpandoBridge().setAttributes(serviceContext);
262            }
263    
264            public Object clone() {
265                    AssetTagPropertyImpl clone = new AssetTagPropertyImpl();
266    
267                    clone.setTagPropertyId(getTagPropertyId());
268                    clone.setCompanyId(getCompanyId());
269                    clone.setUserId(getUserId());
270                    clone.setUserName(getUserName());
271                    clone.setCreateDate(getCreateDate());
272                    clone.setModifiedDate(getModifiedDate());
273                    clone.setTagId(getTagId());
274                    clone.setKey(getKey());
275                    clone.setValue(getValue());
276    
277                    return clone;
278            }
279    
280            public int compareTo(AssetTagProperty assetTagProperty) {
281                    int value = 0;
282    
283                    value = getKey().compareTo(assetTagProperty.getKey());
284    
285                    if (value != 0) {
286                            return value;
287                    }
288    
289                    return 0;
290            }
291    
292            public boolean equals(Object obj) {
293                    if (obj == null) {
294                            return false;
295                    }
296    
297                    AssetTagProperty assetTagProperty = null;
298    
299                    try {
300                            assetTagProperty = (AssetTagProperty)obj;
301                    }
302                    catch (ClassCastException cce) {
303                            return false;
304                    }
305    
306                    long pk = assetTagProperty.getPrimaryKey();
307    
308                    if (getPrimaryKey() == pk) {
309                            return true;
310                    }
311                    else {
312                            return false;
313                    }
314            }
315    
316            public int hashCode() {
317                    return (int)getPrimaryKey();
318            }
319    
320            public String toString() {
321                    StringBundler sb = new StringBundler(19);
322    
323                    sb.append("{tagPropertyId=");
324                    sb.append(getTagPropertyId());
325                    sb.append(", companyId=");
326                    sb.append(getCompanyId());
327                    sb.append(", userId=");
328                    sb.append(getUserId());
329                    sb.append(", userName=");
330                    sb.append(getUserName());
331                    sb.append(", createDate=");
332                    sb.append(getCreateDate());
333                    sb.append(", modifiedDate=");
334                    sb.append(getModifiedDate());
335                    sb.append(", tagId=");
336                    sb.append(getTagId());
337                    sb.append(", key=");
338                    sb.append(getKey());
339                    sb.append(", value=");
340                    sb.append(getValue());
341                    sb.append("}");
342    
343                    return sb.toString();
344            }
345    
346            public String toXmlString() {
347                    StringBundler sb = new StringBundler(31);
348    
349                    sb.append("<model><model-name>");
350                    sb.append("com.liferay.portlet.asset.model.AssetTagProperty");
351                    sb.append("</model-name>");
352    
353                    sb.append(
354                            "<column><column-name>tagPropertyId</column-name><column-value><![CDATA[");
355                    sb.append(getTagPropertyId());
356                    sb.append("]]></column-value></column>");
357                    sb.append(
358                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
359                    sb.append(getCompanyId());
360                    sb.append("]]></column-value></column>");
361                    sb.append(
362                            "<column><column-name>userId</column-name><column-value><![CDATA[");
363                    sb.append(getUserId());
364                    sb.append("]]></column-value></column>");
365                    sb.append(
366                            "<column><column-name>userName</column-name><column-value><![CDATA[");
367                    sb.append(getUserName());
368                    sb.append("]]></column-value></column>");
369                    sb.append(
370                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
371                    sb.append(getCreateDate());
372                    sb.append("]]></column-value></column>");
373                    sb.append(
374                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
375                    sb.append(getModifiedDate());
376                    sb.append("]]></column-value></column>");
377                    sb.append(
378                            "<column><column-name>tagId</column-name><column-value><![CDATA[");
379                    sb.append(getTagId());
380                    sb.append("]]></column-value></column>");
381                    sb.append(
382                            "<column><column-name>key</column-name><column-value><![CDATA[");
383                    sb.append(getKey());
384                    sb.append("]]></column-value></column>");
385                    sb.append(
386                            "<column><column-name>value</column-name><column-value><![CDATA[");
387                    sb.append(getValue());
388                    sb.append("]]></column-value></column>");
389    
390                    sb.append("</model>");
391    
392                    return sb.toString();
393            }
394    
395            private long _tagPropertyId;
396            private long _companyId;
397            private long _userId;
398            private String _userUuid;
399            private String _userName;
400            private Date _createDate;
401            private Date _modifiedDate;
402            private long _tagId;
403            private long _originalTagId;
404            private boolean _setOriginalTagId;
405            private String _key;
406            private String _originalKey;
407            private String _value;
408            private transient ExpandoBridge _expandoBridge;
409    }