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.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            @Override
061            public DLFileEntryMetadata toEntityModel() {
062                    DLFileEntryMetadataImpl dlFileEntryMetadataImpl = new DLFileEntryMetadataImpl();
063    
064                    if (uuid == null) {
065                            dlFileEntryMetadataImpl.setUuid(StringPool.BLANK);
066                    }
067                    else {
068                            dlFileEntryMetadataImpl.setUuid(uuid);
069                    }
070    
071                    dlFileEntryMetadataImpl.setFileEntryMetadataId(fileEntryMetadataId);
072                    dlFileEntryMetadataImpl.setDDMStorageId(DDMStorageId);
073                    dlFileEntryMetadataImpl.setDDMStructureId(DDMStructureId);
074                    dlFileEntryMetadataImpl.setFileEntryTypeId(fileEntryTypeId);
075                    dlFileEntryMetadataImpl.setFileEntryId(fileEntryId);
076                    dlFileEntryMetadataImpl.setFileVersionId(fileVersionId);
077    
078                    dlFileEntryMetadataImpl.resetOriginalValues();
079    
080                    return dlFileEntryMetadataImpl;
081            }
082    
083            @Override
084            public void readExternal(ObjectInput objectInput) throws IOException {
085                    uuid = objectInput.readUTF();
086                    fileEntryMetadataId = objectInput.readLong();
087                    DDMStorageId = objectInput.readLong();
088                    DDMStructureId = objectInput.readLong();
089                    fileEntryTypeId = objectInput.readLong();
090                    fileEntryId = objectInput.readLong();
091                    fileVersionId = objectInput.readLong();
092            }
093    
094            @Override
095            public void writeExternal(ObjectOutput objectOutput)
096                    throws IOException {
097                    if (uuid == null) {
098                            objectOutput.writeUTF(StringPool.BLANK);
099                    }
100                    else {
101                            objectOutput.writeUTF(uuid);
102                    }
103    
104                    objectOutput.writeLong(fileEntryMetadataId);
105                    objectOutput.writeLong(DDMStorageId);
106                    objectOutput.writeLong(DDMStructureId);
107                    objectOutput.writeLong(fileEntryTypeId);
108                    objectOutput.writeLong(fileEntryId);
109                    objectOutput.writeLong(fileVersionId);
110            }
111    
112            public String uuid;
113            public long fileEntryMetadataId;
114            public long DDMStorageId;
115            public long DDMStructureId;
116            public long fileEntryTypeId;
117            public long fileEntryId;
118            public long fileVersionId;
119    }