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.AssetLink;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing AssetLink in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see AssetLink
032     * @generated
033     */
034    public class AssetLinkCacheModel implements CacheModel<AssetLink>, Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(19);
038    
039                    sb.append("{linkId=");
040                    sb.append(linkId);
041                    sb.append(", companyId=");
042                    sb.append(companyId);
043                    sb.append(", userId=");
044                    sb.append(userId);
045                    sb.append(", userName=");
046                    sb.append(userName);
047                    sb.append(", createDate=");
048                    sb.append(createDate);
049                    sb.append(", entryId1=");
050                    sb.append(entryId1);
051                    sb.append(", entryId2=");
052                    sb.append(entryId2);
053                    sb.append(", type=");
054                    sb.append(type);
055                    sb.append(", weight=");
056                    sb.append(weight);
057                    sb.append("}");
058    
059                    return sb.toString();
060            }
061    
062            public AssetLink toEntityModel() {
063                    AssetLinkImpl assetLinkImpl = new AssetLinkImpl();
064    
065                    assetLinkImpl.setLinkId(linkId);
066                    assetLinkImpl.setCompanyId(companyId);
067                    assetLinkImpl.setUserId(userId);
068    
069                    if (userName == null) {
070                            assetLinkImpl.setUserName(StringPool.BLANK);
071                    }
072                    else {
073                            assetLinkImpl.setUserName(userName);
074                    }
075    
076                    if (createDate == Long.MIN_VALUE) {
077                            assetLinkImpl.setCreateDate(null);
078                    }
079                    else {
080                            assetLinkImpl.setCreateDate(new Date(createDate));
081                    }
082    
083                    assetLinkImpl.setEntryId1(entryId1);
084                    assetLinkImpl.setEntryId2(entryId2);
085                    assetLinkImpl.setType(type);
086                    assetLinkImpl.setWeight(weight);
087    
088                    assetLinkImpl.resetOriginalValues();
089    
090                    return assetLinkImpl;
091            }
092    
093            public long linkId;
094            public long companyId;
095            public long userId;
096            public String userName;
097            public long createDate;
098            public long entryId1;
099            public long entryId2;
100            public int type;
101            public int weight;
102    }