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.model.CacheModel;
019    
020    import com.liferay.portlet.documentlibrary.model.DLFileRank;
021    
022    import java.io.Externalizable;
023    import java.io.IOException;
024    import java.io.ObjectInput;
025    import java.io.ObjectOutput;
026    
027    import java.util.Date;
028    
029    /**
030     * The cache model class for representing DLFileRank in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see DLFileRank
034     * @generated
035     */
036    public class DLFileRankCacheModel implements CacheModel<DLFileRank>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(15);
041    
042                    sb.append("{fileRankId=");
043                    sb.append(fileRankId);
044                    sb.append(", groupId=");
045                    sb.append(groupId);
046                    sb.append(", companyId=");
047                    sb.append(companyId);
048                    sb.append(", userId=");
049                    sb.append(userId);
050                    sb.append(", createDate=");
051                    sb.append(createDate);
052                    sb.append(", fileEntryId=");
053                    sb.append(fileEntryId);
054                    sb.append(", active=");
055                    sb.append(active);
056                    sb.append("}");
057    
058                    return sb.toString();
059            }
060    
061            @Override
062            public DLFileRank toEntityModel() {
063                    DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
064    
065                    dlFileRankImpl.setFileRankId(fileRankId);
066                    dlFileRankImpl.setGroupId(groupId);
067                    dlFileRankImpl.setCompanyId(companyId);
068                    dlFileRankImpl.setUserId(userId);
069    
070                    if (createDate == Long.MIN_VALUE) {
071                            dlFileRankImpl.setCreateDate(null);
072                    }
073                    else {
074                            dlFileRankImpl.setCreateDate(new Date(createDate));
075                    }
076    
077                    dlFileRankImpl.setFileEntryId(fileEntryId);
078                    dlFileRankImpl.setActive(active);
079    
080                    dlFileRankImpl.resetOriginalValues();
081    
082                    return dlFileRankImpl;
083            }
084    
085            @Override
086            public void readExternal(ObjectInput objectInput) throws IOException {
087                    fileRankId = objectInput.readLong();
088                    groupId = objectInput.readLong();
089                    companyId = objectInput.readLong();
090                    userId = objectInput.readLong();
091                    createDate = objectInput.readLong();
092                    fileEntryId = objectInput.readLong();
093                    active = objectInput.readBoolean();
094            }
095    
096            @Override
097            public void writeExternal(ObjectOutput objectOutput)
098                    throws IOException {
099                    objectOutput.writeLong(fileRankId);
100                    objectOutput.writeLong(groupId);
101                    objectOutput.writeLong(companyId);
102                    objectOutput.writeLong(userId);
103                    objectOutput.writeLong(createDate);
104                    objectOutput.writeLong(fileEntryId);
105                    objectOutput.writeBoolean(active);
106            }
107    
108            public long fileRankId;
109            public long groupId;
110            public long companyId;
111            public long userId;
112            public long createDate;
113            public long fileEntryId;
114            public boolean active;
115    }