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