001
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
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 }