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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.MVCCModel;
024    import com.liferay.portal.model.Release;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    import java.util.Date;
032    
033    /**
034     * The cache model class for representing Release in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see Release
038     * @generated
039     */
040    @ProviderType
041    public class ReleaseCacheModel implements CacheModel<Release>, Externalizable,
042            MVCCModel {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof ReleaseCacheModel)) {
050                            return false;
051                    }
052    
053                    ReleaseCacheModel releaseCacheModel = (ReleaseCacheModel)obj;
054    
055                    if ((releaseId == releaseCacheModel.releaseId) &&
056                                    (mvccVersion == releaseCacheModel.mvccVersion)) {
057                            return true;
058                    }
059    
060                    return false;
061            }
062    
063            @Override
064            public int hashCode() {
065                    int hashCode = HashUtil.hash(0, releaseId);
066    
067                    return HashUtil.hash(hashCode, mvccVersion);
068            }
069    
070            @Override
071            public long getMvccVersion() {
072                    return mvccVersion;
073            }
074    
075            @Override
076            public void setMvccVersion(long mvccVersion) {
077                    this.mvccVersion = mvccVersion;
078            }
079    
080            @Override
081            public String toString() {
082                    StringBundler sb = new StringBundler(21);
083    
084                    sb.append("{mvccVersion=");
085                    sb.append(mvccVersion);
086                    sb.append(", releaseId=");
087                    sb.append(releaseId);
088                    sb.append(", createDate=");
089                    sb.append(createDate);
090                    sb.append(", modifiedDate=");
091                    sb.append(modifiedDate);
092                    sb.append(", servletContextName=");
093                    sb.append(servletContextName);
094                    sb.append(", buildNumber=");
095                    sb.append(buildNumber);
096                    sb.append(", buildDate=");
097                    sb.append(buildDate);
098                    sb.append(", verified=");
099                    sb.append(verified);
100                    sb.append(", state=");
101                    sb.append(state);
102                    sb.append(", testString=");
103                    sb.append(testString);
104                    sb.append("}");
105    
106                    return sb.toString();
107            }
108    
109            @Override
110            public Release toEntityModel() {
111                    ReleaseImpl releaseImpl = new ReleaseImpl();
112    
113                    releaseImpl.setMvccVersion(mvccVersion);
114                    releaseImpl.setReleaseId(releaseId);
115    
116                    if (createDate == Long.MIN_VALUE) {
117                            releaseImpl.setCreateDate(null);
118                    }
119                    else {
120                            releaseImpl.setCreateDate(new Date(createDate));
121                    }
122    
123                    if (modifiedDate == Long.MIN_VALUE) {
124                            releaseImpl.setModifiedDate(null);
125                    }
126                    else {
127                            releaseImpl.setModifiedDate(new Date(modifiedDate));
128                    }
129    
130                    if (servletContextName == null) {
131                            releaseImpl.setServletContextName(StringPool.BLANK);
132                    }
133                    else {
134                            releaseImpl.setServletContextName(servletContextName);
135                    }
136    
137                    releaseImpl.setBuildNumber(buildNumber);
138    
139                    if (buildDate == Long.MIN_VALUE) {
140                            releaseImpl.setBuildDate(null);
141                    }
142                    else {
143                            releaseImpl.setBuildDate(new Date(buildDate));
144                    }
145    
146                    releaseImpl.setVerified(verified);
147                    releaseImpl.setState(state);
148    
149                    if (testString == null) {
150                            releaseImpl.setTestString(StringPool.BLANK);
151                    }
152                    else {
153                            releaseImpl.setTestString(testString);
154                    }
155    
156                    releaseImpl.resetOriginalValues();
157    
158                    return releaseImpl;
159            }
160    
161            @Override
162            public void readExternal(ObjectInput objectInput) throws IOException {
163                    mvccVersion = objectInput.readLong();
164                    releaseId = objectInput.readLong();
165                    createDate = objectInput.readLong();
166                    modifiedDate = objectInput.readLong();
167                    servletContextName = objectInput.readUTF();
168                    buildNumber = objectInput.readInt();
169                    buildDate = objectInput.readLong();
170                    verified = objectInput.readBoolean();
171                    state = objectInput.readInt();
172                    testString = objectInput.readUTF();
173            }
174    
175            @Override
176            public void writeExternal(ObjectOutput objectOutput)
177                    throws IOException {
178                    objectOutput.writeLong(mvccVersion);
179                    objectOutput.writeLong(releaseId);
180                    objectOutput.writeLong(createDate);
181                    objectOutput.writeLong(modifiedDate);
182    
183                    if (servletContextName == null) {
184                            objectOutput.writeUTF(StringPool.BLANK);
185                    }
186                    else {
187                            objectOutput.writeUTF(servletContextName);
188                    }
189    
190                    objectOutput.writeInt(buildNumber);
191                    objectOutput.writeLong(buildDate);
192                    objectOutput.writeBoolean(verified);
193                    objectOutput.writeInt(state);
194    
195                    if (testString == null) {
196                            objectOutput.writeUTF(StringPool.BLANK);
197                    }
198                    else {
199                            objectOutput.writeUTF(testString);
200                    }
201            }
202    
203            public long mvccVersion;
204            public long releaseId;
205            public long createDate;
206            public long modifiedDate;
207            public String servletContextName;
208            public int buildNumber;
209            public long buildDate;
210            public boolean verified;
211            public int state;
212            public String testString;
213    }