001    /**
002     * Copyright (c) 2000-2012 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            public DDMStorageLink toEntityModel() {
057                    DDMStorageLinkImpl ddmStorageLinkImpl = new DDMStorageLinkImpl();
058    
059                    if (uuid == null) {
060                            ddmStorageLinkImpl.setUuid(StringPool.BLANK);
061                    }
062                    else {
063                            ddmStorageLinkImpl.setUuid(uuid);
064                    }
065    
066                    ddmStorageLinkImpl.setStorageLinkId(storageLinkId);
067                    ddmStorageLinkImpl.setClassNameId(classNameId);
068                    ddmStorageLinkImpl.setClassPK(classPK);
069                    ddmStorageLinkImpl.setStructureId(structureId);
070    
071                    ddmStorageLinkImpl.resetOriginalValues();
072    
073                    return ddmStorageLinkImpl;
074            }
075    
076            public void readExternal(ObjectInput objectInput) throws IOException {
077                    uuid = objectInput.readUTF();
078                    storageLinkId = objectInput.readLong();
079                    classNameId = objectInput.readLong();
080                    classPK = objectInput.readLong();
081                    structureId = objectInput.readLong();
082            }
083    
084            public void writeExternal(ObjectOutput objectOutput)
085                    throws IOException {
086                    if (uuid == null) {
087                            objectOutput.writeUTF(StringPool.BLANK);
088                    }
089                    else {
090                            objectOutput.writeUTF(uuid);
091                    }
092    
093                    objectOutput.writeLong(storageLinkId);
094                    objectOutput.writeLong(classNameId);
095                    objectOutput.writeLong(classPK);
096                    objectOutput.writeLong(structureId);
097            }
098    
099            public String uuid;
100            public long storageLinkId;
101            public long classNameId;
102            public long classPK;
103            public long structureId;
104    }