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