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.portal.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    import com.liferay.portal.model.UserNotificationEvent;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    /**
028     * The cache model class for representing UserNotificationEvent in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see UserNotificationEvent
032     * @generated
033     */
034    public class UserNotificationEventCacheModel implements CacheModel<UserNotificationEvent>,
035            Externalizable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(19);
039    
040                    sb.append("{uuid=");
041                    sb.append(uuid);
042                    sb.append(", userNotificationEventId=");
043                    sb.append(userNotificationEventId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", userId=");
047                    sb.append(userId);
048                    sb.append(", type=");
049                    sb.append(type);
050                    sb.append(", timestamp=");
051                    sb.append(timestamp);
052                    sb.append(", deliverBy=");
053                    sb.append(deliverBy);
054                    sb.append(", payload=");
055                    sb.append(payload);
056                    sb.append(", archived=");
057                    sb.append(archived);
058                    sb.append("}");
059    
060                    return sb.toString();
061            }
062    
063            public UserNotificationEvent toEntityModel() {
064                    UserNotificationEventImpl userNotificationEventImpl = new UserNotificationEventImpl();
065    
066                    if (uuid == null) {
067                            userNotificationEventImpl.setUuid(StringPool.BLANK);
068                    }
069                    else {
070                            userNotificationEventImpl.setUuid(uuid);
071                    }
072    
073                    userNotificationEventImpl.setUserNotificationEventId(userNotificationEventId);
074                    userNotificationEventImpl.setCompanyId(companyId);
075                    userNotificationEventImpl.setUserId(userId);
076    
077                    if (type == null) {
078                            userNotificationEventImpl.setType(StringPool.BLANK);
079                    }
080                    else {
081                            userNotificationEventImpl.setType(type);
082                    }
083    
084                    userNotificationEventImpl.setTimestamp(timestamp);
085                    userNotificationEventImpl.setDeliverBy(deliverBy);
086    
087                    if (payload == null) {
088                            userNotificationEventImpl.setPayload(StringPool.BLANK);
089                    }
090                    else {
091                            userNotificationEventImpl.setPayload(payload);
092                    }
093    
094                    userNotificationEventImpl.setArchived(archived);
095    
096                    userNotificationEventImpl.resetOriginalValues();
097    
098                    return userNotificationEventImpl;
099            }
100    
101            public void readExternal(ObjectInput objectInput) throws IOException {
102                    uuid = objectInput.readUTF();
103                    userNotificationEventId = objectInput.readLong();
104                    companyId = objectInput.readLong();
105                    userId = objectInput.readLong();
106                    type = objectInput.readUTF();
107                    timestamp = objectInput.readLong();
108                    deliverBy = objectInput.readLong();
109                    payload = objectInput.readUTF();
110                    archived = objectInput.readBoolean();
111            }
112    
113            public void writeExternal(ObjectOutput objectOutput)
114                    throws IOException {
115                    if (uuid == null) {
116                            objectOutput.writeUTF(StringPool.BLANK);
117                    }
118                    else {
119                            objectOutput.writeUTF(uuid);
120                    }
121    
122                    objectOutput.writeLong(userNotificationEventId);
123                    objectOutput.writeLong(companyId);
124                    objectOutput.writeLong(userId);
125    
126                    if (type == null) {
127                            objectOutput.writeUTF(StringPool.BLANK);
128                    }
129                    else {
130                            objectOutput.writeUTF(type);
131                    }
132    
133                    objectOutput.writeLong(timestamp);
134                    objectOutput.writeLong(deliverBy);
135    
136                    if (payload == null) {
137                            objectOutput.writeUTF(StringPool.BLANK);
138                    }
139                    else {
140                            objectOutput.writeUTF(payload);
141                    }
142    
143                    objectOutput.writeBoolean(archived);
144            }
145    
146            public String uuid;
147            public long userNotificationEventId;
148            public long companyId;
149            public long userId;
150            public String type;
151            public long timestamp;
152            public long deliverBy;
153            public String payload;
154            public boolean archived;
155    }