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            public RepositoryEntry toEntityModel() {
070                    RepositoryEntryImpl repositoryEntryImpl = new RepositoryEntryImpl();
071    
072                    if (uuid == null) {
073                            repositoryEntryImpl.setUuid(StringPool.BLANK);
074                    }
075                    else {
076                            repositoryEntryImpl.setUuid(uuid);
077                    }
078    
079                    repositoryEntryImpl.setRepositoryEntryId(repositoryEntryId);
080                    repositoryEntryImpl.setGroupId(groupId);
081                    repositoryEntryImpl.setCompanyId(companyId);
082                    repositoryEntryImpl.setUserId(userId);
083    
084                    if (userName == null) {
085                            repositoryEntryImpl.setUserName(StringPool.BLANK);
086                    }
087                    else {
088                            repositoryEntryImpl.setUserName(userName);
089                    }
090    
091                    if (createDate == Long.MIN_VALUE) {
092                            repositoryEntryImpl.setCreateDate(null);
093                    }
094                    else {
095                            repositoryEntryImpl.setCreateDate(new Date(createDate));
096                    }
097    
098                    if (modifiedDate == Long.MIN_VALUE) {
099                            repositoryEntryImpl.setModifiedDate(null);
100                    }
101                    else {
102                            repositoryEntryImpl.setModifiedDate(new Date(modifiedDate));
103                    }
104    
105                    repositoryEntryImpl.setRepositoryId(repositoryId);
106    
107                    if (mappedId == null) {
108                            repositoryEntryImpl.setMappedId(StringPool.BLANK);
109                    }
110                    else {
111                            repositoryEntryImpl.setMappedId(mappedId);
112                    }
113    
114                    repositoryEntryImpl.setManualCheckInRequired(manualCheckInRequired);
115    
116                    repositoryEntryImpl.resetOriginalValues();
117    
118                    return repositoryEntryImpl;
119            }
120    
121            public void readExternal(ObjectInput objectInput) throws IOException {
122                    uuid = objectInput.readUTF();
123                    repositoryEntryId = objectInput.readLong();
124                    groupId = objectInput.readLong();
125                    companyId = objectInput.readLong();
126                    userId = objectInput.readLong();
127                    userName = objectInput.readUTF();
128                    createDate = objectInput.readLong();
129                    modifiedDate = objectInput.readLong();
130                    repositoryId = objectInput.readLong();
131                    mappedId = objectInput.readUTF();
132                    manualCheckInRequired = objectInput.readBoolean();
133            }
134    
135            public void writeExternal(ObjectOutput objectOutput)
136                    throws IOException {
137                    if (uuid == null) {
138                            objectOutput.writeUTF(StringPool.BLANK);
139                    }
140                    else {
141                            objectOutput.writeUTF(uuid);
142                    }
143    
144                    objectOutput.writeLong(repositoryEntryId);
145                    objectOutput.writeLong(groupId);
146                    objectOutput.writeLong(companyId);
147                    objectOutput.writeLong(userId);
148    
149                    if (userName == null) {
150                            objectOutput.writeUTF(StringPool.BLANK);
151                    }
152                    else {
153                            objectOutput.writeUTF(userName);
154                    }
155    
156                    objectOutput.writeLong(createDate);
157                    objectOutput.writeLong(modifiedDate);
158                    objectOutput.writeLong(repositoryId);
159    
160                    if (mappedId == null) {
161                            objectOutput.writeUTF(StringPool.BLANK);
162                    }
163                    else {
164                            objectOutput.writeUTF(mappedId);
165                    }
166    
167                    objectOutput.writeBoolean(manualCheckInRequired);
168            }
169    
170            public String uuid;
171            public long repositoryEntryId;
172            public long groupId;
173            public long companyId;
174            public long userId;
175            public String userName;
176            public long createDate;
177            public long modifiedDate;
178            public long repositoryId;
179            public String mappedId;
180            public boolean manualCheckInRequired;
181    }