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.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    
024    import com.liferay.portlet.documentlibrary.model.DLFileEntryMetadata;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing DLFileEntryMetadata in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see DLFileEntryMetadata
036     * @generated
037     */
038    @ProviderType
039    public class DLFileEntryMetadataCacheModel implements CacheModel<DLFileEntryMetadata>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof DLFileEntryMetadataCacheModel)) {
048                            return false;
049                    }
050    
051                    DLFileEntryMetadataCacheModel dlFileEntryMetadataCacheModel = (DLFileEntryMetadataCacheModel)obj;
052    
053                    if (fileEntryMetadataId == dlFileEntryMetadataCacheModel.fileEntryMetadataId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, fileEntryMetadataId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(15);
068    
069                    sb.append("{uuid=");
070                    sb.append(uuid);
071                    sb.append(", fileEntryMetadataId=");
072                    sb.append(fileEntryMetadataId);
073                    sb.append(", companyId=");
074                    sb.append(companyId);
075                    sb.append(", DDMStorageId=");
076                    sb.append(DDMStorageId);
077                    sb.append(", DDMStructureId=");
078                    sb.append(DDMStructureId);
079                    sb.append(", fileEntryId=");
080                    sb.append(fileEntryId);
081                    sb.append(", fileVersionId=");
082                    sb.append(fileVersionId);
083                    sb.append("}");
084    
085                    return sb.toString();
086            }
087    
088            @Override
089            public DLFileEntryMetadata toEntityModel() {
090                    DLFileEntryMetadataImpl dlFileEntryMetadataImpl = new DLFileEntryMetadataImpl();
091    
092                    if (uuid == null) {
093                            dlFileEntryMetadataImpl.setUuid(StringPool.BLANK);
094                    }
095                    else {
096                            dlFileEntryMetadataImpl.setUuid(uuid);
097                    }
098    
099                    dlFileEntryMetadataImpl.setFileEntryMetadataId(fileEntryMetadataId);
100                    dlFileEntryMetadataImpl.setCompanyId(companyId);
101                    dlFileEntryMetadataImpl.setDDMStorageId(DDMStorageId);
102                    dlFileEntryMetadataImpl.setDDMStructureId(DDMStructureId);
103                    dlFileEntryMetadataImpl.setFileEntryId(fileEntryId);
104                    dlFileEntryMetadataImpl.setFileVersionId(fileVersionId);
105    
106                    dlFileEntryMetadataImpl.resetOriginalValues();
107    
108                    return dlFileEntryMetadataImpl;
109            }
110    
111            @Override
112            public void readExternal(ObjectInput objectInput) throws IOException {
113                    uuid = objectInput.readUTF();
114                    fileEntryMetadataId = objectInput.readLong();
115                    companyId = objectInput.readLong();
116                    DDMStorageId = objectInput.readLong();
117                    DDMStructureId = objectInput.readLong();
118                    fileEntryId = objectInput.readLong();
119                    fileVersionId = objectInput.readLong();
120            }
121    
122            @Override
123            public void writeExternal(ObjectOutput objectOutput)
124                    throws IOException {
125                    if (uuid == null) {
126                            objectOutput.writeUTF(StringPool.BLANK);
127                    }
128                    else {
129                            objectOutput.writeUTF(uuid);
130                    }
131    
132                    objectOutput.writeLong(fileEntryMetadataId);
133                    objectOutput.writeLong(companyId);
134                    objectOutput.writeLong(DDMStorageId);
135                    objectOutput.writeLong(DDMStructureId);
136                    objectOutput.writeLong(fileEntryId);
137                    objectOutput.writeLong(fileVersionId);
138            }
139    
140            public String uuid;
141            public long fileEntryMetadataId;
142            public long companyId;
143            public long DDMStorageId;
144            public long DDMStructureId;
145            public long fileEntryId;
146            public long fileVersionId;
147    }