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.Ticket;
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 Ticket in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see Ticket
037     * @generated
038     */
039    @ProviderType
040    public class TicketCacheModel implements CacheModel<Ticket>, Externalizable,
041            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(21);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", ticketId=");
059                    sb.append(ticketId);
060                    sb.append(", companyId=");
061                    sb.append(companyId);
062                    sb.append(", createDate=");
063                    sb.append(createDate);
064                    sb.append(", classNameId=");
065                    sb.append(classNameId);
066                    sb.append(", classPK=");
067                    sb.append(classPK);
068                    sb.append(", key=");
069                    sb.append(key);
070                    sb.append(", type=");
071                    sb.append(type);
072                    sb.append(", extraInfo=");
073                    sb.append(extraInfo);
074                    sb.append(", expirationDate=");
075                    sb.append(expirationDate);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public Ticket toEntityModel() {
083                    TicketImpl ticketImpl = new TicketImpl();
084    
085                    ticketImpl.setMvccVersion(mvccVersion);
086                    ticketImpl.setTicketId(ticketId);
087                    ticketImpl.setCompanyId(companyId);
088    
089                    if (createDate == Long.MIN_VALUE) {
090                            ticketImpl.setCreateDate(null);
091                    }
092                    else {
093                            ticketImpl.setCreateDate(new Date(createDate));
094                    }
095    
096                    ticketImpl.setClassNameId(classNameId);
097                    ticketImpl.setClassPK(classPK);
098    
099                    if (key == null) {
100                            ticketImpl.setKey(StringPool.BLANK);
101                    }
102                    else {
103                            ticketImpl.setKey(key);
104                    }
105    
106                    ticketImpl.setType(type);
107    
108                    if (extraInfo == null) {
109                            ticketImpl.setExtraInfo(StringPool.BLANK);
110                    }
111                    else {
112                            ticketImpl.setExtraInfo(extraInfo);
113                    }
114    
115                    if (expirationDate == Long.MIN_VALUE) {
116                            ticketImpl.setExpirationDate(null);
117                    }
118                    else {
119                            ticketImpl.setExpirationDate(new Date(expirationDate));
120                    }
121    
122                    ticketImpl.resetOriginalValues();
123    
124                    return ticketImpl;
125            }
126    
127            @Override
128            public void readExternal(ObjectInput objectInput) throws IOException {
129                    mvccVersion = objectInput.readLong();
130                    ticketId = objectInput.readLong();
131                    companyId = objectInput.readLong();
132                    createDate = objectInput.readLong();
133                    classNameId = objectInput.readLong();
134                    classPK = objectInput.readLong();
135                    key = objectInput.readUTF();
136                    type = objectInput.readInt();
137                    extraInfo = objectInput.readUTF();
138                    expirationDate = objectInput.readLong();
139            }
140    
141            @Override
142            public void writeExternal(ObjectOutput objectOutput)
143                    throws IOException {
144                    objectOutput.writeLong(mvccVersion);
145                    objectOutput.writeLong(ticketId);
146                    objectOutput.writeLong(companyId);
147                    objectOutput.writeLong(createDate);
148                    objectOutput.writeLong(classNameId);
149                    objectOutput.writeLong(classPK);
150    
151                    if (key == null) {
152                            objectOutput.writeUTF(StringPool.BLANK);
153                    }
154                    else {
155                            objectOutput.writeUTF(key);
156                    }
157    
158                    objectOutput.writeInt(type);
159    
160                    if (extraInfo == null) {
161                            objectOutput.writeUTF(StringPool.BLANK);
162                    }
163                    else {
164                            objectOutput.writeUTF(extraInfo);
165                    }
166    
167                    objectOutput.writeLong(expirationDate);
168            }
169    
170            public long mvccVersion;
171            public long ticketId;
172            public long companyId;
173            public long createDate;
174            public long classNameId;
175            public long classPK;
176            public String key;
177            public int type;
178            public String extraInfo;
179            public long expirationDate;
180    }