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