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.Release;
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 Release in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see Release
037     * @generated
038     */
039    @ProviderType
040    public class ReleaseCacheModel implements CacheModel<Release>, 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(", releaseId=");
059                    sb.append(releaseId);
060                    sb.append(", createDate=");
061                    sb.append(createDate);
062                    sb.append(", modifiedDate=");
063                    sb.append(modifiedDate);
064                    sb.append(", servletContextName=");
065                    sb.append(servletContextName);
066                    sb.append(", buildNumber=");
067                    sb.append(buildNumber);
068                    sb.append(", buildDate=");
069                    sb.append(buildDate);
070                    sb.append(", verified=");
071                    sb.append(verified);
072                    sb.append(", state=");
073                    sb.append(state);
074                    sb.append(", testString=");
075                    sb.append(testString);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public Release toEntityModel() {
083                    ReleaseImpl releaseImpl = new ReleaseImpl();
084    
085                    releaseImpl.setMvccVersion(mvccVersion);
086                    releaseImpl.setReleaseId(releaseId);
087    
088                    if (createDate == Long.MIN_VALUE) {
089                            releaseImpl.setCreateDate(null);
090                    }
091                    else {
092                            releaseImpl.setCreateDate(new Date(createDate));
093                    }
094    
095                    if (modifiedDate == Long.MIN_VALUE) {
096                            releaseImpl.setModifiedDate(null);
097                    }
098                    else {
099                            releaseImpl.setModifiedDate(new Date(modifiedDate));
100                    }
101    
102                    if (servletContextName == null) {
103                            releaseImpl.setServletContextName(StringPool.BLANK);
104                    }
105                    else {
106                            releaseImpl.setServletContextName(servletContextName);
107                    }
108    
109                    releaseImpl.setBuildNumber(buildNumber);
110    
111                    if (buildDate == Long.MIN_VALUE) {
112                            releaseImpl.setBuildDate(null);
113                    }
114                    else {
115                            releaseImpl.setBuildDate(new Date(buildDate));
116                    }
117    
118                    releaseImpl.setVerified(verified);
119                    releaseImpl.setState(state);
120    
121                    if (testString == null) {
122                            releaseImpl.setTestString(StringPool.BLANK);
123                    }
124                    else {
125                            releaseImpl.setTestString(testString);
126                    }
127    
128                    releaseImpl.resetOriginalValues();
129    
130                    return releaseImpl;
131            }
132    
133            @Override
134            public void readExternal(ObjectInput objectInput) throws IOException {
135                    mvccVersion = objectInput.readLong();
136                    releaseId = objectInput.readLong();
137                    createDate = objectInput.readLong();
138                    modifiedDate = objectInput.readLong();
139                    servletContextName = objectInput.readUTF();
140                    buildNumber = objectInput.readInt();
141                    buildDate = objectInput.readLong();
142                    verified = objectInput.readBoolean();
143                    state = objectInput.readInt();
144                    testString = objectInput.readUTF();
145            }
146    
147            @Override
148            public void writeExternal(ObjectOutput objectOutput)
149                    throws IOException {
150                    objectOutput.writeLong(mvccVersion);
151                    objectOutput.writeLong(releaseId);
152                    objectOutput.writeLong(createDate);
153                    objectOutput.writeLong(modifiedDate);
154    
155                    if (servletContextName == null) {
156                            objectOutput.writeUTF(StringPool.BLANK);
157                    }
158                    else {
159                            objectOutput.writeUTF(servletContextName);
160                    }
161    
162                    objectOutput.writeInt(buildNumber);
163                    objectOutput.writeLong(buildDate);
164                    objectOutput.writeBoolean(verified);
165                    objectOutput.writeInt(state);
166    
167                    if (testString == null) {
168                            objectOutput.writeUTF(StringPool.BLANK);
169                    }
170                    else {
171                            objectOutput.writeUTF(testString);
172                    }
173            }
174    
175            public long mvccVersion;
176            public long releaseId;
177            public long createDate;
178            public long modifiedDate;
179            public String servletContextName;
180            public int buildNumber;
181            public long buildDate;
182            public boolean verified;
183            public int state;
184            public String testString;
185    }