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