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.trash.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.trash.model.TrashVersion;
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 TrashVersion in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see TrashVersion
033     * @generated
034     */
035    public class TrashVersionCacheModel implements CacheModel<TrashVersion>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(13);
040    
041                    sb.append("{versionId=");
042                    sb.append(versionId);
043                    sb.append(", entryId=");
044                    sb.append(entryId);
045                    sb.append(", classNameId=");
046                    sb.append(classNameId);
047                    sb.append(", classPK=");
048                    sb.append(classPK);
049                    sb.append(", typeSettings=");
050                    sb.append(typeSettings);
051                    sb.append(", status=");
052                    sb.append(status);
053                    sb.append("}");
054    
055                    return sb.toString();
056            }
057    
058            @Override
059            public TrashVersion toEntityModel() {
060                    TrashVersionImpl trashVersionImpl = new TrashVersionImpl();
061    
062                    trashVersionImpl.setVersionId(versionId);
063                    trashVersionImpl.setEntryId(entryId);
064                    trashVersionImpl.setClassNameId(classNameId);
065                    trashVersionImpl.setClassPK(classPK);
066    
067                    if (typeSettings == null) {
068                            trashVersionImpl.setTypeSettings(StringPool.BLANK);
069                    }
070                    else {
071                            trashVersionImpl.setTypeSettings(typeSettings);
072                    }
073    
074                    trashVersionImpl.setStatus(status);
075    
076                    trashVersionImpl.resetOriginalValues();
077    
078                    return trashVersionImpl;
079            }
080    
081            @Override
082            public void readExternal(ObjectInput objectInput) throws IOException {
083                    versionId = objectInput.readLong();
084                    entryId = objectInput.readLong();
085                    classNameId = objectInput.readLong();
086                    classPK = objectInput.readLong();
087                    typeSettings = objectInput.readUTF();
088                    status = objectInput.readInt();
089            }
090    
091            @Override
092            public void writeExternal(ObjectOutput objectOutput)
093                    throws IOException {
094                    objectOutput.writeLong(versionId);
095                    objectOutput.writeLong(entryId);
096                    objectOutput.writeLong(classNameId);
097                    objectOutput.writeLong(classPK);
098    
099                    if (typeSettings == null) {
100                            objectOutput.writeUTF(StringPool.BLANK);
101                    }
102                    else {
103                            objectOutput.writeUTF(typeSettings);
104                    }
105    
106                    objectOutput.writeInt(status);
107            }
108    
109            public long versionId;
110            public long entryId;
111            public long classNameId;
112            public long classPK;
113            public String typeSettings;
114            public int status;
115    }