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.StringBundler;
020    import com.liferay.portal.kernel.util.StringPool;
021    import com.liferay.portal.model.CacheModel;
022    import com.liferay.portal.model.MVCCModel;
023    import com.liferay.portal.model.Organization;
024    
025    import java.io.Externalizable;
026    import java.io.IOException;
027    import java.io.ObjectInput;
028    import java.io.ObjectOutput;
029    
030    import java.util.Date;
031    
032    /**
033     * The cache model class for representing Organization in entity cache.
034     *
035     * @author Brian Wing Shun Chan
036     * @see Organization
037     * @generated
038     */
039    @ProviderType
040    public class OrganizationCacheModel implements CacheModel<Organization>,
041            Externalizable, MVCCModel {
042            @Override
043            public long getMvccVersion() {
044                    return mvccVersion;
045            }
046    
047            @Override
048            public void setMvccVersion(long mvccVersion) {
049                    this.mvccVersion = mvccVersion;
050            }
051    
052            @Override
053            public String toString() {
054                    StringBundler sb = new StringBundler(37);
055    
056                    sb.append("{mvccVersion=");
057                    sb.append(mvccVersion);
058                    sb.append(", uuid=");
059                    sb.append(uuid);
060                    sb.append(", organizationId=");
061                    sb.append(organizationId);
062                    sb.append(", companyId=");
063                    sb.append(companyId);
064                    sb.append(", userId=");
065                    sb.append(userId);
066                    sb.append(", userName=");
067                    sb.append(userName);
068                    sb.append(", createDate=");
069                    sb.append(createDate);
070                    sb.append(", modifiedDate=");
071                    sb.append(modifiedDate);
072                    sb.append(", parentOrganizationId=");
073                    sb.append(parentOrganizationId);
074                    sb.append(", treePath=");
075                    sb.append(treePath);
076                    sb.append(", name=");
077                    sb.append(name);
078                    sb.append(", type=");
079                    sb.append(type);
080                    sb.append(", recursable=");
081                    sb.append(recursable);
082                    sb.append(", regionId=");
083                    sb.append(regionId);
084                    sb.append(", countryId=");
085                    sb.append(countryId);
086                    sb.append(", statusId=");
087                    sb.append(statusId);
088                    sb.append(", comments=");
089                    sb.append(comments);
090                    sb.append(", logoId=");
091                    sb.append(logoId);
092                    sb.append("}");
093    
094                    return sb.toString();
095            }
096    
097            @Override
098            public Organization toEntityModel() {
099                    OrganizationImpl organizationImpl = new OrganizationImpl();
100    
101                    organizationImpl.setMvccVersion(mvccVersion);
102    
103                    if (uuid == null) {
104                            organizationImpl.setUuid(StringPool.BLANK);
105                    }
106                    else {
107                            organizationImpl.setUuid(uuid);
108                    }
109    
110                    organizationImpl.setOrganizationId(organizationId);
111                    organizationImpl.setCompanyId(companyId);
112                    organizationImpl.setUserId(userId);
113    
114                    if (userName == null) {
115                            organizationImpl.setUserName(StringPool.BLANK);
116                    }
117                    else {
118                            organizationImpl.setUserName(userName);
119                    }
120    
121                    if (createDate == Long.MIN_VALUE) {
122                            organizationImpl.setCreateDate(null);
123                    }
124                    else {
125                            organizationImpl.setCreateDate(new Date(createDate));
126                    }
127    
128                    if (modifiedDate == Long.MIN_VALUE) {
129                            organizationImpl.setModifiedDate(null);
130                    }
131                    else {
132                            organizationImpl.setModifiedDate(new Date(modifiedDate));
133                    }
134    
135                    organizationImpl.setParentOrganizationId(parentOrganizationId);
136    
137                    if (treePath == null) {
138                            organizationImpl.setTreePath(StringPool.BLANK);
139                    }
140                    else {
141                            organizationImpl.setTreePath(treePath);
142                    }
143    
144                    if (name == null) {
145                            organizationImpl.setName(StringPool.BLANK);
146                    }
147                    else {
148                            organizationImpl.setName(name);
149                    }
150    
151                    if (type == null) {
152                            organizationImpl.setType(StringPool.BLANK);
153                    }
154                    else {
155                            organizationImpl.setType(type);
156                    }
157    
158                    organizationImpl.setRecursable(recursable);
159                    organizationImpl.setRegionId(regionId);
160                    organizationImpl.setCountryId(countryId);
161                    organizationImpl.setStatusId(statusId);
162    
163                    if (comments == null) {
164                            organizationImpl.setComments(StringPool.BLANK);
165                    }
166                    else {
167                            organizationImpl.setComments(comments);
168                    }
169    
170                    organizationImpl.setLogoId(logoId);
171    
172                    organizationImpl.resetOriginalValues();
173    
174                    return organizationImpl;
175            }
176    
177            @Override
178            public void readExternal(ObjectInput objectInput) throws IOException {
179                    mvccVersion = objectInput.readLong();
180                    uuid = objectInput.readUTF();
181                    organizationId = objectInput.readLong();
182                    companyId = objectInput.readLong();
183                    userId = objectInput.readLong();
184                    userName = objectInput.readUTF();
185                    createDate = objectInput.readLong();
186                    modifiedDate = objectInput.readLong();
187                    parentOrganizationId = objectInput.readLong();
188                    treePath = objectInput.readUTF();
189                    name = objectInput.readUTF();
190                    type = objectInput.readUTF();
191                    recursable = objectInput.readBoolean();
192                    regionId = objectInput.readLong();
193                    countryId = objectInput.readLong();
194                    statusId = objectInput.readInt();
195                    comments = objectInput.readUTF();
196                    logoId = objectInput.readLong();
197            }
198    
199            @Override
200            public void writeExternal(ObjectOutput objectOutput)
201                    throws IOException {
202                    objectOutput.writeLong(mvccVersion);
203    
204                    if (uuid == null) {
205                            objectOutput.writeUTF(StringPool.BLANK);
206                    }
207                    else {
208                            objectOutput.writeUTF(uuid);
209                    }
210    
211                    objectOutput.writeLong(organizationId);
212                    objectOutput.writeLong(companyId);
213                    objectOutput.writeLong(userId);
214    
215                    if (userName == null) {
216                            objectOutput.writeUTF(StringPool.BLANK);
217                    }
218                    else {
219                            objectOutput.writeUTF(userName);
220                    }
221    
222                    objectOutput.writeLong(createDate);
223                    objectOutput.writeLong(modifiedDate);
224                    objectOutput.writeLong(parentOrganizationId);
225    
226                    if (treePath == null) {
227                            objectOutput.writeUTF(StringPool.BLANK);
228                    }
229                    else {
230                            objectOutput.writeUTF(treePath);
231                    }
232    
233                    if (name == null) {
234                            objectOutput.writeUTF(StringPool.BLANK);
235                    }
236                    else {
237                            objectOutput.writeUTF(name);
238                    }
239    
240                    if (type == null) {
241                            objectOutput.writeUTF(StringPool.BLANK);
242                    }
243                    else {
244                            objectOutput.writeUTF(type);
245                    }
246    
247                    objectOutput.writeBoolean(recursable);
248                    objectOutput.writeLong(regionId);
249                    objectOutput.writeLong(countryId);
250                    objectOutput.writeInt(statusId);
251    
252                    if (comments == null) {
253                            objectOutput.writeUTF(StringPool.BLANK);
254                    }
255                    else {
256                            objectOutput.writeUTF(comments);
257                    }
258    
259                    objectOutput.writeLong(logoId);
260            }
261    
262            public long mvccVersion;
263            public String uuid;
264            public long organizationId;
265            public long companyId;
266            public long userId;
267            public String userName;
268            public long createDate;
269            public long modifiedDate;
270            public long parentOrganizationId;
271            public String treePath;
272            public String name;
273            public String type;
274            public boolean recursable;
275            public long regionId;
276            public long countryId;
277            public int statusId;
278            public String comments;
279            public long logoId;
280    }