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.DLSyncEvent;
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 DLSyncEvent in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see DLSyncEvent
036     * @generated
037     */
038    @ProviderType
039    public class DLSyncEventCacheModel implements CacheModel<DLSyncEvent>,
040            Externalizable {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof DLSyncEventCacheModel)) {
048                            return false;
049                    }
050    
051                    DLSyncEventCacheModel dlSyncEventCacheModel = (DLSyncEventCacheModel)obj;
052    
053                    if (syncEventId == dlSyncEventCacheModel.syncEventId) {
054                            return true;
055                    }
056    
057                    return false;
058            }
059    
060            @Override
061            public int hashCode() {
062                    return HashUtil.hash(0, syncEventId);
063            }
064    
065            @Override
066            public String toString() {
067                    StringBundler sb = new StringBundler(13);
068    
069                    sb.append("{syncEventId=");
070                    sb.append(syncEventId);
071                    sb.append(", companyId=");
072                    sb.append(companyId);
073                    sb.append(", modifiedTime=");
074                    sb.append(modifiedTime);
075                    sb.append(", event=");
076                    sb.append(event);
077                    sb.append(", type=");
078                    sb.append(type);
079                    sb.append(", typePK=");
080                    sb.append(typePK);
081                    sb.append("}");
082    
083                    return sb.toString();
084            }
085    
086            @Override
087            public DLSyncEvent toEntityModel() {
088                    DLSyncEventImpl dlSyncEventImpl = new DLSyncEventImpl();
089    
090                    dlSyncEventImpl.setSyncEventId(syncEventId);
091                    dlSyncEventImpl.setCompanyId(companyId);
092                    dlSyncEventImpl.setModifiedTime(modifiedTime);
093    
094                    if (event == null) {
095                            dlSyncEventImpl.setEvent(StringPool.BLANK);
096                    }
097                    else {
098                            dlSyncEventImpl.setEvent(event);
099                    }
100    
101                    if (type == null) {
102                            dlSyncEventImpl.setType(StringPool.BLANK);
103                    }
104                    else {
105                            dlSyncEventImpl.setType(type);
106                    }
107    
108                    dlSyncEventImpl.setTypePK(typePK);
109    
110                    dlSyncEventImpl.resetOriginalValues();
111    
112                    return dlSyncEventImpl;
113            }
114    
115            @Override
116            public void readExternal(ObjectInput objectInput) throws IOException {
117                    syncEventId = objectInput.readLong();
118                    companyId = objectInput.readLong();
119                    modifiedTime = objectInput.readLong();
120                    event = objectInput.readUTF();
121                    type = objectInput.readUTF();
122                    typePK = objectInput.readLong();
123            }
124    
125            @Override
126            public void writeExternal(ObjectOutput objectOutput)
127                    throws IOException {
128                    objectOutput.writeLong(syncEventId);
129                    objectOutput.writeLong(companyId);
130                    objectOutput.writeLong(modifiedTime);
131    
132                    if (event == null) {
133                            objectOutput.writeUTF(StringPool.BLANK);
134                    }
135                    else {
136                            objectOutput.writeUTF(event);
137                    }
138    
139                    if (type == null) {
140                            objectOutput.writeUTF(StringPool.BLANK);
141                    }
142                    else {
143                            objectOutput.writeUTF(type);
144                    }
145    
146                    objectOutput.writeLong(typePK);
147            }
148    
149            public long syncEventId;
150            public long companyId;
151            public long modifiedTime;
152            public String event;
153            public String type;
154            public long typePK;
155    }