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.portal.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.kernel.util.HashUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.CacheModel;
023    import com.liferay.portal.model.MVCCModel;
024    import com.liferay.portal.model.RepositoryEntry;
025    
026    import java.io.Externalizable;
027    import java.io.IOException;
028    import java.io.ObjectInput;
029    import java.io.ObjectOutput;
030    
031    import java.util.Date;
032    
033    /**
034     * The cache model class for representing RepositoryEntry in entity cache.
035     *
036     * @author Brian Wing Shun Chan
037     * @see RepositoryEntry
038     * @generated
039     */
040    @ProviderType
041    public class RepositoryEntryCacheModel implements CacheModel<RepositoryEntry>,
042            Externalizable, MVCCModel {
043            @Override
044            public boolean equals(Object obj) {
045                    if (this == obj) {
046                            return true;
047                    }
048    
049                    if (!(obj instanceof RepositoryEntryCacheModel)) {
050                            return false;
051                    }
052    
053                    RepositoryEntryCacheModel repositoryEntryCacheModel = (RepositoryEntryCacheModel)obj;
054    
055                    if ((repositoryEntryId == repositoryEntryCacheModel.repositoryEntryId) &&
056                                    (mvccVersion == repositoryEntryCacheModel.mvccVersion)) {
057                            return true;
058                    }
059    
060                    return false;
061            }
062    
063            @Override
064            public int hashCode() {
065                    int hashCode = HashUtil.hash(0, repositoryEntryId);
066    
067                    return HashUtil.hash(hashCode, mvccVersion);
068            }
069    
070            @Override
071            public long getMvccVersion() {
072                    return mvccVersion;
073            }
074    
075            @Override
076            public void setMvccVersion(long mvccVersion) {
077                    this.mvccVersion = mvccVersion;
078            }
079    
080            @Override
081            public String toString() {
082                    StringBundler sb = new StringBundler(25);
083    
084                    sb.append("{mvccVersion=");
085                    sb.append(mvccVersion);
086                    sb.append(", uuid=");
087                    sb.append(uuid);
088                    sb.append(", repositoryEntryId=");
089                    sb.append(repositoryEntryId);
090                    sb.append(", groupId=");
091                    sb.append(groupId);
092                    sb.append(", companyId=");
093                    sb.append(companyId);
094                    sb.append(", userId=");
095                    sb.append(userId);
096                    sb.append(", userName=");
097                    sb.append(userName);
098                    sb.append(", createDate=");
099                    sb.append(createDate);
100                    sb.append(", modifiedDate=");
101                    sb.append(modifiedDate);
102                    sb.append(", repositoryId=");
103                    sb.append(repositoryId);
104                    sb.append(", mappedId=");
105                    sb.append(mappedId);
106                    sb.append(", manualCheckInRequired=");
107                    sb.append(manualCheckInRequired);
108                    sb.append("}");
109    
110                    return sb.toString();
111            }
112    
113            @Override
114            public RepositoryEntry toEntityModel() {
115                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
116    
117                    repositoryEntryImpl.setMvccVersion(mvccVersion);
118    
119                    if (uuid == null) {
120                            repositoryEntryImpl.setUuid(StringPool.BLANK);
121                    }
122                    else {
123                            repositoryEntryImpl.setUuid(uuid);
124                    }
125    
126                    repositoryEntryImpl.setRepositoryEntryId(repositoryEntryId);
127                    repositoryEntryImpl.setGroupId(groupId);
128                    repositoryEntryImpl.setCompanyId(companyId);
129                    repositoryEntryImpl.setUserId(userId);
130    
131                    if (userName == null) {
132                            repositoryEntryImpl.setUserName(StringPool.BLANK);
133                    }
134                    else {
135                            repositoryEntryImpl.setUserName(userName);
136                    }
137    
138                    if (createDate == Long.MIN_VALUE) {
139                            repositoryEntryImpl.setCreateDate(null);
140                    }
141                    else {
142                            repositoryEntryImpl.setCreateDate(new Date(createDate));
143                    }
144    
145                    if (modifiedDate == Long.MIN_VALUE) {
146                            repositoryEntryImpl.setModifiedDate(null);
147                    }
148                    else {
149                            repositoryEntryImpl.setModifiedDate(new Date(modifiedDate));
150                    }
151    
152                    repositoryEntryImpl.setRepositoryId(repositoryId);
153    
154                    if (mappedId == null) {
155                            repositoryEntryImpl.setMappedId(StringPool.BLANK);
156                    }
157                    else {
158                            repositoryEntryImpl.setMappedId(mappedId);
159                    }
160    
161                    repositoryEntryImpl.setManualCheckInRequired(manualCheckInRequired);
162    
163                    repositoryEntryImpl.resetOriginalValues();
164    
165                    return repositoryEntryImpl;
166            }
167    
168            @Override
169            public void readExternal(ObjectInput objectInput) throws IOException {
170                    mvccVersion = objectInput.readLong();
171                    uuid = objectInput.readUTF();
172                    repositoryEntryId = objectInput.readLong();
173                    groupId = objectInput.readLong();
174                    companyId = objectInput.readLong();
175                    userId = objectInput.readLong();
176                    userName = objectInput.readUTF();
177                    createDate = objectInput.readLong();
178                    modifiedDate = objectInput.readLong();
179                    repositoryId = objectInput.readLong();
180                    mappedId = objectInput.readUTF();
181                    manualCheckInRequired = objectInput.readBoolean();
182            }
183    
184            @Override
185            public void writeExternal(ObjectOutput objectOutput)
186                    throws IOException {
187                    objectOutput.writeLong(mvccVersion);
188    
189                    if (uuid == null) {
190                            objectOutput.writeUTF(StringPool.BLANK);
191                    }
192                    else {
193                            objectOutput.writeUTF(uuid);
194                    }
195    
196                    objectOutput.writeLong(repositoryEntryId);
197                    objectOutput.writeLong(groupId);
198                    objectOutput.writeLong(companyId);
199                    objectOutput.writeLong(userId);
200    
201                    if (userName == null) {
202                            objectOutput.writeUTF(StringPool.BLANK);
203                    }
204                    else {
205                            objectOutput.writeUTF(userName);
206                    }
207    
208                    objectOutput.writeLong(createDate);
209                    objectOutput.writeLong(modifiedDate);
210                    objectOutput.writeLong(repositoryId);
211    
212                    if (mappedId == null) {
213                            objectOutput.writeUTF(StringPool.BLANK);
214                    }
215                    else {
216                            objectOutput.writeUTF(mappedId);
217                    }
218    
219                    objectOutput.writeBoolean(manualCheckInRequired);
220            }
221    
222            public long mvccVersion;
223            public String uuid;
224            public long repositoryEntryId;
225            public long groupId;
226            public long companyId;
227            public long userId;
228            public String userName;
229            public long createDate;
230            public long modifiedDate;
231            public long repositoryId;
232            public String mappedId;
233            public boolean manualCheckInRequired;
234    }