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