001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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     * The base model implementation for the AssetTagProperty service. Represents a row in the "AssetTagProperty" database table, with each column mapped to a property of this class.
044     *
045     * <p>
046     * This implementation and its corresponding interface {@link com.liferay.portlet.asset.model.AssetTagPropertyModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link AssetTagPropertyImpl}.
047     * </p>
048     *
049     * <p>
050     * Never modify or reference this class directly. All methods that expect a asset tag property model instance should use the {@link com.liferay.portlet.asset.model.AssetTagProperty} interface instead.
051     * </p>
052     *
053     * @author Brian Wing Shun Chan
054     * @see AssetTagPropertyImpl
055     * @see com.liferay.portlet.asset.model.AssetTagProperty
056     * @see com.liferay.portlet.asset.model.AssetTagPropertyModel
057     * @generated
058     */
059    public class AssetTagPropertyModelImpl extends BaseModelImpl<AssetTagProperty>
060            implements AssetTagPropertyModel {
061            public static final String TABLE_NAME = "AssetTagProperty";
062            public static final Object[][] TABLE_COLUMNS = {
063                            { "tagPropertyId", new Integer(Types.BIGINT) },
064                            { "companyId", new Integer(Types.BIGINT) },
065                            { "userId", new Integer(Types.BIGINT) },
066                            { "userName", new Integer(Types.VARCHAR) },
067                            { "createDate", new Integer(Types.TIMESTAMP) },
068                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
069                            { "tagId", new Integer(Types.BIGINT) },
070                            { "key_", new Integer(Types.VARCHAR) },
071                            { "value", new Integer(Types.VARCHAR) }
072                    };
073            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)";
074            public static final String TABLE_SQL_DROP = "drop table AssetTagProperty";
075            public static final String ORDER_BY_JPQL = " ORDER BY assetTagProperty.key ASC";
076            public static final String ORDER_BY_SQL = " ORDER BY AssetTagProperty.key_ ASC";
077            public static final String DATA_SOURCE = "liferayDataSource";
078            public static final String SESSION_FACTORY = "liferaySessionFactory";
079            public static final String TX_MANAGER = "liferayTransactionManager";
080            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081                                    "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetTagProperty"),
082                            true);
083            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
084                                    "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetTagProperty"),
085                            true);
086    
087            /**
088             * Converts the soap model instance into a normal model instance.
089             *
090             * @param soapModel the soap model instance to convert
091             * @return the normal model instance
092             */
093            public static AssetTagProperty toModel(AssetTagPropertySoap soapModel) {
094                    AssetTagProperty model = new AssetTagPropertyImpl();
095    
096                    model.setTagPropertyId(soapModel.getTagPropertyId());
097                    model.setCompanyId(soapModel.getCompanyId());
098                    model.setUserId(soapModel.getUserId());
099                    model.setUserName(soapModel.getUserName());
100                    model.setCreateDate(soapModel.getCreateDate());
101                    model.setModifiedDate(soapModel.getModifiedDate());
102                    model.setTagId(soapModel.getTagId());
103                    model.setKey(soapModel.getKey());
104                    model.setValue(soapModel.getValue());
105    
106                    return model;
107            }
108    
109            /**
110             * Converts the soap model instances into normal model instances.
111             *
112             * @param soapModels the soap model instances to convert
113             * @return the normal model instances
114             */
115            public static List<AssetTagProperty> toModels(
116                    AssetTagPropertySoap[] soapModels) {
117                    List<AssetTagProperty> models = new ArrayList<AssetTagProperty>(soapModels.length);
118    
119                    for (AssetTagPropertySoap soapModel : soapModels) {
120                            models.add(toModel(soapModel));
121                    }
122    
123                    return models;
124            }
125    
126            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
127                                    "lock.expiration.time.com.liferay.portlet.asset.model.AssetTagProperty"));
128    
129            public AssetTagPropertyModelImpl() {
130            }
131    
132            public long getPrimaryKey() {
133                    return _tagPropertyId;
134            }
135    
136            public void setPrimaryKey(long pk) {
137                    setTagPropertyId(pk);
138            }
139    
140            public Serializable getPrimaryKeyObj() {
141                    return new Long(_tagPropertyId);
142            }
143    
144            public long getTagPropertyId() {
145                    return _tagPropertyId;
146            }
147    
148            public void setTagPropertyId(long tagPropertyId) {
149                    _tagPropertyId = tagPropertyId;
150            }
151    
152            public long getCompanyId() {
153                    return _companyId;
154            }
155    
156            public void setCompanyId(long companyId) {
157                    _companyId = companyId;
158            }
159    
160            public long getUserId() {
161                    return _userId;
162            }
163    
164            public void setUserId(long userId) {
165                    _userId = userId;
166            }
167    
168            public String getUserUuid() throws SystemException {
169                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
170            }
171    
172            public void setUserUuid(String userUuid) {
173                    _userUuid = userUuid;
174            }
175    
176            public String getUserName() {
177                    if (_userName == null) {
178                            return StringPool.BLANK;
179                    }
180                    else {
181                            return _userName;
182                    }
183            }
184    
185            public void setUserName(String userName) {
186                    _userName = userName;
187            }
188    
189            public Date getCreateDate() {
190                    return _createDate;
191            }
192    
193            public void setCreateDate(Date createDate) {
194                    _createDate = createDate;
195            }
196    
197            public Date getModifiedDate() {
198                    return _modifiedDate;
199            }
200    
201            public void setModifiedDate(Date modifiedDate) {
202                    _modifiedDate = modifiedDate;
203            }
204    
205            public long getTagId() {
206                    return _tagId;
207            }
208    
209            public void setTagId(long tagId) {
210                    _tagId = tagId;
211    
212                    if (!_setOriginalTagId) {
213                            _setOriginalTagId = true;
214    
215                            _originalTagId = tagId;
216                    }
217            }
218    
219            public long getOriginalTagId() {
220                    return _originalTagId;
221            }
222    
223            public String getKey() {
224                    if (_key == null) {
225                            return StringPool.BLANK;
226                    }
227                    else {
228                            return _key;
229                    }
230            }
231    
232            public void setKey(String key) {
233                    _key = key;
234    
235                    if (_originalKey == null) {
236                            _originalKey = key;
237                    }
238            }
239    
240            public String getOriginalKey() {
241                    return GetterUtil.getString(_originalKey);
242            }
243    
244            public String getValue() {
245                    if (_value == null) {
246                            return StringPool.BLANK;
247                    }
248                    else {
249                            return _value;
250                    }
251            }
252    
253            public void setValue(String value) {
254                    _value = value;
255            }
256    
257            public AssetTagProperty toEscapedModel() {
258                    if (isEscapedModel()) {
259                            return (AssetTagProperty)this;
260                    }
261                    else {
262                            return (AssetTagProperty)Proxy.newProxyInstance(AssetTagProperty.class.getClassLoader(),
263                                    new Class[] { AssetTagProperty.class },
264                                    new AutoEscapeBeanHandler(this));
265                    }
266            }
267    
268            public ExpandoBridge getExpandoBridge() {
269                    if (_expandoBridge == null) {
270                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
271                                            AssetTagProperty.class.getName(), getPrimaryKey());
272                    }
273    
274                    return _expandoBridge;
275            }
276    
277            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
278                    getExpandoBridge().setAttributes(serviceContext);
279            }
280    
281            public Object clone() {
282                    AssetTagPropertyImpl clone = new AssetTagPropertyImpl();
283    
284                    clone.setTagPropertyId(getTagPropertyId());
285                    clone.setCompanyId(getCompanyId());
286                    clone.setUserId(getUserId());
287                    clone.setUserName(getUserName());
288                    clone.setCreateDate(getCreateDate());
289                    clone.setModifiedDate(getModifiedDate());
290                    clone.setTagId(getTagId());
291                    clone.setKey(getKey());
292                    clone.setValue(getValue());
293    
294                    return clone;
295            }
296    
297            public int compareTo(AssetTagProperty assetTagProperty) {
298                    int value = 0;
299    
300                    value = getKey().compareTo(assetTagProperty.getKey());
301    
302                    if (value != 0) {
303                            return value;
304                    }
305    
306                    return 0;
307            }
308    
309            public boolean equals(Object obj) {
310                    if (obj == null) {
311                            return false;
312                    }
313    
314                    AssetTagProperty assetTagProperty = null;
315    
316                    try {
317                            assetTagProperty = (AssetTagProperty)obj;
318                    }
319                    catch (ClassCastException cce) {
320                            return false;
321                    }
322    
323                    long pk = assetTagProperty.getPrimaryKey();
324    
325                    if (getPrimaryKey() == pk) {
326                            return true;
327                    }
328                    else {
329                            return false;
330                    }
331            }
332    
333            public int hashCode() {
334                    return (int)getPrimaryKey();
335            }
336    
337            public String toString() {
338                    StringBundler sb = new StringBundler(19);
339    
340                    sb.append("{tagPropertyId=");
341                    sb.append(getTagPropertyId());
342                    sb.append(", companyId=");
343                    sb.append(getCompanyId());
344                    sb.append(", userId=");
345                    sb.append(getUserId());
346                    sb.append(", userName=");
347                    sb.append(getUserName());
348                    sb.append(", createDate=");
349                    sb.append(getCreateDate());
350                    sb.append(", modifiedDate=");
351                    sb.append(getModifiedDate());
352                    sb.append(", tagId=");
353                    sb.append(getTagId());
354                    sb.append(", key=");
355                    sb.append(getKey());
356                    sb.append(", value=");
357                    sb.append(getValue());
358                    sb.append("}");
359    
360                    return sb.toString();
361            }
362    
363            public String toXmlString() {
364                    StringBundler sb = new StringBundler(31);
365    
366                    sb.append("<model><model-name>");
367                    sb.append("com.liferay.portlet.asset.model.AssetTagProperty");
368                    sb.append("</model-name>");
369    
370                    sb.append(
371                            "<column><column-name>tagPropertyId</column-name><column-value><![CDATA[");
372                    sb.append(getTagPropertyId());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
376                    sb.append(getCompanyId());
377                    sb.append("]]></column-value></column>");
378                    sb.append(
379                            "<column><column-name>userId</column-name><column-value><![CDATA[");
380                    sb.append(getUserId());
381                    sb.append("]]></column-value></column>");
382                    sb.append(
383                            "<column><column-name>userName</column-name><column-value><![CDATA[");
384                    sb.append(getUserName());
385                    sb.append("]]></column-value></column>");
386                    sb.append(
387                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
388                    sb.append(getCreateDate());
389                    sb.append("]]></column-value></column>");
390                    sb.append(
391                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
392                    sb.append(getModifiedDate());
393                    sb.append("]]></column-value></column>");
394                    sb.append(
395                            "<column><column-name>tagId</column-name><column-value><![CDATA[");
396                    sb.append(getTagId());
397                    sb.append("]]></column-value></column>");
398                    sb.append(
399                            "<column><column-name>key</column-name><column-value><![CDATA[");
400                    sb.append(getKey());
401                    sb.append("]]></column-value></column>");
402                    sb.append(
403                            "<column><column-name>value</column-name><column-value><![CDATA[");
404                    sb.append(getValue());
405                    sb.append("]]></column-value></column>");
406    
407                    sb.append("</model>");
408    
409                    return sb.toString();
410            }
411    
412            private long _tagPropertyId;
413            private long _companyId;
414            private long _userId;
415            private String _userUuid;
416            private String _userName;
417            private Date _createDate;
418            private Date _modifiedDate;
419            private long _tagId;
420            private long _originalTagId;
421            private boolean _setOriginalTagId;
422            private String _key;
423            private String _originalKey;
424            private String _value;
425            private transient ExpandoBridge _expandoBridge;
426    }