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.documentlibrary.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.documentlibrary.model.DLSyncEvent;
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 DLSyncEvent in entity cache.
030     *
031     * @author Brian Wing Shun Chan
032     * @see DLSyncEvent
033     * @generated
034     */
035    public class DLSyncEventCacheModel implements CacheModel<DLSyncEvent>,
036            Externalizable {
037            @Override
038            public String toString() {
039                    StringBundler sb = new StringBundler(11);
040    
041                    sb.append("{syncEventId=");
042                    sb.append(syncEventId);
043                    sb.append(", modifiedTime=");
044                    sb.append(modifiedTime);
045                    sb.append(", event=");
046                    sb.append(event);
047                    sb.append(", type=");
048                    sb.append(type);
049                    sb.append(", typePK=");
050                    sb.append(typePK);
051                    sb.append("}");
052    
053                    return sb.toString();
054            }
055    
056            @Override
057            public DLSyncEvent toEntityModel() {
058                    DLSyncEventImpl dlSyncEventImpl = new DLSyncEventImpl();
059    
060                    dlSyncEventImpl.setSyncEventId(syncEventId);
061                    dlSyncEventImpl.setModifiedTime(modifiedTime);
062    
063                    if (event == null) {
064                            dlSyncEventImpl.setEvent(StringPool.BLANK);
065                    }
066                    else {
067                            dlSyncEventImpl.setEvent(event);
068                    }
069    
070                    if (type == null) {
071                            dlSyncEventImpl.setType(StringPool.BLANK);
072                    }
073                    else {
074                            dlSyncEventImpl.setType(type);
075                    }
076    
077                    dlSyncEventImpl.setTypePK(typePK);
078    
079                    dlSyncEventImpl.resetOriginalValues();
080    
081                    return dlSyncEventImpl;
082            }
083    
084            @Override
085            public void readExternal(ObjectInput objectInput) throws IOException {
086                    syncEventId = objectInput.readLong();
087                    modifiedTime = objectInput.readLong();
088                    event = objectInput.readUTF();
089                    type = objectInput.readUTF();
090                    typePK = objectInput.readLong();
091            }
092    
093            @Override
094            public void writeExternal(ObjectOutput objectOutput)
095                    throws IOException {
096                    objectOutput.writeLong(syncEventId);
097                    objectOutput.writeLong(modifiedTime);
098    
099                    if (event == null) {
100                            objectOutput.writeUTF(StringPool.BLANK);
101                    }
102                    else {
103                            objectOutput.writeUTF(event);
104                    }
105    
106                    if (type == null) {
107                            objectOutput.writeUTF(StringPool.BLANK);
108                    }
109                    else {
110                            objectOutput.writeUTF(type);
111                    }
112    
113                    objectOutput.writeLong(typePK);
114            }
115    
116            public long syncEventId;
117            public long modifiedTime;
118            public String event;
119            public String type;
120            public long typePK;
121    }