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.Release;
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 Release in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see Release
034     * @generated
035     */
036    public class ReleaseCacheModel implements CacheModel<Release>, Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(19);
040    
041                    sb.append("{releaseId=");
042                    sb.append(releaseId);
043                    sb.append(", createDate=");
044                    sb.append(createDate);
045                    sb.append(", modifiedDate=");
046                    sb.append(modifiedDate);
047                    sb.append(", servletContextName=");
048                    sb.append(servletContextName);
049                    sb.append(", buildNumber=");
050                    sb.append(buildNumber);
051                    sb.append(", buildDate=");
052                    sb.append(buildDate);
053                    sb.append(", verified=");
054                    sb.append(verified);
055                    sb.append(", state=");
056                    sb.append(state);
057                    sb.append(", testString=");
058                    sb.append(testString);
059                    sb.append("}");
060    
061                    return sb.toString();
062            }
063    
064            public Release toEntityModel() {
065                    ReleaseImpl releaseImpl = new ReleaseImpl();
066    
067                    releaseImpl.setReleaseId(releaseId);
068    
069                    if (createDate == Long.MIN_VALUE) {
070                            releaseImpl.setCreateDate(null);
071                    }
072                    else {
073                            releaseImpl.setCreateDate(new Date(createDate));
074                    }
075    
076                    if (modifiedDate == Long.MIN_VALUE) {
077                            releaseImpl.setModifiedDate(null);
078                    }
079                    else {
080                            releaseImpl.setModifiedDate(new Date(modifiedDate));
081                    }
082    
083                    if (servletContextName == null) {
084                            releaseImpl.setServletContextName(StringPool.BLANK);
085                    }
086                    else {
087                            releaseImpl.setServletContextName(servletContextName);
088                    }
089    
090                    releaseImpl.setBuildNumber(buildNumber);
091    
092                    if (buildDate == Long.MIN_VALUE) {
093                            releaseImpl.setBuildDate(null);
094                    }
095                    else {
096                            releaseImpl.setBuildDate(new Date(buildDate));
097                    }
098    
099                    releaseImpl.setVerified(verified);
100                    releaseImpl.setState(state);
101    
102                    if (testString == null) {
103                            releaseImpl.setTestString(StringPool.BLANK);
104                    }
105                    else {
106                            releaseImpl.setTestString(testString);
107                    }
108    
109                    releaseImpl.resetOriginalValues();
110    
111                    return releaseImpl;
112            }
113    
114            public void readExternal(ObjectInput objectInput) throws IOException {
115                    releaseId = objectInput.readLong();
116                    createDate = objectInput.readLong();
117                    modifiedDate = objectInput.readLong();
118                    servletContextName = objectInput.readUTF();
119                    buildNumber = objectInput.readInt();
120                    buildDate = objectInput.readLong();
121                    verified = objectInput.readBoolean();
122                    state = objectInput.readInt();
123                    testString = objectInput.readUTF();
124            }
125    
126            public void writeExternal(ObjectOutput objectOutput)
127                    throws IOException {
128                    objectOutput.writeLong(releaseId);
129                    objectOutput.writeLong(createDate);
130                    objectOutput.writeLong(modifiedDate);
131    
132                    if (servletContextName == null) {
133                            objectOutput.writeUTF(StringPool.BLANK);
134                    }
135                    else {
136                            objectOutput.writeUTF(servletContextName);
137                    }
138    
139                    objectOutput.writeInt(buildNumber);
140                    objectOutput.writeLong(buildDate);
141                    objectOutput.writeBoolean(verified);
142                    objectOutput.writeInt(state);
143    
144                    if (testString == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(testString);
149                    }
150            }
151    
152            public long releaseId;
153            public long createDate;
154            public long modifiedDate;
155            public String servletContextName;
156            public int buildNumber;
157            public long buildDate;
158            public boolean verified;
159            public int state;
160            public String testString;
161    }