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.portlet.shopping.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    
021    import com.liferay.portlet.shopping.model.ShoppingCategory;
022    
023    import java.io.Serializable;
024    
025    import java.util.Date;
026    
027    /**
028     * The cache model class for representing ShoppingCategory in entity cache.
029     *
030     * @author Brian Wing Shun Chan
031     * @see ShoppingCategory
032     * @generated
033     */
034    public class ShoppingCategoryCacheModel implements CacheModel<ShoppingCategory>,
035            Serializable {
036            @Override
037            public String toString() {
038                    StringBundler sb = new StringBundler(21);
039    
040                    sb.append("{categoryId=");
041                    sb.append(categoryId);
042                    sb.append(", groupId=");
043                    sb.append(groupId);
044                    sb.append(", companyId=");
045                    sb.append(companyId);
046                    sb.append(", userId=");
047                    sb.append(userId);
048                    sb.append(", userName=");
049                    sb.append(userName);
050                    sb.append(", createDate=");
051                    sb.append(createDate);
052                    sb.append(", modifiedDate=");
053                    sb.append(modifiedDate);
054                    sb.append(", parentCategoryId=");
055                    sb.append(parentCategoryId);
056                    sb.append(", name=");
057                    sb.append(name);
058                    sb.append(", description=");
059                    sb.append(description);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            public ShoppingCategory toEntityModel() {
066                    ShoppingCategoryImpl shoppingCategoryImpl = new ShoppingCategoryImpl();
067    
068                    shoppingCategoryImpl.setCategoryId(categoryId);
069                    shoppingCategoryImpl.setGroupId(groupId);
070                    shoppingCategoryImpl.setCompanyId(companyId);
071                    shoppingCategoryImpl.setUserId(userId);
072    
073                    if (userName == null) {
074                            shoppingCategoryImpl.setUserName(StringPool.BLANK);
075                    }
076                    else {
077                            shoppingCategoryImpl.setUserName(userName);
078                    }
079    
080                    if (createDate == Long.MIN_VALUE) {
081                            shoppingCategoryImpl.setCreateDate(null);
082                    }
083                    else {
084                            shoppingCategoryImpl.setCreateDate(new Date(createDate));
085                    }
086    
087                    if (modifiedDate == Long.MIN_VALUE) {
088                            shoppingCategoryImpl.setModifiedDate(null);
089                    }
090                    else {
091                            shoppingCategoryImpl.setModifiedDate(new Date(modifiedDate));
092                    }
093    
094                    shoppingCategoryImpl.setParentCategoryId(parentCategoryId);
095    
096                    if (name == null) {
097                            shoppingCategoryImpl.setName(StringPool.BLANK);
098                    }
099                    else {
100                            shoppingCategoryImpl.setName(name);
101                    }
102    
103                    if (description == null) {
104                            shoppingCategoryImpl.setDescription(StringPool.BLANK);
105                    }
106                    else {
107                            shoppingCategoryImpl.setDescription(description);
108                    }
109    
110                    shoppingCategoryImpl.resetOriginalValues();
111    
112                    return shoppingCategoryImpl;
113            }
114    
115            public long categoryId;
116            public long groupId;
117            public long companyId;
118            public long userId;
119            public String userName;
120            public long createDate;
121            public long modifiedDate;
122            public long parentCategoryId;
123            public String name;
124            public String description;
125    }