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.mobiledevicerules.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    
023    import com.liferay.portlet.mobiledevicerules.model.MDRAction;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing MDRAction in entity cache.
034     *
035     * @author Edward C. Han
036     * @see MDRAction
037     * @generated
038     */
039    @ProviderType
040    public class MDRActionCacheModel implements CacheModel<MDRAction>,
041            Externalizable {
042            @Override
043            public String toString() {
044                    StringBundler sb = new StringBundler(31);
045    
046                    sb.append("{uuid=");
047                    sb.append(uuid);
048                    sb.append(", actionId=");
049                    sb.append(actionId);
050                    sb.append(", groupId=");
051                    sb.append(groupId);
052                    sb.append(", companyId=");
053                    sb.append(companyId);
054                    sb.append(", userId=");
055                    sb.append(userId);
056                    sb.append(", userName=");
057                    sb.append(userName);
058                    sb.append(", createDate=");
059                    sb.append(createDate);
060                    sb.append(", modifiedDate=");
061                    sb.append(modifiedDate);
062                    sb.append(", classNameId=");
063                    sb.append(classNameId);
064                    sb.append(", classPK=");
065                    sb.append(classPK);
066                    sb.append(", ruleGroupInstanceId=");
067                    sb.append(ruleGroupInstanceId);
068                    sb.append(", name=");
069                    sb.append(name);
070                    sb.append(", description=");
071                    sb.append(description);
072                    sb.append(", type=");
073                    sb.append(type);
074                    sb.append(", typeSettings=");
075                    sb.append(typeSettings);
076                    sb.append("}");
077    
078                    return sb.toString();
079            }
080    
081            @Override
082            public MDRAction toEntityModel() {
083                    MDRActionImpl mdrActionImpl = new MDRActionImpl();
084    
085                    if (uuid == null) {
086                            mdrActionImpl.setUuid(StringPool.BLANK);
087                    }
088                    else {
089                            mdrActionImpl.setUuid(uuid);
090                    }
091    
092                    mdrActionImpl.setActionId(actionId);
093                    mdrActionImpl.setGroupId(groupId);
094                    mdrActionImpl.setCompanyId(companyId);
095                    mdrActionImpl.setUserId(userId);
096    
097                    if (userName == null) {
098                            mdrActionImpl.setUserName(StringPool.BLANK);
099                    }
100                    else {
101                            mdrActionImpl.setUserName(userName);
102                    }
103    
104                    if (createDate == Long.MIN_VALUE) {
105                            mdrActionImpl.setCreateDate(null);
106                    }
107                    else {
108                            mdrActionImpl.setCreateDate(new Date(createDate));
109                    }
110    
111                    if (modifiedDate == Long.MIN_VALUE) {
112                            mdrActionImpl.setModifiedDate(null);
113                    }
114                    else {
115                            mdrActionImpl.setModifiedDate(new Date(modifiedDate));
116                    }
117    
118                    mdrActionImpl.setClassNameId(classNameId);
119                    mdrActionImpl.setClassPK(classPK);
120                    mdrActionImpl.setRuleGroupInstanceId(ruleGroupInstanceId);
121    
122                    if (name == null) {
123                            mdrActionImpl.setName(StringPool.BLANK);
124                    }
125                    else {
126                            mdrActionImpl.setName(name);
127                    }
128    
129                    if (description == null) {
130                            mdrActionImpl.setDescription(StringPool.BLANK);
131                    }
132                    else {
133                            mdrActionImpl.setDescription(description);
134                    }
135    
136                    if (type == null) {
137                            mdrActionImpl.setType(StringPool.BLANK);
138                    }
139                    else {
140                            mdrActionImpl.setType(type);
141                    }
142    
143                    if (typeSettings == null) {
144                            mdrActionImpl.setTypeSettings(StringPool.BLANK);
145                    }
146                    else {
147                            mdrActionImpl.setTypeSettings(typeSettings);
148                    }
149    
150                    mdrActionImpl.resetOriginalValues();
151    
152                    return mdrActionImpl;
153            }
154    
155            @Override
156            public void readExternal(ObjectInput objectInput) throws IOException {
157                    uuid = objectInput.readUTF();
158                    actionId = objectInput.readLong();
159                    groupId = objectInput.readLong();
160                    companyId = objectInput.readLong();
161                    userId = objectInput.readLong();
162                    userName = objectInput.readUTF();
163                    createDate = objectInput.readLong();
164                    modifiedDate = objectInput.readLong();
165                    classNameId = objectInput.readLong();
166                    classPK = objectInput.readLong();
167                    ruleGroupInstanceId = objectInput.readLong();
168                    name = objectInput.readUTF();
169                    description = objectInput.readUTF();
170                    type = objectInput.readUTF();
171                    typeSettings = objectInput.readUTF();
172            }
173    
174            @Override
175            public void writeExternal(ObjectOutput objectOutput)
176                    throws IOException {
177                    if (uuid == null) {
178                            objectOutput.writeUTF(StringPool.BLANK);
179                    }
180                    else {
181                            objectOutput.writeUTF(uuid);
182                    }
183    
184                    objectOutput.writeLong(actionId);
185                    objectOutput.writeLong(groupId);
186                    objectOutput.writeLong(companyId);
187                    objectOutput.writeLong(userId);
188    
189                    if (userName == null) {
190                            objectOutput.writeUTF(StringPool.BLANK);
191                    }
192                    else {
193                            objectOutput.writeUTF(userName);
194                    }
195    
196                    objectOutput.writeLong(createDate);
197                    objectOutput.writeLong(modifiedDate);
198                    objectOutput.writeLong(classNameId);
199                    objectOutput.writeLong(classPK);
200                    objectOutput.writeLong(ruleGroupInstanceId);
201    
202                    if (name == null) {
203                            objectOutput.writeUTF(StringPool.BLANK);
204                    }
205                    else {
206                            objectOutput.writeUTF(name);
207                    }
208    
209                    if (description == null) {
210                            objectOutput.writeUTF(StringPool.BLANK);
211                    }
212                    else {
213                            objectOutput.writeUTF(description);
214                    }
215    
216                    if (type == null) {
217                            objectOutput.writeUTF(StringPool.BLANK);
218                    }
219                    else {
220                            objectOutput.writeUTF(type);
221                    }
222    
223                    if (typeSettings == null) {
224                            objectOutput.writeUTF(StringPool.BLANK);
225                    }
226                    else {
227                            objectOutput.writeUTF(typeSettings);
228                    }
229            }
230    
231            public String uuid;
232            public long actionId;
233            public long groupId;
234            public long companyId;
235            public long userId;
236            public String userName;
237            public long createDate;
238            public long modifiedDate;
239            public long classNameId;
240            public long classPK;
241            public long ruleGroupInstanceId;
242            public String name;
243            public String description;
244            public String type;
245            public String typeSettings;
246    }