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.model.CacheModel;
022    
023    import com.liferay.portlet.dynamicdatamapping.model.DDMTemplateLink;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    /**
031     * The cache model class for representing DDMTemplateLink in entity cache.
032     *
033     * @author Brian Wing Shun Chan
034     * @see DDMTemplateLink
035     * @generated
036     */
037    @ProviderType
038    public class DDMTemplateLinkCacheModel implements CacheModel<DDMTemplateLink>,
039            Externalizable {
040            @Override
041            public boolean equals(Object obj) {
042                    if (this == obj) {
043                            return true;
044                    }
045    
046                    if (!(obj instanceof DDMTemplateLinkCacheModel)) {
047                            return false;
048                    }
049    
050                    DDMTemplateLinkCacheModel ddmTemplateLinkCacheModel = (DDMTemplateLinkCacheModel)obj;
051    
052                    if (templateLinkId == ddmTemplateLinkCacheModel.templateLinkId) {
053                            return true;
054                    }
055    
056                    return false;
057            }
058    
059            @Override
060            public int hashCode() {
061                    return HashUtil.hash(0, templateLinkId);
062            }
063    
064            @Override
065            public String toString() {
066                    StringBundler sb = new StringBundler(9);
067    
068                    sb.append("{templateLinkId=");
069                    sb.append(templateLinkId);
070                    sb.append(", classNameId=");
071                    sb.append(classNameId);
072                    sb.append(", classPK=");
073                    sb.append(classPK);
074                    sb.append(", templateId=");
075                    sb.append(templateId);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public DDMTemplateLink toEntityModel() {
083                    DDMTemplateLinkImpl ddmTemplateLinkImpl = new DDMTemplateLinkImpl();
084    
085                    ddmTemplateLinkImpl.setTemplateLinkId(templateLinkId);
086                    ddmTemplateLinkImpl.setClassNameId(classNameId);
087                    ddmTemplateLinkImpl.setClassPK(classPK);
088                    ddmTemplateLinkImpl.setTemplateId(templateId);
089    
090                    ddmTemplateLinkImpl.resetOriginalValues();
091    
092                    return ddmTemplateLinkImpl;
093            }
094    
095            @Override
096            public void readExternal(ObjectInput objectInput) throws IOException {
097                    templateLinkId = objectInput.readLong();
098                    classNameId = objectInput.readLong();
099                    classPK = objectInput.readLong();
100                    templateId = objectInput.readLong();
101            }
102    
103            @Override
104            public void writeExternal(ObjectOutput objectOutput)
105                    throws IOException {
106                    objectOutput.writeLong(templateLinkId);
107                    objectOutput.writeLong(classNameId);
108                    objectOutput.writeLong(classPK);
109                    objectOutput.writeLong(templateId);
110            }
111    
112            public long templateLinkId;
113            public long classNameId;
114            public long classPK;
115            public long templateId;
116    }