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.Ticket;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing Ticket in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see Ticket
031     * @generated
032     */
033    public class TicketCacheModel implements CacheModel<Ticket>, Serializable {
034            @Override
035            public String toString() {
036                    StringBundler sb = new StringBundler(19);
037    
038                    sb.append("{ticketId=");
039                    sb.append(ticketId);
040                    sb.append(", companyId=");
041                    sb.append(companyId);
042                    sb.append(", createDate=");
043                    sb.append(createDate);
044                    sb.append(", classNameId=");
045                    sb.append(classNameId);
046                    sb.append(", classPK=");
047                    sb.append(classPK);
048                    sb.append(", key=");
049                    sb.append(key);
050                    sb.append(", type=");
051                    sb.append(type);
052                    sb.append(", extraInfo=");
053                    sb.append(extraInfo);
054                    sb.append(", expirationDate=");
055                    sb.append(expirationDate);
056                    sb.append("}");
057    
058                    return sb.toString();
059            }
060    
061            public Ticket toEntityModel() {
062                    TicketImpl ticketImpl = new TicketImpl();
063    
064                    ticketImpl.setTicketId(ticketId);
065                    ticketImpl.setCompanyId(companyId);
066    
067                    if (createDate == Long.MIN_VALUE) {
068                            ticketImpl.setCreateDate(null);
069                    }
070                    else {
071                            ticketImpl.setCreateDate(new Date(createDate));
072                    }
073    
074                    ticketImpl.setClassNameId(classNameId);
075                    ticketImpl.setClassPK(classPK);
076    
077                    if (key == null) {
078                            ticketImpl.setKey(StringPool.BLANK);
079                    }
080                    else {
081                            ticketImpl.setKey(key);
082                    }
083    
084                    ticketImpl.setType(type);
085    
086                    if (extraInfo == null) {
087                            ticketImpl.setExtraInfo(StringPool.BLANK);
088                    }
089                    else {
090                            ticketImpl.setExtraInfo(extraInfo);
091                    }
092    
093                    if (expirationDate == Long.MIN_VALUE) {
094                            ticketImpl.setExpirationDate(null);
095                    }
096                    else {
097                            ticketImpl.setExpirationDate(new Date(expirationDate));
098                    }
099    
100                    ticketImpl.resetOriginalValues();
101    
102                    return ticketImpl;
103            }
104    
105            public long ticketId;
106            public long companyId;
107            public long createDate;
108            public long classNameId;
109            public long classPK;
110            public String key;
111            public int type;
112            public String extraInfo;
113            public long expirationDate;
114    }