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.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.DLFileEntryMetadata;
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 DLFileEntryMetadata in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see DLFileEntryMetadata
033     * @generated
034     */
035    public class DLFileEntryMetadataCacheModel implements CacheModel<DLFileEntryMetadata>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(15);
040    
041                    sb.append("{uuid=");
042                    sb.append(uuid);
043                    sb.append(", fileEntryMetadataId=");
044                    sb.append(fileEntryMetadataId);
045                    sb.append(", DDMStorageId=");
046                    sb.append(DDMStorageId);
047                    sb.append(", DDMStructureId=");
048                    sb.append(DDMStructureId);
049                    sb.append(", fileEntryTypeId=");
050                    sb.append(fileEntryTypeId);
051                    sb.append(", fileEntryId=");
052                    sb.append(fileEntryId);
053                    sb.append(", fileVersionId=");
054                    sb.append(fileVersionId);
055                    sb.append("}");
056    
057                    return sb.toString();
058            }
059    
060            public DLFileEntryMetadata toEntityModel() {
061                    DLFileEntryMetadataImpl dlFileEntryMetadataImpl = new DLFileEntryMetadataImpl();
062    
063                    if (uuid == null) {
064                            dlFileEntryMetadataImpl.setUuid(StringPool.BLANK);
065                    }
066                    else {
067                            dlFileEntryMetadataImpl.setUuid(uuid);
068                    }
069    
070                    dlFileEntryMetadataImpl.setFileEntryMetadataId(fileEntryMetadataId);
071                    dlFileEntryMetadataImpl.setDDMStorageId(DDMStorageId);
072                    dlFileEntryMetadataImpl.setDDMStructureId(DDMStructureId);
073                    dlFileEntryMetadataImpl.setFileEntryTypeId(fileEntryTypeId);
074                    dlFileEntryMetadataImpl.setFileEntryId(fileEntryId);
075                    dlFileEntryMetadataImpl.setFileVersionId(fileVersionId);
076    
077                    dlFileEntryMetadataImpl.resetOriginalValues();
078    
079                    return dlFileEntryMetadataImpl;
080            }
081    
082            public void readExternal(ObjectInput objectInput) throws IOException {
083                    uuid = objectInput.readUTF();
084                    fileEntryMetadataId = objectInput.readLong();
085                    DDMStorageId = objectInput.readLong();
086                    DDMStructureId = objectInput.readLong();
087                    fileEntryTypeId = objectInput.readLong();
088                    fileEntryId = objectInput.readLong();
089                    fileVersionId = objectInput.readLong();
090            }
091    
092            public void writeExternal(ObjectOutput objectOutput)
093                    throws IOException {
094                    if (uuid == null) {
095                            objectOutput.writeUTF(StringPool.BLANK);
096                    }
097                    else {
098                            objectOutput.writeUTF(uuid);
099                    }
100    
101                    objectOutput.writeLong(fileEntryMetadataId);
102                    objectOutput.writeLong(DDMStorageId);
103                    objectOutput.writeLong(DDMStructureId);
104                    objectOutput.writeLong(fileEntryTypeId);
105                    objectOutput.writeLong(fileEntryId);
106                    objectOutput.writeLong(fileVersionId);
107            }
108    
109            public String uuid;
110            public long fileEntryMetadataId;
111            public long DDMStorageId;
112            public long DDMStructureId;
113            public long fileEntryTypeId;
114            public long fileEntryId;
115            public long fileVersionId;
116    }