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.util.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.Group;
024    import com.liferay.portal.model.MVCCModel;
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                    groupId = objectInput.readLong();
214                    companyId = objectInput.readLong();
215                    creatorUserId = objectInput.readLong();
216                    classNameId = objectInput.readLong();
217                    classPK = objectInput.readLong();
218                    parentGroupId = objectInput.readLong();
219                    liveGroupId = objectInput.readLong();
220                    treePath = objectInput.readUTF();
221                    groupKey = objectInput.readUTF();
222                    name = objectInput.readUTF();
223                    description = objectInput.readUTF();
224                    type = objectInput.readInt();
225                    typeSettings = objectInput.readUTF();
226                    manualMembership = objectInput.readBoolean();
227                    membershipRestriction = objectInput.readInt();
228                    friendlyURL = objectInput.readUTF();
229                    site = objectInput.readBoolean();
230                    remoteStagingGroupCount = objectInput.readInt();
231                    inheritContent = objectInput.readBoolean();
232                    active = objectInput.readBoolean();
233            }
234    
235            @Override
236            public void writeExternal(ObjectOutput objectOutput)
237                    throws IOException {
238                    objectOutput.writeLong(mvccVersion);
239    
240                    if (uuid == null) {
241                            objectOutput.writeUTF(StringPool.BLANK);
242                    }
243                    else {
244                            objectOutput.writeUTF(uuid);
245                    }
246    
247                    objectOutput.writeLong(groupId);
248                    objectOutput.writeLong(companyId);
249                    objectOutput.writeLong(creatorUserId);
250                    objectOutput.writeLong(classNameId);
251                    objectOutput.writeLong(classPK);
252                    objectOutput.writeLong(parentGroupId);
253                    objectOutput.writeLong(liveGroupId);
254    
255                    if (treePath == null) {
256                            objectOutput.writeUTF(StringPool.BLANK);
257                    }
258                    else {
259                            objectOutput.writeUTF(treePath);
260                    }
261    
262                    if (groupKey == null) {
263                            objectOutput.writeUTF(StringPool.BLANK);
264                    }
265                    else {
266                            objectOutput.writeUTF(groupKey);
267                    }
268    
269                    if (name == null) {
270                            objectOutput.writeUTF(StringPool.BLANK);
271                    }
272                    else {
273                            objectOutput.writeUTF(name);
274                    }
275    
276                    if (description == null) {
277                            objectOutput.writeUTF(StringPool.BLANK);
278                    }
279                    else {
280                            objectOutput.writeUTF(description);
281                    }
282    
283                    objectOutput.writeInt(type);
284    
285                    if (typeSettings == null) {
286                            objectOutput.writeUTF(StringPool.BLANK);
287                    }
288                    else {
289                            objectOutput.writeUTF(typeSettings);
290                    }
291    
292                    objectOutput.writeBoolean(manualMembership);
293                    objectOutput.writeInt(membershipRestriction);
294    
295                    if (friendlyURL == null) {
296                            objectOutput.writeUTF(StringPool.BLANK);
297                    }
298                    else {
299                            objectOutput.writeUTF(friendlyURL);
300                    }
301    
302                    objectOutput.writeBoolean(site);
303                    objectOutput.writeInt(remoteStagingGroupCount);
304                    objectOutput.writeBoolean(inheritContent);
305                    objectOutput.writeBoolean(active);
306            }
307    
308            public long mvccVersion;
309            public String uuid;
310            public long groupId;
311            public long companyId;
312            public long creatorUserId;
313            public long classNameId;
314            public long classPK;
315            public long parentGroupId;
316            public long liveGroupId;
317            public String treePath;
318            public String groupKey;
319            public String name;
320            public String description;
321            public int type;
322            public String typeSettings;
323            public boolean manualMembership;
324            public int membershipRestriction;
325            public String friendlyURL;
326            public boolean site;
327            public int remoteStagingGroupCount;
328            public boolean inheritContent;
329            public boolean active;
330    }