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.documentlibrary.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.documentlibrary.model.DLContent;
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 DLContent in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see DLContent
035     * @generated
036     */
037    @ProviderType
038    public class DLContentCacheModel implements CacheModel<DLContent>,
039            Externalizable {
040            @Override
041            public String toString() {
042                    StringBundler sb = new StringBundler(15);
043    
044                    sb.append("{contentId=");
045                    sb.append(contentId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", repositoryId=");
051                    sb.append(repositoryId);
052                    sb.append(", path=");
053                    sb.append(path);
054                    sb.append(", version=");
055                    sb.append(version);
056                    sb.append(", size=");
057                    sb.append(size);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            @Override
064            public DLContent toEntityModel() {
065                    DLContentImpl dlContentImpl = new DLContentImpl();
066    
067                    dlContentImpl.setContentId(contentId);
068                    dlContentImpl.setGroupId(groupId);
069                    dlContentImpl.setCompanyId(companyId);
070                    dlContentImpl.setRepositoryId(repositoryId);
071    
072                    if (path == null) {
073                            dlContentImpl.setPath(StringPool.BLANK);
074                    }
075                    else {
076                            dlContentImpl.setPath(path);
077                    }
078    
079                    if (version == null) {
080                            dlContentImpl.setVersion(StringPool.BLANK);
081                    }
082                    else {
083                            dlContentImpl.setVersion(version);
084                    }
085    
086                    dlContentImpl.setSize(size);
087    
088                    dlContentImpl.resetOriginalValues();
089    
090                    return dlContentImpl;
091            }
092    
093            @Override
094            public void readExternal(ObjectInput objectInput) throws IOException {
095                    contentId = objectInput.readLong();
096                    groupId = objectInput.readLong();
097                    companyId = objectInput.readLong();
098                    repositoryId = objectInput.readLong();
099                    path = objectInput.readUTF();
100                    version = objectInput.readUTF();
101                    size = objectInput.readLong();
102            }
103    
104            @Override
105            public void writeExternal(ObjectOutput objectOutput)
106                    throws IOException {
107                    objectOutput.writeLong(contentId);
108                    objectOutput.writeLong(groupId);
109                    objectOutput.writeLong(companyId);
110                    objectOutput.writeLong(repositoryId);
111    
112                    if (path == null) {
113                            objectOutput.writeUTF(StringPool.BLANK);
114                    }
115                    else {
116                            objectOutput.writeUTF(path);
117                    }
118    
119                    if (version == null) {
120                            objectOutput.writeUTF(StringPool.BLANK);
121                    }
122                    else {
123                            objectOutput.writeUTF(version);
124                    }
125    
126                    objectOutput.writeLong(size);
127            }
128    
129            public long contentId;
130            public long groupId;
131            public long companyId;
132            public long repositoryId;
133            public String path;
134            public String version;
135            public long size;
136    }