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            @Override
068            public WorkflowInstanceLink toEntityModel() {
069                    WorkflowInstanceLinkImpl workflowInstanceLinkImpl = new WorkflowInstanceLinkImpl();
070    
071                    workflowInstanceLinkImpl.setWorkflowInstanceLinkId(workflowInstanceLinkId);
072                    workflowInstanceLinkImpl.setGroupId(groupId);
073                    workflowInstanceLinkImpl.setCompanyId(companyId);
074                    workflowInstanceLinkImpl.setUserId(userId);
075    
076                    if (userName == null) {
077                            workflowInstanceLinkImpl.setUserName(StringPool.BLANK);
078                    }
079                    else {
080                            workflowInstanceLinkImpl.setUserName(userName);
081                    }
082    
083                    if (createDate == Long.MIN_VALUE) {
084                            workflowInstanceLinkImpl.setCreateDate(null);
085                    }
086                    else {
087                            workflowInstanceLinkImpl.setCreateDate(new Date(createDate));
088                    }
089    
090                    if (modifiedDate == Long.MIN_VALUE) {
091                            workflowInstanceLinkImpl.setModifiedDate(null);
092                    }
093                    else {
094                            workflowInstanceLinkImpl.setModifiedDate(new Date(modifiedDate));
095                    }
096    
097                    workflowInstanceLinkImpl.setClassNameId(classNameId);
098                    workflowInstanceLinkImpl.setClassPK(classPK);
099                    workflowInstanceLinkImpl.setWorkflowInstanceId(workflowInstanceId);
100    
101                    workflowInstanceLinkImpl.resetOriginalValues();
102    
103                    return workflowInstanceLinkImpl;
104            }
105    
106            @Override
107            public void readExternal(ObjectInput objectInput) throws IOException {
108                    workflowInstanceLinkId = objectInput.readLong();
109                    groupId = objectInput.readLong();
110                    companyId = objectInput.readLong();
111                    userId = objectInput.readLong();
112                    userName = objectInput.readUTF();
113                    createDate = objectInput.readLong();
114                    modifiedDate = objectInput.readLong();
115                    classNameId = objectInput.readLong();
116                    classPK = objectInput.readLong();
117                    workflowInstanceId = objectInput.readLong();
118            }
119    
120            @Override
121            public void writeExternal(ObjectOutput objectOutput)
122                    throws IOException {
123                    objectOutput.writeLong(workflowInstanceLinkId);
124                    objectOutput.writeLong(groupId);
125                    objectOutput.writeLong(companyId);
126                    objectOutput.writeLong(userId);
127    
128                    if (userName == null) {
129                            objectOutput.writeUTF(StringPool.BLANK);
130                    }
131                    else {
132                            objectOutput.writeUTF(userName);
133                    }
134    
135                    objectOutput.writeLong(createDate);
136                    objectOutput.writeLong(modifiedDate);
137                    objectOutput.writeLong(classNameId);
138                    objectOutput.writeLong(classPK);
139                    objectOutput.writeLong(workflowInstanceId);
140            }
141    
142            public long workflowInstanceLinkId;
143            public long groupId;
144            public long companyId;
145            public long userId;
146            public String userName;
147            public long createDate;
148            public long modifiedDate;
149            public long classNameId;
150            public long classPK;
151            public long workflowInstanceId;
152    }