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.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.model.CacheModel;
020    import com.liferay.portal.kernel.model.Group;
021    import com.liferay.portal.kernel.model.MVCCModel;
022    import com.liferay.portal.kernel.util.HashUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    /**
032     * The cache model class for representing Group in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see Group
036     * @generated
037     */
038    @ProviderType
039    public class GroupCacheModel implements CacheModel<Group>, Externalizable,
040            MVCCModel {
041            @Override
042            public boolean equals(Object obj) {
043                    if (this == obj) {
044                            return true;
045                    }
046    
047                    if (!(obj instanceof GroupCacheModel)) {
048                            return false;
049                    }
050    
051                    GroupCacheModel groupCacheModel = (GroupCacheModel)obj;
052    
053                    if ((groupId == groupCacheModel.groupId) &&
054                                    (mvccVersion == groupCacheModel.mvccVersion)) {
055                            return true;
056                    }
057    
058                    return false;
059            }
060    
061            @Override
062            public int hashCode() {
063                    int hashCode = HashUtil.hash(0, groupId);
064    
065                    return HashUtil.hash(hashCode, mvccVersion);
066            }
067    
068            @Override
069            public long getMvccVersion() {
070                    return mvccVersion;
071            }
072    
073            @Override
074            public void setMvccVersion(long mvccVersion) {
075                    this.mvccVersion = mvccVersion;
076            }
077    
078            @Override
079            public String toString() {
080                    StringBundler sb = new StringBundler(45);
081    
082                    sb.append("{mvccVersion=");
083                    sb.append(mvccVersion);
084                    sb.append(", uuid=");
085                    sb.append(uuid);
086                    sb.append(", groupId=");
087                    sb.append(groupId);
088                    sb.append(", companyId=");
089                    sb.append(companyId);
090                    sb.append(", creatorUserId=");
091                    sb.append(creatorUserId);
092                    sb.append(", classNameId=");
093                    sb.append(classNameId);
094                    sb.append(", classPK=");
095                    sb.append(classPK);
096                    sb.append(", parentGroupId=");
097                    sb.append(parentGroupId);
098                    sb.append(", liveGroupId=");
099                    sb.append(liveGroupId);
100                    sb.append(", treePath=");
101                    sb.append(treePath);
102                    sb.append(", groupKey=");
103                    sb.append(groupKey);
104                    sb.append(", name=");
105                    sb.append(name);
106                    sb.append(", description=");
107                    sb.append(description);
108                    sb.append(", type=");
109                    sb.append(type);
110                    sb.append(", typeSettings=");
111                    sb.append(typeSettings);
112                    sb.append(", manualMembership=");
113                    sb.append(manualMembership);
114                    sb.append(", membershipRestriction=");
115                    sb.append(membershipRestriction);
116                    sb.append(", friendlyURL=");
117                    sb.append(friendlyURL);
118                    sb.append(", site=");
119                    sb.append(site);
120                    sb.append(", remoteStagingGroupCount=");
121                    sb.append(remoteStagingGroupCount);
122                    sb.append(", inheritContent=");
123                    sb.append(inheritContent);
124                    sb.append(", active=");
125                    sb.append(active);
126                    sb.append("}");
127    
128                    return sb.toString();
129            }
130    
131            @Override
132            public Group toEntityModel() {
133                    GroupImpl groupImpl = new GroupImpl();
134    
135                    groupImpl.setMvccVersion(mvccVersion);
136    
137                    if (uuid == null) {
138                            groupImpl.setUuid(StringPool.BLANK);
139                    }
140                    else {
141                            groupImpl.setUuid(uuid);
142                    }
143    
144                    groupImpl.setGroupId(groupId);
145                    groupImpl.setCompanyId(companyId);
146                    groupImpl.setCreatorUserId(creatorUserId);
147                    groupImpl.setClassNameId(classNameId);
148                    groupImpl.setClassPK(classPK);
149                    groupImpl.setParentGroupId(parentGroupId);
150                    groupImpl.setLiveGroupId(liveGroupId);
151    
152                    if (treePath == null) {
153                            groupImpl.setTreePath(StringPool.BLANK);
154                    }
155                    else {
156                            groupImpl.setTreePath(treePath);
157                    }
158    
159                    if (groupKey == null) {
160                            groupImpl.setGroupKey(StringPool.BLANK);
161                    }
162                    else {
163                            groupImpl.setGroupKey(groupKey);
164                    }
165    
166                    if (name == null) {
167                            groupImpl.setName(StringPool.BLANK);
168                    }
169                    else {
170                            groupImpl.setName(name);
171                    }
172    
173                    if (description == null) {
174                            groupImpl.setDescription(StringPool.BLANK);
175                    }
176                    else {
177                            groupImpl.setDescription(description);
178                    }
179    
180                    groupImpl.setType(type);
181    
182                    if (typeSettings == null) {
183                            groupImpl.setTypeSettings(StringPool.BLANK);
184                    }
185                    else {
186                            groupImpl.setTypeSettings(typeSettings);
187                    }
188    
189                    groupImpl.setManualMembership(manualMembership);
190                    groupImpl.setMembershipRestriction(membershipRestriction);
191    
192                    if (friendlyURL == null) {
193                            groupImpl.setFriendlyURL(StringPool.BLANK);
194                    }
195                    else {
196                            groupImpl.setFriendlyURL(friendlyURL);
197                    }
198    
199                    groupImpl.setSite(site);
200                    groupImpl.setRemoteStagingGroupCount(remoteStagingGroupCount);
201                    groupImpl.setInheritContent(inheritContent);
202                    groupImpl.setActive(active);
203    
204                    groupImpl.resetOriginalValues();
205    
206                    return groupImpl;
207            }
208    
209            @Override
210            public void readExternal(ObjectInput objectInput) throws IOException {
211                    mvccVersion = objectInput.readLong();
212                    uuid = objectInput.readUTF();
213    
214                    groupId = objectInput.readLong();
215    
216                    companyId = objectInput.readLong();
217    
218                    creatorUserId = objectInput.readLong();
219    
220                    classNameId = objectInput.readLong();
221    
222                    classPK = objectInput.readLong();
223    
224                    parentGroupId = objectInput.readLong();
225    
226                    liveGroupId = objectInput.readLong();
227                    treePath = objectInput.readUTF();
228                    groupKey = objectInput.readUTF();
229                    name = objectInput.readUTF();
230                    description = objectInput.readUTF();
231    
232                    type = objectInput.readInt();
233                    typeSettings = objectInput.readUTF();
234    
235                    manualMembership = objectInput.readBoolean();
236    
237                    membershipRestriction = objectInput.readInt();
238                    friendlyURL = objectInput.readUTF();
239    
240                    site = objectInput.readBoolean();
241    
242                    remoteStagingGroupCount = objectInput.readInt();
243    
244                    inheritContent = objectInput.readBoolean();
245    
246                    active = objectInput.readBoolean();
247            }
248    
249            @Override
250            public void writeExternal(ObjectOutput objectOutput)
251                    throws IOException {
252                    objectOutput.writeLong(mvccVersion);
253    
254                    if (uuid == null) {
255                            objectOutput.writeUTF(StringPool.BLANK);
256                    }
257                    else {
258                            objectOutput.writeUTF(uuid);
259                    }
260    
261                    objectOutput.writeLong(groupId);
262    
263                    objectOutput.writeLong(companyId);
264    
265                    objectOutput.writeLong(creatorUserId);
266    
267                    objectOutput.writeLong(classNameId);
268    
269                    objectOutput.writeLong(classPK);
270    
271                    objectOutput.writeLong(parentGroupId);
272    
273                    objectOutput.writeLong(liveGroupId);
274    
275                    if (treePath == null) {
276                            objectOutput.writeUTF(StringPool.BLANK);
277                    }
278                    else {
279                            objectOutput.writeUTF(treePath);
280                    }
281    
282                    if (groupKey == null) {
283                            objectOutput.writeUTF(StringPool.BLANK);
284                    }
285                    else {
286                            objectOutput.writeUTF(groupKey);
287                    }
288    
289                    if (name == null) {
290                            objectOutput.writeUTF(StringPool.BLANK);
291                    }
292                    else {
293                            objectOutput.writeUTF(name);
294                    }
295    
296                    if (description == null) {
297                            objectOutput.writeUTF(StringPool.BLANK);
298                    }
299                    else {
300                            objectOutput.writeUTF(description);
301                    }
302    
303                    objectOutput.writeInt(type);
304    
305                    if (typeSettings == null) {
306                            objectOutput.writeUTF(StringPool.BLANK);
307                    }
308                    else {
309                            objectOutput.writeUTF(typeSettings);
310                    }
311    
312                    objectOutput.writeBoolean(manualMembership);
313    
314                    objectOutput.writeInt(membershipRestriction);
315    
316                    if (friendlyURL == null) {
317                            objectOutput.writeUTF(StringPool.BLANK);
318                    }
319                    else {
320                            objectOutput.writeUTF(friendlyURL);
321                    }
322    
323                    objectOutput.writeBoolean(site);
324    
325                    objectOutput.writeInt(remoteStagingGroupCount);
326    
327                    objectOutput.writeBoolean(inheritContent);
328    
329                    objectOutput.writeBoolean(active);
330            }
331    
332            public long mvccVersion;
333            public String uuid;
334            public long groupId;
335            public long companyId;
336            public long creatorUserId;
337            public long classNameId;
338            public long classPK;
339            public long parentGroupId;
340            public long liveGroupId;
341            public String treePath;
342            public String groupKey;
343            public String name;
344            public String description;
345            public int type;
346            public String typeSettings;
347            public boolean manualMembership;
348            public int membershipRestriction;
349            public String friendlyURL;
350            public boolean site;
351            public int remoteStagingGroupCount;
352            public boolean inheritContent;
353            public boolean active;
354    }