001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
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.Repository;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing Repository in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see Repository
031     * @generated
032     */
033    public class RepositoryCacheModel implements CacheModel<Repository>,
034            Serializable {
035            @Override
036            public String toString() {
037                    StringBundler sb = new StringBundler(23);
038    
039                    sb.append("{repositoryId=");
040                    sb.append(repositoryId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", companyId=");
044                    sb.append(companyId);
045                    sb.append(", createDate=");
046                    sb.append(createDate);
047                    sb.append(", modifiedDate=");
048                    sb.append(modifiedDate);
049                    sb.append(", classNameId=");
050                    sb.append(classNameId);
051                    sb.append(", name=");
052                    sb.append(name);
053                    sb.append(", description=");
054                    sb.append(description);
055                    sb.append(", portletId=");
056                    sb.append(portletId);
057                    sb.append(", typeSettings=");
058                    sb.append(typeSettings);
059                    sb.append(", dlFolderId=");
060                    sb.append(dlFolderId);
061                    sb.append("}");
062    
063                    return sb.toString();
064            }
065    
066            public Repository toEntityModel() {
067                    RepositoryImpl repositoryImpl = new RepositoryImpl();
068    
069                    repositoryImpl.setRepositoryId(repositoryId);
070                    repositoryImpl.setGroupId(groupId);
071                    repositoryImpl.setCompanyId(companyId);
072    
073                    if (createDate == Long.MIN_VALUE) {
074                            repositoryImpl.setCreateDate(null);
075                    }
076                    else {
077                            repositoryImpl.setCreateDate(new Date(createDate));
078                    }
079    
080                    if (modifiedDate == Long.MIN_VALUE) {
081                            repositoryImpl.setModifiedDate(null);
082                    }
083                    else {
084                            repositoryImpl.setModifiedDate(new Date(modifiedDate));
085                    }
086    
087                    repositoryImpl.setClassNameId(classNameId);
088    
089                    if (name == null) {
090                            repositoryImpl.setName(StringPool.BLANK);
091                    }
092                    else {
093                            repositoryImpl.setName(name);
094                    }
095    
096                    if (description == null) {
097                            repositoryImpl.setDescription(StringPool.BLANK);
098                    }
099                    else {
100                            repositoryImpl.setDescription(description);
101                    }
102    
103                    if (portletId == null) {
104                            repositoryImpl.setPortletId(StringPool.BLANK);
105                    }
106                    else {
107                            repositoryImpl.setPortletId(portletId);
108                    }
109    
110                    if (typeSettings == null) {
111                            repositoryImpl.setTypeSettings(StringPool.BLANK);
112                    }
113                    else {
114                            repositoryImpl.setTypeSettings(typeSettings);
115                    }
116    
117                    repositoryImpl.setDlFolderId(dlFolderId);
118    
119                    repositoryImpl.resetOriginalValues();
120    
121                    return repositoryImpl;
122            }
123    
124            public long repositoryId;
125            public long groupId;
126            public long companyId;
127            public long createDate;
128            public long modifiedDate;
129            public long classNameId;
130            public String name;
131            public String description;
132            public String portletId;
133            public String typeSettings;
134            public long dlFolderId;
135    }