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.portal.model.impl;
016    
017    import com.liferay.portal.kernel.util.StringBundler;
018    import com.liferay.portal.kernel.util.StringPool;
019    import com.liferay.portal.model.CacheModel;
020    import com.liferay.portal.model.RepositoryEntry;
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 RepositoryEntry in entity cache.
031     *
032     * @author Brian Wing Shun Chan
033     * @see RepositoryEntry
034     * @generated
035     */
036    public class RepositoryEntryCacheModel implements CacheModel<RepositoryEntry>,
037            Externalizable {
038            @Override
039            public String toString() {
040                    StringBundler sb = new StringBundler(23);
041    
042                    sb.append("{uuid=");
043                    sb.append(uuid);
044                    sb.append(", repositoryEntryId=");
045                    sb.append(repositoryEntryId);
046                    sb.append(", groupId=");
047                    sb.append(groupId);
048                    sb.append(", companyId=");
049                    sb.append(companyId);
050                    sb.append(", userId=");
051                    sb.append(userId);
052                    sb.append(", userName=");
053                    sb.append(userName);
054                    sb.append(", createDate=");
055                    sb.append(createDate);
056                    sb.append(", modifiedDate=");
057                    sb.append(modifiedDate);
058                    sb.append(", repositoryId=");
059                    sb.append(repositoryId);
060                    sb.append(", mappedId=");
061                    sb.append(mappedId);
062                    sb.append(", manualCheckInRequired=");
063                    sb.append(manualCheckInRequired);
064                    sb.append("}");
065    
066                    return sb.toString();
067            }
068    
069            @Override
070            public RepositoryEntry toEntityModel() {
071                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
072    
073                    if (uuid == null) {
074                            repositoryEntryImpl.setUuid(StringPool.BLANK);
075                    }
076                    else {
077                            repositoryEntryImpl.setUuid(uuid);
078                    }
079    
080                    repositoryEntryImpl.setRepositoryEntryId(repositoryEntryId);
081                    repositoryEntryImpl.setGroupId(groupId);
082                    repositoryEntryImpl.setCompanyId(companyId);
083                    repositoryEntryImpl.setUserId(userId);
084    
085                    if (userName == null) {
086                            repositoryEntryImpl.setUserName(StringPool.BLANK);
087                    }
088                    else {
089                            repositoryEntryImpl.setUserName(userName);
090                    }
091    
092                    if (createDate == Long.MIN_VALUE) {
093                            repositoryEntryImpl.setCreateDate(null);
094                    }
095                    else {
096                            repositoryEntryImpl.setCreateDate(new Date(createDate));
097                    }
098    
099                    if (modifiedDate == Long.MIN_VALUE) {
100                            repositoryEntryImpl.setModifiedDate(null);
101                    }
102                    else {
103                            repositoryEntryImpl.setModifiedDate(new Date(modifiedDate));
104                    }
105    
106                    repositoryEntryImpl.setRepositoryId(repositoryId);
107    
108                    if (mappedId == null) {
109                            repositoryEntryImpl.setMappedId(StringPool.BLANK);
110                    }
111                    else {
112                            repositoryEntryImpl.setMappedId(mappedId);
113                    }
114    
115                    repositoryEntryImpl.setManualCheckInRequired(manualCheckInRequired);
116    
117                    repositoryEntryImpl.resetOriginalValues();
118    
119                    return repositoryEntryImpl;
120            }
121    
122            @Override
123            public void readExternal(ObjectInput objectInput) throws IOException {
124                    uuid = objectInput.readUTF();
125                    repositoryEntryId = objectInput.readLong();
126                    groupId = objectInput.readLong();
127                    companyId = objectInput.readLong();
128                    userId = objectInput.readLong();
129                    userName = objectInput.readUTF();
130                    createDate = objectInput.readLong();
131                    modifiedDate = objectInput.readLong();
132                    repositoryId = objectInput.readLong();
133                    mappedId = objectInput.readUTF();
134                    manualCheckInRequired = objectInput.readBoolean();
135            }
136    
137            @Override
138            public void writeExternal(ObjectOutput objectOutput)
139                    throws IOException {
140                    if (uuid == null) {
141                            objectOutput.writeUTF(StringPool.BLANK);
142                    }
143                    else {
144                            objectOutput.writeUTF(uuid);
145                    }
146    
147                    objectOutput.writeLong(repositoryEntryId);
148                    objectOutput.writeLong(groupId);
149                    objectOutput.writeLong(companyId);
150                    objectOutput.writeLong(userId);
151    
152                    if (userName == null) {
153                            objectOutput.writeUTF(StringPool.BLANK);
154                    }
155                    else {
156                            objectOutput.writeUTF(userName);
157                    }
158    
159                    objectOutput.writeLong(createDate);
160                    objectOutput.writeLong(modifiedDate);
161                    objectOutput.writeLong(repositoryId);
162    
163                    if (mappedId == null) {
164                            objectOutput.writeUTF(StringPool.BLANK);
165                    }
166                    else {
167                            objectOutput.writeUTF(mappedId);
168                    }
169    
170                    objectOutput.writeBoolean(manualCheckInRequired);
171            }
172    
173            public String uuid;
174            public long repositoryEntryId;
175            public long groupId;
176            public long companyId;
177            public long userId;
178            public String userName;
179            public long createDate;
180            public long modifiedDate;
181            public long repositoryId;
182            public String mappedId;
183            public boolean manualCheckInRequired;
184    }