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.dynamicdatamapping.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.dynamicdatamapping.model.DDMStorageLink;
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 DDMStorageLink in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see DDMStorageLink
036     * @generated
037     */
038    @ProviderType
039    public class DDMStorageLinkCacheModel implements CacheModel<DDMStorageLink>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof DDMStorageLinkCacheModel)) {
048                            return false;
049                    }
050    
051                    DDMStorageLinkCacheModel ddmStorageLinkCacheModel = (DDMStorageLinkCacheModel)obj;
052    
053                    if (storageLinkId == ddmStorageLinkCacheModel.storageLinkId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, storageLinkId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(11);
068    
069                    sb.append("{uuid=");
070                    sb.append(uuid);
071                    sb.append(", storageLinkId=");
072                    sb.append(storageLinkId);
073                    sb.append(", classNameId=");
074                    sb.append(classNameId);
075                    sb.append(", classPK=");
076                    sb.append(classPK);
077                    sb.append(", structureId=");
078                    sb.append(structureId);
079                    sb.append("}");
080    
081                    return sb.toString();
082            }
083    
084            @Override
085            public DDMStorageLink toEntityModel() {
086                    DDMStorageLinkImpl ddmStorageLinkImpl = new DDMStorageLinkImpl();
087    
088                    if (uuid == null) {
089                            ddmStorageLinkImpl.setUuid(StringPool.BLANK);
090                    }
091                    else {
092                            ddmStorageLinkImpl.setUuid(uuid);
093                    }
094    
095                    ddmStorageLinkImpl.setStorageLinkId(storageLinkId);
096                    ddmStorageLinkImpl.setClassNameId(classNameId);
097                    ddmStorageLinkImpl.setClassPK(classPK);
098                    ddmStorageLinkImpl.setStructureId(structureId);
099    
100                    ddmStorageLinkImpl.resetOriginalValues();
101    
102                    return ddmStorageLinkImpl;
103            }
104    
105            @Override
106            public void readExternal(ObjectInput objectInput) throws IOException {
107                    uuid = objectInput.readUTF();
108                    storageLinkId = objectInput.readLong();
109                    classNameId = objectInput.readLong();
110                    classPK = objectInput.readLong();
111                    structureId = objectInput.readLong();
112            }
113    
114            @Override
115            public void writeExternal(ObjectOutput objectOutput)
116                    throws IOException {
117                    if (uuid == null) {
118                            objectOutput.writeUTF(StringPool.BLANK);
119                    }
120                    else {
121                            objectOutput.writeUTF(uuid);
122                    }
123    
124                    objectOutput.writeLong(storageLinkId);
125                    objectOutput.writeLong(classNameId);
126                    objectOutput.writeLong(classPK);
127                    objectOutput.writeLong(structureId);
128            }
129    
130            public String uuid;
131            public long storageLinkId;
132            public long classNameId;
133            public long classPK;
134            public long structureId;
135    }