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