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(27);
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(", lastPublishDate=");
109                    sb.append(lastPublishDate);
110                    sb.append("}");
111    
112                    return sb.toString();
113            }
114    
115            @Override
116            public RepositoryEntry toEntityModel() {
117                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
118    
119                    repositoryEntryImpl.setMvccVersion(mvccVersion);
120    
121                    if (uuid == null) {
122                            repositoryEntryImpl.setUuid(StringPool.BLANK);
123                    }
124                    else {
125                            repositoryEntryImpl.setUuid(uuid);
126                    }
127    
128                    repositoryEntryImpl.setRepositoryEntryId(repositoryEntryId);
129                    repositoryEntryImpl.setGroupId(groupId);
130                    repositoryEntryImpl.setCompanyId(companyId);
131                    repositoryEntryImpl.setUserId(userId);
132    
133                    if (userName == null) {
134                            repositoryEntryImpl.setUserName(StringPool.BLANK);
135                    }
136                    else {
137                            repositoryEntryImpl.setUserName(userName);
138                    }
139    
140                    if (createDate == Long.MIN_VALUE) {
141                            repositoryEntryImpl.setCreateDate(null);
142                    }
143                    else {
144                            repositoryEntryImpl.setCreateDate(new Date(createDate));
145                    }
146    
147                    if (modifiedDate == Long.MIN_VALUE) {
148                            repositoryEntryImpl.setModifiedDate(null);
149                    }
150                    else {
151                            repositoryEntryImpl.setModifiedDate(new Date(modifiedDate));
152                    }
153    
154                    repositoryEntryImpl.setRepositoryId(repositoryId);
155    
156                    if (mappedId == null) {
157                            repositoryEntryImpl.setMappedId(StringPool.BLANK);
158                    }
159                    else {
160                            repositoryEntryImpl.setMappedId(mappedId);
161                    }
162    
163                    repositoryEntryImpl.setManualCheckInRequired(manualCheckInRequired);
164    
165                    if (lastPublishDate == Long.MIN_VALUE) {
166                            repositoryEntryImpl.setLastPublishDate(null);
167                    }
168                    else {
169                            repositoryEntryImpl.setLastPublishDate(new Date(lastPublishDate));
170                    }
171    
172                    repositoryEntryImpl.resetOriginalValues();
173    
174                    return repositoryEntryImpl;
175            }
176    
177            @Override
178            public void readExternal(ObjectInput objectInput) throws IOException {
179                    mvccVersion = objectInput.readLong();
180                    uuid = objectInput.readUTF();
181                    repositoryEntryId = objectInput.readLong();
182                    groupId = objectInput.readLong();
183                    companyId = objectInput.readLong();
184                    userId = objectInput.readLong();
185                    userName = objectInput.readUTF();
186                    createDate = objectInput.readLong();
187                    modifiedDate = objectInput.readLong();
188                    repositoryId = objectInput.readLong();
189                    mappedId = objectInput.readUTF();
190                    manualCheckInRequired = objectInput.readBoolean();
191                    lastPublishDate = objectInput.readLong();
192            }
193    
194            @Override
195            public void writeExternal(ObjectOutput objectOutput)
196                    throws IOException {
197                    objectOutput.writeLong(mvccVersion);
198    
199                    if (uuid == null) {
200                            objectOutput.writeUTF(StringPool.BLANK);
201                    }
202                    else {
203                            objectOutput.writeUTF(uuid);
204                    }
205    
206                    objectOutput.writeLong(repositoryEntryId);
207                    objectOutput.writeLong(groupId);
208                    objectOutput.writeLong(companyId);
209                    objectOutput.writeLong(userId);
210    
211                    if (userName == null) {
212                            objectOutput.writeUTF(StringPool.BLANK);
213                    }
214                    else {
215                            objectOutput.writeUTF(userName);
216                    }
217    
218                    objectOutput.writeLong(createDate);
219                    objectOutput.writeLong(modifiedDate);
220                    objectOutput.writeLong(repositoryId);
221    
222                    if (mappedId == null) {
223                            objectOutput.writeUTF(StringPool.BLANK);
224                    }
225                    else {
226                            objectOutput.writeUTF(mappedId);
227                    }
228    
229                    objectOutput.writeBoolean(manualCheckInRequired);
230                    objectOutput.writeLong(lastPublishDate);
231            }
232    
233            public long mvccVersion;
234            public String uuid;
235            public long repositoryEntryId;
236            public long groupId;
237            public long companyId;
238            public long userId;
239            public String userName;
240            public long createDate;
241            public long modifiedDate;
242            public long repositoryId;
243            public String mappedId;
244            public boolean manualCheckInRequired;
245            public long lastPublishDate;
246    }