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            @Override
065            public Release toEntityModel() {
066                    ReleaseImpl releaseImpl = new ReleaseImpl();
067    
068                    releaseImpl.setReleaseId(releaseId);
069    
070                    if (createDate == Long.MIN_VALUE) {
071                            releaseImpl.setCreateDate(null);
072                    }
073                    else {
074                            releaseImpl.setCreateDate(new Date(createDate));
075                    }
076    
077                    if (modifiedDate == Long.MIN_VALUE) {
078                            releaseImpl.setModifiedDate(null);
079                    }
080                    else {
081                            releaseImpl.setModifiedDate(new Date(modifiedDate));
082                    }
083    
084                    if (servletContextName == null) {
085                            releaseImpl.setServletContextName(StringPool.BLANK);
086                    }
087                    else {
088                            releaseImpl.setServletContextName(servletContextName);
089                    }
090    
091                    releaseImpl.setBuildNumber(buildNumber);
092    
093                    if (buildDate == Long.MIN_VALUE) {
094                            releaseImpl.setBuildDate(null);
095                    }
096                    else {
097                            releaseImpl.setBuildDate(new Date(buildDate));
098                    }
099    
100                    releaseImpl.setVerified(verified);
101                    releaseImpl.setState(state);
102    
103                    if (testString == null) {
104                            releaseImpl.setTestString(StringPool.BLANK);
105                    }
106                    else {
107                            releaseImpl.setTestString(testString);
108                    }
109    
110                    releaseImpl.resetOriginalValues();
111    
112                    return releaseImpl;
113            }
114    
115            @Override
116            public void readExternal(ObjectInput objectInput) throws IOException {
117                    releaseId = objectInput.readLong();
118                    createDate = objectInput.readLong();
119                    modifiedDate = objectInput.readLong();
120                    servletContextName = objectInput.readUTF();
121                    buildNumber = objectInput.readInt();
122                    buildDate = objectInput.readLong();
123                    verified = objectInput.readBoolean();
124                    state = objectInput.readInt();
125                    testString = objectInput.readUTF();
126            }
127    
128            @Override
129            public void writeExternal(ObjectOutput objectOutput)
130                    throws IOException {
131                    objectOutput.writeLong(releaseId);
132                    objectOutput.writeLong(createDate);
133                    objectOutput.writeLong(modifiedDate);
134    
135                    if (servletContextName == null) {
136                            objectOutput.writeUTF(StringPool.BLANK);
137                    }
138                    else {
139                            objectOutput.writeUTF(servletContextName);
140                    }
141    
142                    objectOutput.writeInt(buildNumber);
143                    objectOutput.writeLong(buildDate);
144                    objectOutput.writeBoolean(verified);
145                    objectOutput.writeInt(state);
146    
147                    if (testString == null) {
148                            objectOutput.writeUTF(StringPool.BLANK);
149                    }
150                    else {
151                            objectOutput.writeUTF(testString);
152                    }
153            }
154    
155            public long releaseId;
156            public long createDate;
157            public long modifiedDate;
158            public String servletContextName;
159            public int buildNumber;
160            public long buildDate;
161            public boolean verified;
162            public int state;
163            public String testString;
164    }