001
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
034 public class GroupCacheModel implements CacheModel<Group>, Externalizable {
035 @Override
036 public String toString() {
037 StringBundler sb = new StringBundler(29);
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(", name=");
054 sb.append(name);
055 sb.append(", description=");
056 sb.append(description);
057 sb.append(", type=");
058 sb.append(type);
059 sb.append(", typeSettings=");
060 sb.append(typeSettings);
061 sb.append(", friendlyURL=");
062 sb.append(friendlyURL);
063 sb.append(", site=");
064 sb.append(site);
065 sb.append(", active=");
066 sb.append(active);
067 sb.append("}");
068
069 return sb.toString();
070 }
071
072 public Group toEntityModel() {
073 GroupImpl groupImpl = new GroupImpl();
074
075 groupImpl.setGroupId(groupId);
076 groupImpl.setCompanyId(companyId);
077 groupImpl.setCreatorUserId(creatorUserId);
078 groupImpl.setClassNameId(classNameId);
079 groupImpl.setClassPK(classPK);
080 groupImpl.setParentGroupId(parentGroupId);
081 groupImpl.setLiveGroupId(liveGroupId);
082
083 if (name == null) {
084 groupImpl.setName(StringPool.BLANK);
085 }
086 else {
087 groupImpl.setName(name);
088 }
089
090 if (description == null) {
091 groupImpl.setDescription(StringPool.BLANK);
092 }
093 else {
094 groupImpl.setDescription(description);
095 }
096
097 groupImpl.setType(type);
098
099 if (typeSettings == null) {
100 groupImpl.setTypeSettings(StringPool.BLANK);
101 }
102 else {
103 groupImpl.setTypeSettings(typeSettings);
104 }
105
106 if (friendlyURL == null) {
107 groupImpl.setFriendlyURL(StringPool.BLANK);
108 }
109 else {
110 groupImpl.setFriendlyURL(friendlyURL);
111 }
112
113 groupImpl.setSite(site);
114 groupImpl.setActive(active);
115
116 groupImpl.resetOriginalValues();
117
118 return groupImpl;
119 }
120
121 public void readExternal(ObjectInput objectInput) throws IOException {
122 groupId = objectInput.readLong();
123 companyId = objectInput.readLong();
124 creatorUserId = objectInput.readLong();
125 classNameId = objectInput.readLong();
126 classPK = objectInput.readLong();
127 parentGroupId = objectInput.readLong();
128 liveGroupId = objectInput.readLong();
129 name = objectInput.readUTF();
130 description = objectInput.readUTF();
131 type = objectInput.readInt();
132 typeSettings = objectInput.readUTF();
133 friendlyURL = objectInput.readUTF();
134 site = objectInput.readBoolean();
135 active = objectInput.readBoolean();
136 }
137
138 public void writeExternal(ObjectOutput objectOutput)
139 throws IOException {
140 objectOutput.writeLong(groupId);
141 objectOutput.writeLong(companyId);
142 objectOutput.writeLong(creatorUserId);
143 objectOutput.writeLong(classNameId);
144 objectOutput.writeLong(classPK);
145 objectOutput.writeLong(parentGroupId);
146 objectOutput.writeLong(liveGroupId);
147
148 if (name == null) {
149 objectOutput.writeUTF(StringPool.BLANK);
150 }
151 else {
152 objectOutput.writeUTF(name);
153 }
154
155 if (description == null) {
156 objectOutput.writeUTF(StringPool.BLANK);
157 }
158 else {
159 objectOutput.writeUTF(description);
160 }
161
162 objectOutput.writeInt(type);
163
164 if (typeSettings == null) {
165 objectOutput.writeUTF(StringPool.BLANK);
166 }
167 else {
168 objectOutput.writeUTF(typeSettings);
169 }
170
171 if (friendlyURL == null) {
172 objectOutput.writeUTF(StringPool.BLANK);
173 }
174 else {
175 objectOutput.writeUTF(friendlyURL);
176 }
177
178 objectOutput.writeBoolean(site);
179 objectOutput.writeBoolean(active);
180 }
181
182 public long groupId;
183 public long companyId;
184 public long creatorUserId;
185 public long classNameId;
186 public long classPK;
187 public long parentGroupId;
188 public long liveGroupId;
189 public String name;
190 public String description;
191 public int type;
192 public String typeSettings;
193 public String friendlyURL;
194 public boolean site;
195 public boolean active;
196 }