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.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            public DLFileRank toEntityModel() {
062                    DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
063    
064                    dlFileRankImpl.setFileRankId(fileRankId);
065                    dlFileRankImpl.setGroupId(groupId);
066                    dlFileRankImpl.setCompanyId(companyId);
067                    dlFileRankImpl.setUserId(userId);
068    
069                    if (createDate == Long.MIN_VALUE) {
070                            dlFileRankImpl.setCreateDate(null);
071                    }
072                    else {
073                            dlFileRankImpl.setCreateDate(new Date(createDate));
074                    }
075    
076                    dlFileRankImpl.setFileEntryId(fileEntryId);
077                    dlFileRankImpl.setActive(active);
078    
079                    dlFileRankImpl.resetOriginalValues();
080    
081                    return dlFileRankImpl;
082            }
083    
084            public void readExternal(ObjectInput objectInput) throws IOException {
085                    fileRankId = objectInput.readLong();
086                    groupId = objectInput.readLong();
087                    companyId = objectInput.readLong();
088                    userId = objectInput.readLong();
089                    createDate = objectInput.readLong();
090                    fileEntryId = objectInput.readLong();
091                    active = objectInput.readBoolean();
092            }
093    
094            public void writeExternal(ObjectOutput objectOutput)
095                    throws IOException {
096                    objectOutput.writeLong(fileRankId);
097                    objectOutput.writeLong(groupId);
098                    objectOutput.writeLong(companyId);
099                    objectOutput.writeLong(userId);
100                    objectOutput.writeLong(createDate);
101                    objectOutput.writeLong(fileEntryId);
102                    objectOutput.writeBoolean(active);
103            }
104    
105            public long fileRankId;
106            public long groupId;
107            public long companyId;
108            public long userId;
109            public long createDate;
110            public long fileEntryId;
111            public boolean active;
112    }