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.Group;
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 Group in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see Group
032     * @generated
033     */
034    public class GroupCacheModel implements CacheModel<Group>, Externalizable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(33);
038    
039                    sb.append("{uuid=");
040                    sb.append(uuid);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", creatorUserId=");
046                    sb.append(creatorUserId);
047                    sb.append(", classNameId=");
048                    sb.append(classNameId);
049                    sb.append(", classPK=");
050                    sb.append(classPK);
051                    sb.append(", parentGroupId=");
052                    sb.append(parentGroupId);
053                    sb.append(", liveGroupId=");
054                    sb.append(liveGroupId);
055                    sb.append(", treePath=");
056                    sb.append(treePath);
057                    sb.append(", name=");
058                    sb.append(name);
059                    sb.append(", description=");
060                    sb.append(description);
061                    sb.append(", type=");
062                    sb.append(type);
063                    sb.append(", typeSettings=");
064                    sb.append(typeSettings);
065                    sb.append(", friendlyURL=");
066                    sb.append(friendlyURL);
067                    sb.append(", site=");
068                    sb.append(site);
069                    sb.append(", active=");
070                    sb.append(active);
071                    sb.append("}");
072    
073                    return sb.toString();
074            }
075    
076            public Group toEntityModel() {
077                    GroupImpl groupImpl = new GroupImpl();
078    
079                    if (uuid == null) {
080                            groupImpl.setUuid(StringPool.BLANK);
081                    }
082                    else {
083                            groupImpl.setUuid(uuid);
084                    }
085    
086                    groupImpl.setGroupId(groupId);
087                    groupImpl.setCompanyId(companyId);
088                    groupImpl.setCreatorUserId(creatorUserId);
089                    groupImpl.setClassNameId(classNameId);
090                    groupImpl.setClassPK(classPK);
091                    groupImpl.setParentGroupId(parentGroupId);
092                    groupImpl.setLiveGroupId(liveGroupId);
093    
094                    if (treePath == null) {
095                            groupImpl.setTreePath(StringPool.BLANK);
096                    }
097                    else {
098                            groupImpl.setTreePath(treePath);
099                    }
100    
101                    if (name == null) {
102                            groupImpl.setName(StringPool.BLANK);
103                    }
104                    else {
105                            groupImpl.setName(name);
106                    }
107    
108                    if (description == null) {
109                            groupImpl.setDescription(StringPool.BLANK);
110                    }
111                    else {
112                            groupImpl.setDescription(description);
113                    }
114    
115                    groupImpl.setType(type);
116    
117                    if (typeSettings == null) {
118                            groupImpl.setTypeSettings(StringPool.BLANK);
119                    }
120                    else {
121                            groupImpl.setTypeSettings(typeSettings);
122                    }
123    
124                    if (friendlyURL == null) {
125                            groupImpl.setFriendlyURL(StringPool.BLANK);
126                    }
127                    else {
128                            groupImpl.setFriendlyURL(friendlyURL);
129                    }
130    
131                    groupImpl.setSite(site);
132                    groupImpl.setActive(active);
133    
134                    groupImpl.resetOriginalValues();
135    
136                    return groupImpl;
137            }
138    
139            public void readExternal(ObjectInput objectInput) throws IOException {
140                    uuid = objectInput.readUTF();
141                    groupId = objectInput.readLong();
142                    companyId = objectInput.readLong();
143                    creatorUserId = objectInput.readLong();
144                    classNameId = objectInput.readLong();
145                    classPK = objectInput.readLong();
146                    parentGroupId = objectInput.readLong();
147                    liveGroupId = objectInput.readLong();
148                    treePath = objectInput.readUTF();
149                    name = objectInput.readUTF();
150                    description = objectInput.readUTF();
151                    type = objectInput.readInt();
152                    typeSettings = objectInput.readUTF();
153                    friendlyURL = objectInput.readUTF();
154                    site = objectInput.readBoolean();
155                    active = objectInput.readBoolean();
156            }
157    
158            public void writeExternal(ObjectOutput objectOutput)
159                    throws IOException {
160                    if (uuid == null) {
161                            objectOutput.writeUTF(StringPool.BLANK);
162                    }
163                    else {
164                            objectOutput.writeUTF(uuid);
165                    }
166    
167                    objectOutput.writeLong(groupId);
168                    objectOutput.writeLong(companyId);
169                    objectOutput.writeLong(creatorUserId);
170                    objectOutput.writeLong(classNameId);
171                    objectOutput.writeLong(classPK);
172                    objectOutput.writeLong(parentGroupId);
173                    objectOutput.writeLong(liveGroupId);
174    
175                    if (treePath == null) {
176                            objectOutput.writeUTF(StringPool.BLANK);
177                    }
178                    else {
179                            objectOutput.writeUTF(treePath);
180                    }
181    
182                    if (name == null) {
183                            objectOutput.writeUTF(StringPool.BLANK);
184                    }
185                    else {
186                            objectOutput.writeUTF(name);
187                    }
188    
189                    if (description == null) {
190                            objectOutput.writeUTF(StringPool.BLANK);
191                    }
192                    else {
193                            objectOutput.writeUTF(description);
194                    }
195    
196                    objectOutput.writeInt(type);
197    
198                    if (typeSettings == null) {
199                            objectOutput.writeUTF(StringPool.BLANK);
200                    }
201                    else {
202                            objectOutput.writeUTF(typeSettings);
203                    }
204    
205                    if (friendlyURL == null) {
206                            objectOutput.writeUTF(StringPool.BLANK);
207                    }
208                    else {
209                            objectOutput.writeUTF(friendlyURL);
210                    }
211    
212                    objectOutput.writeBoolean(site);
213                    objectOutput.writeBoolean(active);
214            }
215    
216            public String uuid;
217            public long groupId;
218            public long companyId;
219            public long creatorUserId;
220            public long classNameId;
221            public long classPK;
222            public long parentGroupId;
223            public long liveGroupId;
224            public String treePath;
225            public String name;
226            public String description;
227            public int type;
228            public String typeSettings;
229            public String friendlyURL;
230            public boolean site;
231            public boolean active;
232    }