001    /**
002     * Copyright (c) 2000-2012 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.ResourceBlock;
021    
022    import java.io.Serializable;
023    
024    /**
025     * The cache model class for representing ResourceBlock in entity cache.
026     *
027     * @author Brian Wing Shun Chan
028     * @see ResourceBlock
029     * @generated
030     */
031    public class ResourceBlockCacheModel implements CacheModel<ResourceBlock>,
032            Serializable {
033            @Override
034            public String toString() {
035                    StringBundler sb = new StringBundler(13);
036    
037                    sb.append("{resourceBlockId=");
038                    sb.append(resourceBlockId);
039                    sb.append(", companyId=");
040                    sb.append(companyId);
041                    sb.append(", groupId=");
042                    sb.append(groupId);
043                    sb.append(", name=");
044                    sb.append(name);
045                    sb.append(", permissionsHash=");
046                    sb.append(permissionsHash);
047                    sb.append(", referenceCount=");
048                    sb.append(referenceCount);
049                    sb.append("}");
050    
051                    return sb.toString();
052            }
053    
054            public ResourceBlock toEntityModel() {
055                    ResourceBlockImpl resourceBlockImpl = new ResourceBlockImpl();
056    
057                    resourceBlockImpl.setResourceBlockId(resourceBlockId);
058                    resourceBlockImpl.setCompanyId(companyId);
059                    resourceBlockImpl.setGroupId(groupId);
060    
061                    if (name == null) {
062                            resourceBlockImpl.setName(StringPool.BLANK);
063                    }
064                    else {
065                            resourceBlockImpl.setName(name);
066                    }
067    
068                    if (permissionsHash == null) {
069                            resourceBlockImpl.setPermissionsHash(StringPool.BLANK);
070                    }
071                    else {
072                            resourceBlockImpl.setPermissionsHash(permissionsHash);
073                    }
074    
075                    resourceBlockImpl.setReferenceCount(referenceCount);
076    
077                    resourceBlockImpl.resetOriginalValues();
078    
079                    return resourceBlockImpl;
080            }
081    
082            public long resourceBlockId;
083            public long companyId;
084            public long groupId;
085            public String name;
086            public String permissionsHash;
087            public long referenceCount;
088    }