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.Lock;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing Lock in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see Lock
031     * @generated
032     */
033    public class LockCacheModel implements CacheModel<Lock>, Serializable {
034            @Override
035            public String toString() {
036                    StringBundler sb = new StringBundler(23);
037    
038                    sb.append("{uuid=");
039                    sb.append(uuid);
040                    sb.append(", lockId=");
041                    sb.append(lockId);
042                    sb.append(", companyId=");
043                    sb.append(companyId);
044                    sb.append(", userId=");
045                    sb.append(userId);
046                    sb.append(", userName=");
047                    sb.append(userName);
048                    sb.append(", createDate=");
049                    sb.append(createDate);
050                    sb.append(", className=");
051                    sb.append(className);
052                    sb.append(", key=");
053                    sb.append(key);
054                    sb.append(", owner=");
055                    sb.append(owner);
056                    sb.append(", inheritable=");
057                    sb.append(inheritable);
058                    sb.append(", expirationDate=");
059                    sb.append(expirationDate);
060                    sb.append("}");
061    
062                    return sb.toString();
063            }
064    
065            public Lock toEntityModel() {
066                    LockImpl lockImpl = new LockImpl();
067    
068                    if (uuid == null) {
069                            lockImpl.setUuid(StringPool.BLANK);
070                    }
071                    else {
072                            lockImpl.setUuid(uuid);
073                    }
074    
075                    lockImpl.setLockId(lockId);
076                    lockImpl.setCompanyId(companyId);
077                    lockImpl.setUserId(userId);
078    
079                    if (userName == null) {
080                            lockImpl.setUserName(StringPool.BLANK);
081                    }
082                    else {
083                            lockImpl.setUserName(userName);
084                    }
085    
086                    if (createDate == Long.MIN_VALUE) {
087                            lockImpl.setCreateDate(null);
088                    }
089                    else {
090                            lockImpl.setCreateDate(new Date(createDate));
091                    }
092    
093                    if (className == null) {
094                            lockImpl.setClassName(StringPool.BLANK);
095                    }
096                    else {
097                            lockImpl.setClassName(className);
098                    }
099    
100                    if (key == null) {
101                            lockImpl.setKey(StringPool.BLANK);
102                    }
103                    else {
104                            lockImpl.setKey(key);
105                    }
106    
107                    if (owner == null) {
108                            lockImpl.setOwner(StringPool.BLANK);
109                    }
110                    else {
111                            lockImpl.setOwner(owner);
112                    }
113    
114                    lockImpl.setInheritable(inheritable);
115    
116                    if (expirationDate == Long.MIN_VALUE) {
117                            lockImpl.setExpirationDate(null);
118                    }
119                    else {
120                            lockImpl.setExpirationDate(new Date(expirationDate));
121                    }
122    
123                    lockImpl.resetOriginalValues();
124    
125                    return lockImpl;
126            }
127    
128            public String uuid;
129            public long lockId;
130            public long companyId;
131            public long userId;
132            public String userName;
133            public long createDate;
134            public String className;
135            public String key;
136            public String owner;
137            public boolean inheritable;
138            public long expirationDate;
139    }