001    /**
002     * Copyright (c) 2000-2012 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.messageboards.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.model.CacheModel;
019    
020    import com.liferay.portlet.messageboards.model.MBDiscussion;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing MBDiscussion in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see MBDiscussion
032     * @generated
033     */
034    public class MBDiscussionCacheModel implements CacheModel<MBDiscussion>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(9);
039    
040                    sb.append("{discussionId=");
041                    sb.append(discussionId);
042                    sb.append(", classNameId=");
043                    sb.append(classNameId);
044                    sb.append(", classPK=");
045                    sb.append(classPK);
046                    sb.append(", threadId=");
047                    sb.append(threadId);
048                    sb.append("}");
049    
050                    return sb.toString();
051            }
052    
053            public MBDiscussion toEntityModel() {
054                    MBDiscussionImpl mbDiscussionImpl = new MBDiscussionImpl();
055    
056                    mbDiscussionImpl.setDiscussionId(discussionId);
057                    mbDiscussionImpl.setClassNameId(classNameId);
058                    mbDiscussionImpl.setClassPK(classPK);
059                    mbDiscussionImpl.setThreadId(threadId);
060    
061                    mbDiscussionImpl.resetOriginalValues();
062    
063                    return mbDiscussionImpl;
064            }
065    
066            public void readExternal(ObjectInput objectInput) throws IOException {
067                    discussionId = objectInput.readLong();
068                    classNameId = objectInput.readLong();
069                    classPK = objectInput.readLong();
070                    threadId = objectInput.readLong();
071            }
072    
073            public void writeExternal(ObjectOutput objectOutput)
074                    throws IOException {
075                    objectOutput.writeLong(discussionId);
076                    objectOutput.writeLong(classNameId);
077                    objectOutput.writeLong(classPK);
078                    objectOutput.writeLong(threadId);
079            }
080    
081            public long discussionId;
082            public long classNameId;
083            public long classPK;
084            public long threadId;
085    }