001    /**
002     * Copyright (c) 2000-2013 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 com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    
021    import com.liferay.portlet.dynamicdatamapping.model.DDMStorageLink;
022    
023    import java.io.Externalizable;
024    import java.io.IOException;
025    import java.io.ObjectInput;
026    import java.io.ObjectOutput;
027    
028    /**
029     * The cache model class for representing DDMStorageLink in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see DDMStorageLink
033     * @generated
034     */
035    public class DDMStorageLinkCacheModel implements CacheModel<DDMStorageLink>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(11);
040    
041                    sb.append("{uuid=");
042                    sb.append(uuid);
043                    sb.append(", storageLinkId=");
044                    sb.append(storageLinkId);
045                    sb.append(", classNameId=");
046                    sb.append(classNameId);
047                    sb.append(", classPK=");
048                    sb.append(classPK);
049                    sb.append(", structureId=");
050                    sb.append(structureId);
051                    sb.append("}");
052    
053                    return sb.toString();
054            }
055    
056            @Override
057            public DDMStorageLink toEntityModel() {
058                    DDMStorageLinkImpl ddmStorageLinkImpl = new DDMStorageLinkImpl();
059    
060                    if (uuid == null) {
061                            ddmStorageLinkImpl.setUuid(StringPool.BLANK);
062                    }
063                    else {
064                            ddmStorageLinkImpl.setUuid(uuid);
065                    }
066    
067                    ddmStorageLinkImpl.setStorageLinkId(storageLinkId);
068                    ddmStorageLinkImpl.setClassNameId(classNameId);
069                    ddmStorageLinkImpl.setClassPK(classPK);
070                    ddmStorageLinkImpl.setStructureId(structureId);
071    
072                    ddmStorageLinkImpl.resetOriginalValues();
073    
074                    return ddmStorageLinkImpl;
075            }
076    
077            @Override
078            public void readExternal(ObjectInput objectInput) throws IOException {
079                    uuid = objectInput.readUTF();
080                    storageLinkId = objectInput.readLong();
081                    classNameId = objectInput.readLong();
082                    classPK = objectInput.readLong();
083                    structureId = objectInput.readLong();
084            }
085    
086            @Override
087            public void writeExternal(ObjectOutput objectOutput)
088                    throws IOException {
089                    if (uuid == null) {
090                            objectOutput.writeUTF(StringPool.BLANK);
091                    }
092                    else {
093                            objectOutput.writeUTF(uuid);
094                    }
095    
096                    objectOutput.writeLong(storageLinkId);
097                    objectOutput.writeLong(classNameId);
098                    objectOutput.writeLong(classPK);
099                    objectOutput.writeLong(structureId);
100            }
101    
102            public String uuid;
103            public long storageLinkId;
104            public long classNameId;
105            public long classPK;
106            public long structureId;
107    }