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.LayoutFriendlyURL;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing LayoutFriendlyURL in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see LayoutFriendlyURL
034     * @generated
035     */
036    public class LayoutFriendlyURLCacheModel implements CacheModel<LayoutFriendlyURL>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(25);
041    
042                    sb.append("{uuid=");
043                    sb.append(uuid);
044                    sb.append(", layoutFriendlyURLId=");
045                    sb.append(layoutFriendlyURLId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", userId=");
051                    sb.append(userId);
052                    sb.append(", userName=");
053                    sb.append(userName);
054                    sb.append(", createDate=");
055                    sb.append(createDate);
056                    sb.append(", modifiedDate=");
057                    sb.append(modifiedDate);
058                    sb.append(", plid=");
059                    sb.append(plid);
060                    sb.append(", privateLayout=");
061                    sb.append(privateLayout);
062                    sb.append(", friendlyURL=");
063                    sb.append(friendlyURL);
064                    sb.append(", languageId=");
065                    sb.append(languageId);
066                    sb.append("}");
067    
068                    return sb.toString();
069            }
070    
071            @Override
072            public LayoutFriendlyURL toEntityModel() {
073                    LayoutFriendlyURLImpl layoutFriendlyURLImpl = new LayoutFriendlyURLImpl();
074    
075                    if (uuid == null) {
076                            layoutFriendlyURLImpl.setUuid(StringPool.BLANK);
077                    }
078                    else {
079                            layoutFriendlyURLImpl.setUuid(uuid);
080                    }
081    
082                    layoutFriendlyURLImpl.setLayoutFriendlyURLId(layoutFriendlyURLId);
083                    layoutFriendlyURLImpl.setGroupId(groupId);
084                    layoutFriendlyURLImpl.setCompanyId(companyId);
085                    layoutFriendlyURLImpl.setUserId(userId);
086    
087                    if (userName == null) {
088                            layoutFriendlyURLImpl.setUserName(StringPool.BLANK);
089                    }
090                    else {
091                            layoutFriendlyURLImpl.setUserName(userName);
092                    }
093    
094                    if (createDate == Long.MIN_VALUE) {
095                            layoutFriendlyURLImpl.setCreateDate(null);
096                    }
097                    else {
098                            layoutFriendlyURLImpl.setCreateDate(new Date(createDate));
099                    }
100    
101                    if (modifiedDate == Long.MIN_VALUE) {
102                            layoutFriendlyURLImpl.setModifiedDate(null);
103                    }
104                    else {
105                            layoutFriendlyURLImpl.setModifiedDate(new Date(modifiedDate));
106                    }
107    
108                    layoutFriendlyURLImpl.setPlid(plid);
109                    layoutFriendlyURLImpl.setPrivateLayout(privateLayout);
110    
111                    if (friendlyURL == null) {
112                            layoutFriendlyURLImpl.setFriendlyURL(StringPool.BLANK);
113                    }
114                    else {
115                            layoutFriendlyURLImpl.setFriendlyURL(friendlyURL);
116                    }
117    
118                    if (languageId == null) {
119                            layoutFriendlyURLImpl.setLanguageId(StringPool.BLANK);
120                    }
121                    else {
122                            layoutFriendlyURLImpl.setLanguageId(languageId);
123                    }
124    
125                    layoutFriendlyURLImpl.resetOriginalValues();
126    
127                    return layoutFriendlyURLImpl;
128            }
129    
130            @Override
131            public void readExternal(ObjectInput objectInput) throws IOException {
132                    uuid = objectInput.readUTF();
133                    layoutFriendlyURLId = objectInput.readLong();
134                    groupId = objectInput.readLong();
135                    companyId = objectInput.readLong();
136                    userId = objectInput.readLong();
137                    userName = objectInput.readUTF();
138                    createDate = objectInput.readLong();
139                    modifiedDate = objectInput.readLong();
140                    plid = objectInput.readLong();
141                    privateLayout = objectInput.readBoolean();
142                    friendlyURL = objectInput.readUTF();
143                    languageId = objectInput.readUTF();
144            }
145    
146            @Override
147            public void writeExternal(ObjectOutput objectOutput)
148                    throws IOException {
149                    if (uuid == null) {
150                            objectOutput.writeUTF(StringPool.BLANK);
151                    }
152                    else {
153                            objectOutput.writeUTF(uuid);
154                    }
155    
156                    objectOutput.writeLong(layoutFriendlyURLId);
157                    objectOutput.writeLong(groupId);
158                    objectOutput.writeLong(companyId);
159                    objectOutput.writeLong(userId);
160    
161                    if (userName == null) {
162                            objectOutput.writeUTF(StringPool.BLANK);
163                    }
164                    else {
165                            objectOutput.writeUTF(userName);
166                    }
167    
168                    objectOutput.writeLong(createDate);
169                    objectOutput.writeLong(modifiedDate);
170                    objectOutput.writeLong(plid);
171                    objectOutput.writeBoolean(privateLayout);
172    
173                    if (friendlyURL == null) {
174                            objectOutput.writeUTF(StringPool.BLANK);
175                    }
176                    else {
177                            objectOutput.writeUTF(friendlyURL);
178                    }
179    
180                    if (languageId == null) {
181                            objectOutput.writeUTF(StringPool.BLANK);
182                    }
183                    else {
184                            objectOutput.writeUTF(languageId);
185                    }
186            }
187    
188            public String uuid;
189            public long layoutFriendlyURLId;
190            public long groupId;
191            public long companyId;
192            public long userId;
193            public String userName;
194            public long createDate;
195            public long modifiedDate;
196            public long plid;
197            public boolean privateLayout;
198            public String friendlyURL;
199            public String languageId;
200    }