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.AssetCategoryProperty;
027    import com.liferay.portlet.asset.model.AssetCategoryPropertyModel;
028    import com.liferay.portlet.asset.model.AssetCategoryPropertySoap;
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 AssetCategoryProperty table in the
045     * database.
046     * </p>
047     *
048     * @author    Brian Wing Shun Chan
049     * @see       AssetCategoryPropertyImpl
050     * @see       com.liferay.portlet.asset.model.AssetCategoryProperty
051     * @see       com.liferay.portlet.asset.model.AssetCategoryPropertyModel
052     * @generated
053     */
054    public class AssetCategoryPropertyModelImpl extends BaseModelImpl<AssetCategoryProperty>
055            implements AssetCategoryPropertyModel {
056            public static final String TABLE_NAME = "AssetCategoryProperty";
057            public static final Object[][] TABLE_COLUMNS = {
058                            { "categoryPropertyId", 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                            { "categoryId", 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 AssetCategoryProperty (categoryPropertyId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,categoryId LONG,key_ VARCHAR(75) null,value VARCHAR(75) null)";
069            public static final String TABLE_SQL_DROP = "drop table AssetCategoryProperty";
070            public static final String ORDER_BY_JPQL = " ORDER BY assetCategoryProperty.key ASC";
071            public static final String ORDER_BY_SQL = " ORDER BY AssetCategoryProperty.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.AssetCategoryProperty"),
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.AssetCategoryProperty"),
080                            true);
081    
082            public static AssetCategoryProperty toModel(
083                    AssetCategoryPropertySoap soapModel) {
084                    AssetCategoryProperty model = new AssetCategoryPropertyImpl();
085    
086                    model.setCategoryPropertyId(soapModel.getCategoryPropertyId());
087                    model.setCompanyId(soapModel.getCompanyId());
088                    model.setUserId(soapModel.getUserId());
089                    model.setUserName(soapModel.getUserName());
090                    model.setCreateDate(soapModel.getCreateDate());
091                    model.setModifiedDate(soapModel.getModifiedDate());
092                    model.setCategoryId(soapModel.getCategoryId());
093                    model.setKey(soapModel.getKey());
094                    model.setValue(soapModel.getValue());
095    
096                    return model;
097            }
098    
099            public static List<AssetCategoryProperty> toModels(
100                    AssetCategoryPropertySoap[] soapModels) {
101                    List<AssetCategoryProperty> models = new ArrayList<AssetCategoryProperty>(soapModels.length);
102    
103                    for (AssetCategoryPropertySoap soapModel : soapModels) {
104                            models.add(toModel(soapModel));
105                    }
106    
107                    return models;
108            }
109    
110            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
111                                    "lock.expiration.time.com.liferay.portlet.asset.model.AssetCategoryProperty"));
112    
113            public AssetCategoryPropertyModelImpl() {
114            }
115    
116            public long getPrimaryKey() {
117                    return _categoryPropertyId;
118            }
119    
120            public void setPrimaryKey(long pk) {
121                    setCategoryPropertyId(pk);
122            }
123    
124            public Serializable getPrimaryKeyObj() {
125                    return new Long(_categoryPropertyId);
126            }
127    
128            public long getCategoryPropertyId() {
129                    return _categoryPropertyId;
130            }
131    
132            public void setCategoryPropertyId(long categoryPropertyId) {
133                    _categoryPropertyId = categoryPropertyId;
134            }
135    
136            public long getCompanyId() {
137                    return _companyId;
138            }
139    
140            public void setCompanyId(long companyId) {
141                    _companyId = companyId;
142            }
143    
144            public long getUserId() {
145                    return _userId;
146            }
147    
148            public void setUserId(long userId) {
149                    _userId = userId;
150            }
151    
152            public String getUserUuid() throws SystemException {
153                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
154            }
155    
156            public void setUserUuid(String userUuid) {
157                    _userUuid = userUuid;
158            }
159    
160            public String getUserName() {
161                    if (_userName == null) {
162                            return StringPool.BLANK;
163                    }
164                    else {
165                            return _userName;
166                    }
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 getCategoryId() {
190                    return _categoryId;
191            }
192    
193            public void setCategoryId(long categoryId) {
194                    _categoryId = categoryId;
195    
196                    if (!_setOriginalCategoryId) {
197                            _setOriginalCategoryId = true;
198    
199                            _originalCategoryId = categoryId;
200                    }
201            }
202    
203            public long getOriginalCategoryId() {
204                    return _originalCategoryId;
205            }
206    
207            public String getKey() {
208                    if (_key == null) {
209                            return StringPool.BLANK;
210                    }
211                    else {
212                            return _key;
213                    }
214            }
215    
216            public void setKey(String key) {
217                    _key = key;
218    
219                    if (_originalKey == null) {
220                            _originalKey = key;
221                    }
222            }
223    
224            public String getOriginalKey() {
225                    return GetterUtil.getString(_originalKey);
226            }
227    
228            public String getValue() {
229                    if (_value == null) {
230                            return StringPool.BLANK;
231                    }
232                    else {
233                            return _value;
234                    }
235            }
236    
237            public void setValue(String value) {
238                    _value = value;
239            }
240    
241            public AssetCategoryProperty toEscapedModel() {
242                    if (isEscapedModel()) {
243                            return (AssetCategoryProperty)this;
244                    }
245                    else {
246                            return (AssetCategoryProperty)Proxy.newProxyInstance(AssetCategoryProperty.class.getClassLoader(),
247                                    new Class[] { AssetCategoryProperty.class },
248                                    new AutoEscapeBeanHandler(this));
249                    }
250            }
251    
252            public ExpandoBridge getExpandoBridge() {
253                    if (_expandoBridge == null) {
254                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
255                                            AssetCategoryProperty.class.getName(), getPrimaryKey());
256                    }
257    
258                    return _expandoBridge;
259            }
260    
261            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
262                    getExpandoBridge().setAttributes(serviceContext);
263            }
264    
265            public Object clone() {
266                    AssetCategoryPropertyImpl clone = new AssetCategoryPropertyImpl();
267    
268                    clone.setCategoryPropertyId(getCategoryPropertyId());
269                    clone.setCompanyId(getCompanyId());
270                    clone.setUserId(getUserId());
271                    clone.setUserName(getUserName());
272                    clone.setCreateDate(getCreateDate());
273                    clone.setModifiedDate(getModifiedDate());
274                    clone.setCategoryId(getCategoryId());
275                    clone.setKey(getKey());
276                    clone.setValue(getValue());
277    
278                    return clone;
279            }
280    
281            public int compareTo(AssetCategoryProperty assetCategoryProperty) {
282                    int value = 0;
283    
284                    value = getKey().compareTo(assetCategoryProperty.getKey());
285    
286                    if (value != 0) {
287                            return value;
288                    }
289    
290                    return 0;
291            }
292    
293            public boolean equals(Object obj) {
294                    if (obj == null) {
295                            return false;
296                    }
297    
298                    AssetCategoryProperty assetCategoryProperty = null;
299    
300                    try {
301                            assetCategoryProperty = (AssetCategoryProperty)obj;
302                    }
303                    catch (ClassCastException cce) {
304                            return false;
305                    }
306    
307                    long pk = assetCategoryProperty.getPrimaryKey();
308    
309                    if (getPrimaryKey() == pk) {
310                            return true;
311                    }
312                    else {
313                            return false;
314                    }
315            }
316    
317            public int hashCode() {
318                    return (int)getPrimaryKey();
319            }
320    
321            public String toString() {
322                    StringBundler sb = new StringBundler(19);
323    
324                    sb.append("{categoryPropertyId=");
325                    sb.append(getCategoryPropertyId());
326                    sb.append(", companyId=");
327                    sb.append(getCompanyId());
328                    sb.append(", userId=");
329                    sb.append(getUserId());
330                    sb.append(", userName=");
331                    sb.append(getUserName());
332                    sb.append(", createDate=");
333                    sb.append(getCreateDate());
334                    sb.append(", modifiedDate=");
335                    sb.append(getModifiedDate());
336                    sb.append(", categoryId=");
337                    sb.append(getCategoryId());
338                    sb.append(", key=");
339                    sb.append(getKey());
340                    sb.append(", value=");
341                    sb.append(getValue());
342                    sb.append("}");
343    
344                    return sb.toString();
345            }
346    
347            public String toXmlString() {
348                    StringBundler sb = new StringBundler(31);
349    
350                    sb.append("<model><model-name>");
351                    sb.append("com.liferay.portlet.asset.model.AssetCategoryProperty");
352                    sb.append("</model-name>");
353    
354                    sb.append(
355                            "<column><column-name>categoryPropertyId</column-name><column-value><![CDATA[");
356                    sb.append(getCategoryPropertyId());
357                    sb.append("]]></column-value></column>");
358                    sb.append(
359                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
360                    sb.append(getCompanyId());
361                    sb.append("]]></column-value></column>");
362                    sb.append(
363                            "<column><column-name>userId</column-name><column-value><![CDATA[");
364                    sb.append(getUserId());
365                    sb.append("]]></column-value></column>");
366                    sb.append(
367                            "<column><column-name>userName</column-name><column-value><![CDATA[");
368                    sb.append(getUserName());
369                    sb.append("]]></column-value></column>");
370                    sb.append(
371                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
372                    sb.append(getCreateDate());
373                    sb.append("]]></column-value></column>");
374                    sb.append(
375                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
376                    sb.append(getModifiedDate());
377                    sb.append("]]></column-value></column>");
378                    sb.append(
379                            "<column><column-name>categoryId</column-name><column-value><![CDATA[");
380                    sb.append(getCategoryId());
381                    sb.append("]]></column-value></column>");
382                    sb.append(
383                            "<column><column-name>key</column-name><column-value><![CDATA[");
384                    sb.append(getKey());
385                    sb.append("]]></column-value></column>");
386                    sb.append(
387                            "<column><column-name>value</column-name><column-value><![CDATA[");
388                    sb.append(getValue());
389                    sb.append("]]></column-value></column>");
390    
391                    sb.append("</model>");
392    
393                    return sb.toString();
394            }
395    
396            private long _categoryPropertyId;
397            private long _companyId;
398            private long _userId;
399            private String _userUuid;
400            private String _userName;
401            private Date _createDate;
402            private Date _modifiedDate;
403            private long _categoryId;
404            private long _originalCategoryId;
405            private boolean _setOriginalCategoryId;
406            private String _key;
407            private String _originalKey;
408            private String _value;
409            private transient ExpandoBridge _expandoBridge;
410    }