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