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.WorkflowInstanceLink;
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 WorkflowInstanceLink in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see WorkflowInstanceLink
034     * @generated
035     */
036    public class WorkflowInstanceLinkCacheModel implements CacheModel<WorkflowInstanceLink>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(21);
041    
042                    sb.append("{workflowInstanceLinkId=");
043                    sb.append(workflowInstanceLinkId);
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(", workflowInstanceId=");
061                    sb.append(workflowInstanceId);
062                    sb.append("}");
063    
064                    return sb.toString();
065            }
066    
067            public WorkflowInstanceLink toEntityModel() {
068                    WorkflowInstanceLinkImpl workflowInstanceLinkImpl = new WorkflowInstanceLinkImpl();
069    
070                    workflowInstanceLinkImpl.setWorkflowInstanceLinkId(workflowInstanceLinkId);
071                    workflowInstanceLinkImpl.setGroupId(groupId);
072                    workflowInstanceLinkImpl.setCompanyId(companyId);
073                    workflowInstanceLinkImpl.setUserId(userId);
074    
075                    if (userName == null) {
076                            workflowInstanceLinkImpl.setUserName(StringPool.BLANK);
077                    }
078                    else {
079                            workflowInstanceLinkImpl.setUserName(userName);
080                    }
081    
082                    if (createDate == Long.MIN_VALUE) {
083                            workflowInstanceLinkImpl.setCreateDate(null);
084                    }
085                    else {
086                            workflowInstanceLinkImpl.setCreateDate(new Date(createDate));
087                    }
088    
089                    if (modifiedDate == Long.MIN_VALUE) {
090                            workflowInstanceLinkImpl.setModifiedDate(null);
091                    }
092                    else {
093                            workflowInstanceLinkImpl.setModifiedDate(new Date(modifiedDate));
094                    }
095    
096                    workflowInstanceLinkImpl.setClassNameId(classNameId);
097                    workflowInstanceLinkImpl.setClassPK(classPK);
098                    workflowInstanceLinkImpl.setWorkflowInstanceId(workflowInstanceId);
099    
100                    workflowInstanceLinkImpl.resetOriginalValues();
101    
102                    return workflowInstanceLinkImpl;
103            }
104    
105            public void readExternal(ObjectInput objectInput) throws IOException {
106                    workflowInstanceLinkId = objectInput.readLong();
107                    groupId = objectInput.readLong();
108                    companyId = objectInput.readLong();
109                    userId = objectInput.readLong();
110                    userName = objectInput.readUTF();
111                    createDate = objectInput.readLong();
112                    modifiedDate = objectInput.readLong();
113                    classNameId = objectInput.readLong();
114                    classPK = objectInput.readLong();
115                    workflowInstanceId = objectInput.readLong();
116            }
117    
118            public void writeExternal(ObjectOutput objectOutput)
119                    throws IOException {
120                    objectOutput.writeLong(workflowInstanceLinkId);
121                    objectOutput.writeLong(groupId);
122                    objectOutput.writeLong(companyId);
123                    objectOutput.writeLong(userId);
124    
125                    if (userName == null) {
126                            objectOutput.writeUTF(StringPool.BLANK);
127                    }
128                    else {
129                            objectOutput.writeUTF(userName);
130                    }
131    
132                    objectOutput.writeLong(createDate);
133                    objectOutput.writeLong(modifiedDate);
134                    objectOutput.writeLong(classNameId);
135                    objectOutput.writeLong(classPK);
136                    objectOutput.writeLong(workflowInstanceId);
137            }
138    
139            public long workflowInstanceLinkId;
140            public long groupId;
141            public long companyId;
142            public long userId;
143            public String userName;
144            public long createDate;
145            public long modifiedDate;
146            public long classNameId;
147            public long classPK;
148            public long workflowInstanceId;
149    }