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(21);
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(", delivered=");
055                    sb.append(delivered);
056                    sb.append(", payload=");
057                    sb.append(payload);
058                    sb.append(", archived=");
059                    sb.append(archived);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            @Override
066            public UserNotificationEvent toEntityModel() {
067                    UserNotificationEventImpl userNotificationEventImpl = new UserNotificationEventImpl();
068    
069                    if (uuid == null) {
070                            userNotificationEventImpl.setUuid(StringPool.BLANK);
071                    }
072                    else {
073                            userNotificationEventImpl.setUuid(uuid);
074                    }
075    
076                    userNotificationEventImpl.setUserNotificationEventId(userNotificationEventId);
077                    userNotificationEventImpl.setCompanyId(companyId);
078                    userNotificationEventImpl.setUserId(userId);
079    
080                    if (type == null) {
081                            userNotificationEventImpl.setType(StringPool.BLANK);
082                    }
083                    else {
084                            userNotificationEventImpl.setType(type);
085                    }
086    
087                    userNotificationEventImpl.setTimestamp(timestamp);
088                    userNotificationEventImpl.setDeliverBy(deliverBy);
089                    userNotificationEventImpl.setDelivered(delivered);
090    
091                    if (payload == null) {
092                            userNotificationEventImpl.setPayload(StringPool.BLANK);
093                    }
094                    else {
095                            userNotificationEventImpl.setPayload(payload);
096                    }
097    
098                    userNotificationEventImpl.setArchived(archived);
099    
100                    userNotificationEventImpl.resetOriginalValues();
101    
102                    return userNotificationEventImpl;
103            }
104    
105            @Override
106            public void readExternal(ObjectInput objectInput) throws IOException {
107                    uuid = objectInput.readUTF();
108                    userNotificationEventId = objectInput.readLong();
109                    companyId = objectInput.readLong();
110                    userId = objectInput.readLong();
111                    type = objectInput.readUTF();
112                    timestamp = objectInput.readLong();
113                    deliverBy = objectInput.readLong();
114                    delivered = objectInput.readBoolean();
115                    payload = objectInput.readUTF();
116                    archived = objectInput.readBoolean();
117            }
118    
119            @Override
120            public void writeExternal(ObjectOutput objectOutput)
121                    throws IOException {
122                    if (uuid == null) {
123                            objectOutput.writeUTF(StringPool.BLANK);
124                    }
125                    else {
126                            objectOutput.writeUTF(uuid);
127                    }
128    
129                    objectOutput.writeLong(userNotificationEventId);
130                    objectOutput.writeLong(companyId);
131                    objectOutput.writeLong(userId);
132    
133                    if (type == null) {
134                            objectOutput.writeUTF(StringPool.BLANK);
135                    }
136                    else {
137                            objectOutput.writeUTF(type);
138                    }
139    
140                    objectOutput.writeLong(timestamp);
141                    objectOutput.writeLong(deliverBy);
142                    objectOutput.writeBoolean(delivered);
143    
144                    if (payload == null) {
145                            objectOutput.writeUTF(StringPool.BLANK);
146                    }
147                    else {
148                            objectOutput.writeUTF(payload);
149                    }
150    
151                    objectOutput.writeBoolean(archived);
152            }
153    
154            public String uuid;
155            public long userNotificationEventId;
156            public long companyId;
157            public long userId;
158            public String type;
159            public long timestamp;
160            public long deliverBy;
161            public boolean delivered;
162            public String payload;
163            public boolean archived;
164    }