001    /**
002     * Copyright (c) 2000-present 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.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.WorkflowDefinitionLink;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing WorkflowDefinitionLink in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see WorkflowDefinitionLink
037     * @generated
038     */
039    @ProviderType
040    public class WorkflowDefinitionLinkCacheModel implements CacheModel<WorkflowDefinitionLink>,
041            Externalizable, MVCCModel {
042            @Override
043            public long getMvccVersion() {
044                    return mvccVersion;
045            }
046    
047            @Override
048            public void setMvccVersion(long mvccVersion) {
049                    this.mvccVersion = mvccVersion;
050            }
051    
052            @Override
053            public String toString() {
054                    StringBundler sb = new StringBundler(27);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", workflowDefinitionLinkId=");
059                    sb.append(workflowDefinitionLinkId);
060                    sb.append(", groupId=");
061                    sb.append(groupId);
062                    sb.append(", companyId=");
063                    sb.append(companyId);
064                    sb.append(", userId=");
065                    sb.append(userId);
066                    sb.append(", userName=");
067                    sb.append(userName);
068                    sb.append(", createDate=");
069                    sb.append(createDate);
070                    sb.append(", modifiedDate=");
071                    sb.append(modifiedDate);
072                    sb.append(", classNameId=");
073                    sb.append(classNameId);
074                    sb.append(", classPK=");
075                    sb.append(classPK);
076                    sb.append(", typePK=");
077                    sb.append(typePK);
078                    sb.append(", workflowDefinitionName=");
079                    sb.append(workflowDefinitionName);
080                    sb.append(", workflowDefinitionVersion=");
081                    sb.append(workflowDefinitionVersion);
082                    sb.append("}");
083    
084                    return sb.toString();
085            }
086    
087            @Override
088            public WorkflowDefinitionLink toEntityModel() {
089                    WorkflowDefinitionLinkImpl workflowDefinitionLinkImpl = new WorkflowDefinitionLinkImpl();
090    
091                    workflowDefinitionLinkImpl.setMvccVersion(mvccVersion);
092                    workflowDefinitionLinkImpl.setWorkflowDefinitionLinkId(workflowDefinitionLinkId);
093                    workflowDefinitionLinkImpl.setGroupId(groupId);
094                    workflowDefinitionLinkImpl.setCompanyId(companyId);
095                    workflowDefinitionLinkImpl.setUserId(userId);
096    
097                    if (userName == null) {
098                            workflowDefinitionLinkImpl.setUserName(StringPool.BLANK);
099                    }
100                    else {
101                            workflowDefinitionLinkImpl.setUserName(userName);
102                    }
103    
104                    if (createDate == Long.MIN_VALUE) {
105                            workflowDefinitionLinkImpl.setCreateDate(null);
106                    }
107                    else {
108                            workflowDefinitionLinkImpl.setCreateDate(new Date(createDate));
109                    }
110    
111                    if (modifiedDate == Long.MIN_VALUE) {
112                            workflowDefinitionLinkImpl.setModifiedDate(null);
113                    }
114                    else {
115                            workflowDefinitionLinkImpl.setModifiedDate(new Date(modifiedDate));
116                    }
117    
118                    workflowDefinitionLinkImpl.setClassNameId(classNameId);
119                    workflowDefinitionLinkImpl.setClassPK(classPK);
120                    workflowDefinitionLinkImpl.setTypePK(typePK);
121    
122                    if (workflowDefinitionName == null) {
123                            workflowDefinitionLinkImpl.setWorkflowDefinitionName(StringPool.BLANK);
124                    }
125                    else {
126                            workflowDefinitionLinkImpl.setWorkflowDefinitionName(workflowDefinitionName);
127                    }
128    
129                    workflowDefinitionLinkImpl.setWorkflowDefinitionVersion(workflowDefinitionVersion);
130    
131                    workflowDefinitionLinkImpl.resetOriginalValues();
132    
133                    return workflowDefinitionLinkImpl;
134            }
135    
136            @Override
137            public void readExternal(ObjectInput objectInput) throws IOException {
138                    mvccVersion = objectInput.readLong();
139                    workflowDefinitionLinkId = objectInput.readLong();
140                    groupId = objectInput.readLong();
141                    companyId = objectInput.readLong();
142                    userId = objectInput.readLong();
143                    userName = objectInput.readUTF();
144                    createDate = objectInput.readLong();
145                    modifiedDate = objectInput.readLong();
146                    classNameId = objectInput.readLong();
147                    classPK = objectInput.readLong();
148                    typePK = objectInput.readLong();
149                    workflowDefinitionName = objectInput.readUTF();
150                    workflowDefinitionVersion = objectInput.readInt();
151            }
152    
153            @Override
154            public void writeExternal(ObjectOutput objectOutput)
155                    throws IOException {
156                    objectOutput.writeLong(mvccVersion);
157                    objectOutput.writeLong(workflowDefinitionLinkId);
158                    objectOutput.writeLong(groupId);
159                    objectOutput.writeLong(companyId);
160                    objectOutput.writeLong(userId);
161    
162                    if (userName == null) {
163                            objectOutput.writeUTF(StringPool.BLANK);
164                    }
165                    else {
166                            objectOutput.writeUTF(userName);
167                    }
168    
169                    objectOutput.writeLong(createDate);
170                    objectOutput.writeLong(modifiedDate);
171                    objectOutput.writeLong(classNameId);
172                    objectOutput.writeLong(classPK);
173                    objectOutput.writeLong(typePK);
174    
175                    if (workflowDefinitionName == null) {
176                            objectOutput.writeUTF(StringPool.BLANK);
177                    }
178                    else {
179                            objectOutput.writeUTF(workflowDefinitionName);
180                    }
181    
182                    objectOutput.writeInt(workflowDefinitionVersion);
183            }
184    
185            public long mvccVersion;
186            public long workflowDefinitionLinkId;
187            public long groupId;
188            public long companyId;
189            public long userId;
190            public String userName;
191            public long createDate;
192            public long modifiedDate;
193            public long classNameId;
194            public long classPK;
195            public long typePK;
196            public String workflowDefinitionName;
197            public int workflowDefinitionVersion;
198    }