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            public JournalArticleImage toEntityModel() {
063                    JournalArticleImageImpl journalArticleImageImpl = new JournalArticleImageImpl();
064    
065                    journalArticleImageImpl.setArticleImageId(articleImageId);
066                    journalArticleImageImpl.setGroupId(groupId);
067    
068                    if (articleId == null) {
069                            journalArticleImageImpl.setArticleId(StringPool.BLANK);
070                    }
071                    else {
072                            journalArticleImageImpl.setArticleId(articleId);
073                    }
074    
075                    journalArticleImageImpl.setVersion(version);
076    
077                    if (elInstanceId == null) {
078                            journalArticleImageImpl.setElInstanceId(StringPool.BLANK);
079                    }
080                    else {
081                            journalArticleImageImpl.setElInstanceId(elInstanceId);
082                    }
083    
084                    if (elName == null) {
085                            journalArticleImageImpl.setElName(StringPool.BLANK);
086                    }
087                    else {
088                            journalArticleImageImpl.setElName(elName);
089                    }
090    
091                    if (languageId == null) {
092                            journalArticleImageImpl.setLanguageId(StringPool.BLANK);
093                    }
094                    else {
095                            journalArticleImageImpl.setLanguageId(languageId);
096                    }
097    
098                    journalArticleImageImpl.setTempImage(tempImage);
099    
100                    journalArticleImageImpl.resetOriginalValues();
101    
102                    return journalArticleImageImpl;
103            }
104    
105            public void readExternal(ObjectInput objectInput) throws IOException {
106                    articleImageId = objectInput.readLong();
107                    groupId = objectInput.readLong();
108                    articleId = objectInput.readUTF();
109                    version = objectInput.readDouble();
110                    elInstanceId = objectInput.readUTF();
111                    elName = objectInput.readUTF();
112                    languageId = objectInput.readUTF();
113                    tempImage = objectInput.readBoolean();
114            }
115    
116            public void writeExternal(ObjectOutput objectOutput)
117                    throws IOException {
118                    objectOutput.writeLong(articleImageId);
119                    objectOutput.writeLong(groupId);
120    
121                    if (articleId == null) {
122                            objectOutput.writeUTF(StringPool.BLANK);
123                    }
124                    else {
125                            objectOutput.writeUTF(articleId);
126                    }
127    
128                    objectOutput.writeDouble(version);
129    
130                    if (elInstanceId == null) {
131                            objectOutput.writeUTF(StringPool.BLANK);
132                    }
133                    else {
134                            objectOutput.writeUTF(elInstanceId);
135                    }
136    
137                    if (elName == null) {
138                            objectOutput.writeUTF(StringPool.BLANK);
139                    }
140                    else {
141                            objectOutput.writeUTF(elName);
142                    }
143    
144                    if (languageId == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(languageId);
149                    }
150    
151                    objectOutput.writeBoolean(tempImage);
152            }
153    
154            public long articleImageId;
155            public long groupId;
156            public String articleId;
157            public double version;
158            public String elInstanceId;
159            public String elName;
160            public String languageId;
161            public boolean tempImage;
162    }