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