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.messageboards.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.message.boards.kernel.model.MBMailingList;
020    
021    import com.liferay.portal.kernel.model.CacheModel;
022    import com.liferay.portal.kernel.util.HashUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    import java.util.Date;
032    
033    /**
034     * The cache model class for representing MBMailingList in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see MBMailingList
038     * @generated
039     */
040    @ProviderType
041    public class MBMailingListCacheModel implements CacheModel<MBMailingList>,
042            Externalizable {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof MBMailingListCacheModel)) {
050                            return false;
051                    }
052    
053                    MBMailingListCacheModel mbMailingListCacheModel = (MBMailingListCacheModel)obj;
054    
055                    if (mailingListId == mbMailingListCacheModel.mailingListId) {
056                            return true;
057                    }
058    
059                    return false;
060            }
061    
062            @Override
063            public int hashCode() {
064                    return HashUtil.hash(0, mailingListId);
065            }
066    
067            @Override
068            public String toString() {
069                    StringBundler sb = new StringBundler(53);
070    
071                    sb.append("{uuid=");
072                    sb.append(uuid);
073                    sb.append(", mailingListId=");
074                    sb.append(mailingListId);
075                    sb.append(", groupId=");
076                    sb.append(groupId);
077                    sb.append(", companyId=");
078                    sb.append(companyId);
079                    sb.append(", userId=");
080                    sb.append(userId);
081                    sb.append(", userName=");
082                    sb.append(userName);
083                    sb.append(", createDate=");
084                    sb.append(createDate);
085                    sb.append(", modifiedDate=");
086                    sb.append(modifiedDate);
087                    sb.append(", categoryId=");
088                    sb.append(categoryId);
089                    sb.append(", emailAddress=");
090                    sb.append(emailAddress);
091                    sb.append(", inProtocol=");
092                    sb.append(inProtocol);
093                    sb.append(", inServerName=");
094                    sb.append(inServerName);
095                    sb.append(", inServerPort=");
096                    sb.append(inServerPort);
097                    sb.append(", inUseSSL=");
098                    sb.append(inUseSSL);
099                    sb.append(", inUserName=");
100                    sb.append(inUserName);
101                    sb.append(", inPassword=");
102                    sb.append(inPassword);
103                    sb.append(", inReadInterval=");
104                    sb.append(inReadInterval);
105                    sb.append(", outEmailAddress=");
106                    sb.append(outEmailAddress);
107                    sb.append(", outCustom=");
108                    sb.append(outCustom);
109                    sb.append(", outServerName=");
110                    sb.append(outServerName);
111                    sb.append(", outServerPort=");
112                    sb.append(outServerPort);
113                    sb.append(", outUseSSL=");
114                    sb.append(outUseSSL);
115                    sb.append(", outUserName=");
116                    sb.append(outUserName);
117                    sb.append(", outPassword=");
118                    sb.append(outPassword);
119                    sb.append(", allowAnonymous=");
120                    sb.append(allowAnonymous);
121                    sb.append(", active=");
122                    sb.append(active);
123                    sb.append("}");
124    
125                    return sb.toString();
126            }
127    
128            @Override
129            public MBMailingList toEntityModel() {
130                    MBMailingListImpl mbMailingListImpl = new MBMailingListImpl();
131    
132                    if (uuid == null) {
133                            mbMailingListImpl.setUuid(StringPool.BLANK);
134                    }
135                    else {
136                            mbMailingListImpl.setUuid(uuid);
137                    }
138    
139                    mbMailingListImpl.setMailingListId(mailingListId);
140                    mbMailingListImpl.setGroupId(groupId);
141                    mbMailingListImpl.setCompanyId(companyId);
142                    mbMailingListImpl.setUserId(userId);
143    
144                    if (userName == null) {
145                            mbMailingListImpl.setUserName(StringPool.BLANK);
146                    }
147                    else {
148                            mbMailingListImpl.setUserName(userName);
149                    }
150    
151                    if (createDate == Long.MIN_VALUE) {
152                            mbMailingListImpl.setCreateDate(null);
153                    }
154                    else {
155                            mbMailingListImpl.setCreateDate(new Date(createDate));
156                    }
157    
158                    if (modifiedDate == Long.MIN_VALUE) {
159                            mbMailingListImpl.setModifiedDate(null);
160                    }
161                    else {
162                            mbMailingListImpl.setModifiedDate(new Date(modifiedDate));
163                    }
164    
165                    mbMailingListImpl.setCategoryId(categoryId);
166    
167                    if (emailAddress == null) {
168                            mbMailingListImpl.setEmailAddress(StringPool.BLANK);
169                    }
170                    else {
171                            mbMailingListImpl.setEmailAddress(emailAddress);
172                    }
173    
174                    if (inProtocol == null) {
175                            mbMailingListImpl.setInProtocol(StringPool.BLANK);
176                    }
177                    else {
178                            mbMailingListImpl.setInProtocol(inProtocol);
179                    }
180    
181                    if (inServerName == null) {
182                            mbMailingListImpl.setInServerName(StringPool.BLANK);
183                    }
184                    else {
185                            mbMailingListImpl.setInServerName(inServerName);
186                    }
187    
188                    mbMailingListImpl.setInServerPort(inServerPort);
189                    mbMailingListImpl.setInUseSSL(inUseSSL);
190    
191                    if (inUserName == null) {
192                            mbMailingListImpl.setInUserName(StringPool.BLANK);
193                    }
194                    else {
195                            mbMailingListImpl.setInUserName(inUserName);
196                    }
197    
198                    if (inPassword == null) {
199                            mbMailingListImpl.setInPassword(StringPool.BLANK);
200                    }
201                    else {
202                            mbMailingListImpl.setInPassword(inPassword);
203                    }
204    
205                    mbMailingListImpl.setInReadInterval(inReadInterval);
206    
207                    if (outEmailAddress == null) {
208                            mbMailingListImpl.setOutEmailAddress(StringPool.BLANK);
209                    }
210                    else {
211                            mbMailingListImpl.setOutEmailAddress(outEmailAddress);
212                    }
213    
214                    mbMailingListImpl.setOutCustom(outCustom);
215    
216                    if (outServerName == null) {
217                            mbMailingListImpl.setOutServerName(StringPool.BLANK);
218                    }
219                    else {
220                            mbMailingListImpl.setOutServerName(outServerName);
221                    }
222    
223                    mbMailingListImpl.setOutServerPort(outServerPort);
224                    mbMailingListImpl.setOutUseSSL(outUseSSL);
225    
226                    if (outUserName == null) {
227                            mbMailingListImpl.setOutUserName(StringPool.BLANK);
228                    }
229                    else {
230                            mbMailingListImpl.setOutUserName(outUserName);
231                    }
232    
233                    if (outPassword == null) {
234                            mbMailingListImpl.setOutPassword(StringPool.BLANK);
235                    }
236                    else {
237                            mbMailingListImpl.setOutPassword(outPassword);
238                    }
239    
240                    mbMailingListImpl.setAllowAnonymous(allowAnonymous);
241                    mbMailingListImpl.setActive(active);
242    
243                    mbMailingListImpl.resetOriginalValues();
244    
245                    return mbMailingListImpl;
246            }
247    
248            @Override
249            public void readExternal(ObjectInput objectInput) throws IOException {
250                    uuid = objectInput.readUTF();
251    
252                    mailingListId = objectInput.readLong();
253    
254                    groupId = objectInput.readLong();
255    
256                    companyId = objectInput.readLong();
257    
258                    userId = objectInput.readLong();
259                    userName = objectInput.readUTF();
260                    createDate = objectInput.readLong();
261                    modifiedDate = objectInput.readLong();
262    
263                    categoryId = objectInput.readLong();
264                    emailAddress = objectInput.readUTF();
265                    inProtocol = objectInput.readUTF();
266                    inServerName = objectInput.readUTF();
267    
268                    inServerPort = objectInput.readInt();
269    
270                    inUseSSL = objectInput.readBoolean();
271                    inUserName = objectInput.readUTF();
272                    inPassword = objectInput.readUTF();
273    
274                    inReadInterval = objectInput.readInt();
275                    outEmailAddress = objectInput.readUTF();
276    
277                    outCustom = objectInput.readBoolean();
278                    outServerName = objectInput.readUTF();
279    
280                    outServerPort = objectInput.readInt();
281    
282                    outUseSSL = objectInput.readBoolean();
283                    outUserName = objectInput.readUTF();
284                    outPassword = objectInput.readUTF();
285    
286                    allowAnonymous = objectInput.readBoolean();
287    
288                    active = objectInput.readBoolean();
289            }
290    
291            @Override
292            public void writeExternal(ObjectOutput objectOutput)
293                    throws IOException {
294                    if (uuid == null) {
295                            objectOutput.writeUTF(StringPool.BLANK);
296                    }
297                    else {
298                            objectOutput.writeUTF(uuid);
299                    }
300    
301                    objectOutput.writeLong(mailingListId);
302    
303                    objectOutput.writeLong(groupId);
304    
305                    objectOutput.writeLong(companyId);
306    
307                    objectOutput.writeLong(userId);
308    
309                    if (userName == null) {
310                            objectOutput.writeUTF(StringPool.BLANK);
311                    }
312                    else {
313                            objectOutput.writeUTF(userName);
314                    }
315    
316                    objectOutput.writeLong(createDate);
317                    objectOutput.writeLong(modifiedDate);
318    
319                    objectOutput.writeLong(categoryId);
320    
321                    if (emailAddress == null) {
322                            objectOutput.writeUTF(StringPool.BLANK);
323                    }
324                    else {
325                            objectOutput.writeUTF(emailAddress);
326                    }
327    
328                    if (inProtocol == null) {
329                            objectOutput.writeUTF(StringPool.BLANK);
330                    }
331                    else {
332                            objectOutput.writeUTF(inProtocol);
333                    }
334    
335                    if (inServerName == null) {
336                            objectOutput.writeUTF(StringPool.BLANK);
337                    }
338                    else {
339                            objectOutput.writeUTF(inServerName);
340                    }
341    
342                    objectOutput.writeInt(inServerPort);
343    
344                    objectOutput.writeBoolean(inUseSSL);
345    
346                    if (inUserName == null) {
347                            objectOutput.writeUTF(StringPool.BLANK);
348                    }
349                    else {
350                            objectOutput.writeUTF(inUserName);
351                    }
352    
353                    if (inPassword == null) {
354                            objectOutput.writeUTF(StringPool.BLANK);
355                    }
356                    else {
357                            objectOutput.writeUTF(inPassword);
358                    }
359    
360                    objectOutput.writeInt(inReadInterval);
361    
362                    if (outEmailAddress == null) {
363                            objectOutput.writeUTF(StringPool.BLANK);
364                    }
365                    else {
366                            objectOutput.writeUTF(outEmailAddress);
367                    }
368    
369                    objectOutput.writeBoolean(outCustom);
370    
371                    if (outServerName == null) {
372                            objectOutput.writeUTF(StringPool.BLANK);
373                    }
374                    else {
375                            objectOutput.writeUTF(outServerName);
376                    }
377    
378                    objectOutput.writeInt(outServerPort);
379    
380                    objectOutput.writeBoolean(outUseSSL);
381    
382                    if (outUserName == null) {
383                            objectOutput.writeUTF(StringPool.BLANK);
384                    }
385                    else {
386                            objectOutput.writeUTF(outUserName);
387                    }
388    
389                    if (outPassword == null) {
390                            objectOutput.writeUTF(StringPool.BLANK);
391                    }
392                    else {
393                            objectOutput.writeUTF(outPassword);
394                    }
395    
396                    objectOutput.writeBoolean(allowAnonymous);
397    
398                    objectOutput.writeBoolean(active);
399            }
400    
401            public String uuid;
402            public long mailingListId;
403            public long groupId;
404            public long companyId;
405            public long userId;
406            public String userName;
407            public long createDate;
408            public long modifiedDate;
409            public long categoryId;
410            public String emailAddress;
411            public String inProtocol;
412            public String inServerName;
413            public int inServerPort;
414            public boolean inUseSSL;
415            public String inUserName;
416            public String inPassword;
417            public int inReadInterval;
418            public String outEmailAddress;
419            public boolean outCustom;
420            public String outServerName;
421            public int outServerPort;
422            public boolean outUseSSL;
423            public String outUserName;
424            public String outPassword;
425            public boolean allowAnonymous;
426            public boolean active;
427    }