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