001
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
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(11);
068
069 sb.append("{syncEventId=");
070 sb.append(syncEventId);
071 sb.append(", modifiedTime=");
072 sb.append(modifiedTime);
073 sb.append(", event=");
074 sb.append(event);
075 sb.append(", type=");
076 sb.append(type);
077 sb.append(", typePK=");
078 sb.append(typePK);
079 sb.append("}");
080
081 return sb.toString();
082 }
083
084 @Override
085 public DLSyncEvent toEntityModel() {
086 DLSyncEventImpl dlSyncEventImpl = new DLSyncEventImpl();
087
088 dlSyncEventImpl.setSyncEventId(syncEventId);
089 dlSyncEventImpl.setModifiedTime(modifiedTime);
090
091 if (event == null) {
092 dlSyncEventImpl.setEvent(StringPool.BLANK);
093 }
094 else {
095 dlSyncEventImpl.setEvent(event);
096 }
097
098 if (type == null) {
099 dlSyncEventImpl.setType(StringPool.BLANK);
100 }
101 else {
102 dlSyncEventImpl.setType(type);
103 }
104
105 dlSyncEventImpl.setTypePK(typePK);
106
107 dlSyncEventImpl.resetOriginalValues();
108
109 return dlSyncEventImpl;
110 }
111
112 @Override
113 public void readExternal(ObjectInput objectInput) throws IOException {
114 syncEventId = objectInput.readLong();
115 modifiedTime = objectInput.readLong();
116 event = objectInput.readUTF();
117 type = objectInput.readUTF();
118 typePK = objectInput.readLong();
119 }
120
121 @Override
122 public void writeExternal(ObjectOutput objectOutput)
123 throws IOException {
124 objectOutput.writeLong(syncEventId);
125 objectOutput.writeLong(modifiedTime);
126
127 if (event == null) {
128 objectOutput.writeUTF(StringPool.BLANK);
129 }
130 else {
131 objectOutput.writeUTF(event);
132 }
133
134 if (type == null) {
135 objectOutput.writeUTF(StringPool.BLANK);
136 }
137 else {
138 objectOutput.writeUTF(type);
139 }
140
141 objectOutput.writeLong(typePK);
142 }
143
144 public long syncEventId;
145 public long modifiedTime;
146 public String event;
147 public String type;
148 public long typePK;
149 }