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