001    /**
002     * Copyright (c) 2000-2013 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.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.asset.model.AssetTag;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing AssetTag in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see AssetTag
032     * @generated
033     */
034    public class AssetTagCacheModel implements CacheModel<AssetTag>, Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(19);
038    
039                    sb.append("{tagId=");
040                    sb.append(tagId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", userId=");
046                    sb.append(userId);
047                    sb.append(", userName=");
048                    sb.append(userName);
049                    sb.append(", createDate=");
050                    sb.append(createDate);
051                    sb.append(", modifiedDate=");
052                    sb.append(modifiedDate);
053                    sb.append(", name=");
054                    sb.append(name);
055                    sb.append(", assetCount=");
056                    sb.append(assetCount);
057                    sb.append("}");
058    
059                    return sb.toString();
060            }
061    
062            public AssetTag toEntityModel() {
063                    AssetTagImpl assetTagImpl = new AssetTagImpl();
064    
065                    assetTagImpl.setTagId(tagId);
066                    assetTagImpl.setGroupId(groupId);
067                    assetTagImpl.setCompanyId(companyId);
068                    assetTagImpl.setUserId(userId);
069    
070                    if (userName == null) {
071                            assetTagImpl.setUserName(StringPool.BLANK);
072                    }
073                    else {
074                            assetTagImpl.setUserName(userName);
075                    }
076    
077                    if (createDate == Long.MIN_VALUE) {
078                            assetTagImpl.setCreateDate(null);
079                    }
080                    else {
081                            assetTagImpl.setCreateDate(new Date(createDate));
082                    }
083    
084                    if (modifiedDate == Long.MIN_VALUE) {
085                            assetTagImpl.setModifiedDate(null);
086                    }
087                    else {
088                            assetTagImpl.setModifiedDate(new Date(modifiedDate));
089                    }
090    
091                    if (name == null) {
092                            assetTagImpl.setName(StringPool.BLANK);
093                    }
094                    else {
095                            assetTagImpl.setName(name);
096                    }
097    
098                    assetTagImpl.setAssetCount(assetCount);
099    
100                    assetTagImpl.resetOriginalValues();
101    
102                    return assetTagImpl;
103            }
104    
105            public long tagId;
106            public long groupId;
107            public long companyId;
108            public long userId;
109            public String userName;
110            public long createDate;
111            public long modifiedDate;
112            public String name;
113            public int assetCount;
114    }