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.portlet.journal.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    
021    import com.liferay.portlet.journal.model.JournalArticleImage;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    /**
029     * The cache model class for representing JournalArticleImage in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see JournalArticleImage
033     * @generated
034     */
035    public class JournalArticleImageCacheModel implements CacheModel<JournalArticleImage>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(17);
040    
041                    sb.append("{articleImageId=");
042                    sb.append(articleImageId);
043                    sb.append(", groupId=");
044                    sb.append(groupId);
045                    sb.append(", articleId=");
046                    sb.append(articleId);
047                    sb.append(", version=");
048                    sb.append(version);
049                    sb.append(", elInstanceId=");
050                    sb.append(elInstanceId);
051                    sb.append(", elName=");
052                    sb.append(elName);
053                    sb.append(", languageId=");
054                    sb.append(languageId);
055                    sb.append(", tempImage=");
056                    sb.append(tempImage);
057                    sb.append("}");
058    
059                    return sb.toString();
060            }
061    
062            @Override
063            public JournalArticleImage toEntityModel() {
064                    JournalArticleImageImpl journalArticleImageImpl = new JournalArticleImageImpl();
065    
066                    journalArticleImageImpl.setArticleImageId(articleImageId);
067                    journalArticleImageImpl.setGroupId(groupId);
068    
069                    if (articleId == null) {
070                            journalArticleImageImpl.setArticleId(StringPool.BLANK);
071                    }
072                    else {
073                            journalArticleImageImpl.setArticleId(articleId);
074                    }
075    
076                    journalArticleImageImpl.setVersion(version);
077    
078                    if (elInstanceId == null) {
079                            journalArticleImageImpl.setElInstanceId(StringPool.BLANK);
080                    }
081                    else {
082                            journalArticleImageImpl.setElInstanceId(elInstanceId);
083                    }
084    
085                    if (elName == null) {
086                            journalArticleImageImpl.setElName(StringPool.BLANK);
087                    }
088                    else {
089                            journalArticleImageImpl.setElName(elName);
090                    }
091    
092                    if (languageId == null) {
093                            journalArticleImageImpl.setLanguageId(StringPool.BLANK);
094                    }
095                    else {
096                            journalArticleImageImpl.setLanguageId(languageId);
097                    }
098    
099                    journalArticleImageImpl.setTempImage(tempImage);
100    
101                    journalArticleImageImpl.resetOriginalValues();
102    
103                    return journalArticleImageImpl;
104            }
105    
106            @Override
107            public void readExternal(ObjectInput objectInput) throws IOException {
108                    articleImageId = objectInput.readLong();
109                    groupId = objectInput.readLong();
110                    articleId = objectInput.readUTF();
111                    version = objectInput.readDouble();
112                    elInstanceId = objectInput.readUTF();
113                    elName = objectInput.readUTF();
114                    languageId = objectInput.readUTF();
115                    tempImage = objectInput.readBoolean();
116            }
117    
118            @Override
119            public void writeExternal(ObjectOutput objectOutput)
120                    throws IOException {
121                    objectOutput.writeLong(articleImageId);
122                    objectOutput.writeLong(groupId);
123    
124                    if (articleId == null) {
125                            objectOutput.writeUTF(StringPool.BLANK);
126                    }
127                    else {
128                            objectOutput.writeUTF(articleId);
129                    }
130    
131                    objectOutput.writeDouble(version);
132    
133                    if (elInstanceId == null) {
134                            objectOutput.writeUTF(StringPool.BLANK);
135                    }
136                    else {
137                            objectOutput.writeUTF(elInstanceId);
138                    }
139    
140                    if (elName == null) {
141                            objectOutput.writeUTF(StringPool.BLANK);
142                    }
143                    else {
144                            objectOutput.writeUTF(elName);
145                    }
146    
147                    if (languageId == null) {
148                            objectOutput.writeUTF(StringPool.BLANK);
149                    }
150                    else {
151                            objectOutput.writeUTF(languageId);
152                    }
153    
154                    objectOutput.writeBoolean(tempImage);
155            }
156    
157            public long articleImageId;
158            public long groupId;
159            public String articleId;
160            public double version;
161            public String elInstanceId;
162            public String elName;
163            public String languageId;
164            public boolean tempImage;
165    }