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.expando.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.model.CacheModel;
021    
022    import com.liferay.portlet.expando.model.ExpandoRow;
023    
024    import java.io.Externalizable;
025    import java.io.IOException;
026    import java.io.ObjectInput;
027    import java.io.ObjectOutput;
028    
029    import java.util.Date;
030    
031    /**
032     * The cache model class for representing ExpandoRow in entity cache.
033     *
034     * @author Brian Wing Shun Chan
035     * @see ExpandoRow
036     * @generated
037     */
038    @ProviderType
039    public class ExpandoRowCacheModel implements CacheModel<ExpandoRow>,
040            Externalizable {
041            @Override
042            public String toString() {
043                    StringBundler sb = new StringBundler(11);
044    
045                    sb.append("{rowId=");
046                    sb.append(rowId);
047                    sb.append(", companyId=");
048                    sb.append(companyId);
049                    sb.append(", modifiedDate=");
050                    sb.append(modifiedDate);
051                    sb.append(", tableId=");
052                    sb.append(tableId);
053                    sb.append(", classPK=");
054                    sb.append(classPK);
055                    sb.append("}");
056    
057                    return sb.toString();
058            }
059    
060            @Override
061            public ExpandoRow toEntityModel() {
062                    ExpandoRowImpl expandoRowImpl = new ExpandoRowImpl();
063    
064                    expandoRowImpl.setRowId(rowId);
065                    expandoRowImpl.setCompanyId(companyId);
066    
067                    if (modifiedDate == Long.MIN_VALUE) {
068                            expandoRowImpl.setModifiedDate(null);
069                    }
070                    else {
071                            expandoRowImpl.setModifiedDate(new Date(modifiedDate));
072                    }
073    
074                    expandoRowImpl.setTableId(tableId);
075                    expandoRowImpl.setClassPK(classPK);
076    
077                    expandoRowImpl.resetOriginalValues();
078    
079                    return expandoRowImpl;
080            }
081    
082            @Override
083            public void readExternal(ObjectInput objectInput) throws IOException {
084                    rowId = objectInput.readLong();
085                    companyId = objectInput.readLong();
086                    modifiedDate = objectInput.readLong();
087                    tableId = objectInput.readLong();
088                    classPK = objectInput.readLong();
089            }
090    
091            @Override
092            public void writeExternal(ObjectOutput objectOutput)
093                    throws IOException {
094                    objectOutput.writeLong(rowId);
095                    objectOutput.writeLong(companyId);
096                    objectOutput.writeLong(modifiedDate);
097                    objectOutput.writeLong(tableId);
098                    objectOutput.writeLong(classPK);
099            }
100    
101            public long rowId;
102            public long companyId;
103            public long modifiedDate;
104            public long tableId;
105            public long classPK;
106    }