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.Image;
021    
022    import java.io.Serializable;
023    
024    import java.util.Date;
025    
026    /**
027     * The cache model class for representing Image in entity cache.
028     *
029     * @author Brian Wing Shun Chan
030     * @see Image
031     * @generated
032     */
033    public class ImageCacheModel implements CacheModel<Image>, Serializable {
034            @Override
035            public String toString() {
036                    StringBundler sb = new StringBundler(15);
037    
038                    sb.append("{imageId=");
039                    sb.append(imageId);
040                    sb.append(", modifiedDate=");
041                    sb.append(modifiedDate);
042                    sb.append(", text=");
043                    sb.append(text);
044                    sb.append(", type=");
045                    sb.append(type);
046                    sb.append(", height=");
047                    sb.append(height);
048                    sb.append(", width=");
049                    sb.append(width);
050                    sb.append(", size=");
051                    sb.append(size);
052                    sb.append("}");
053    
054                    return sb.toString();
055            }
056    
057            public Image toEntityModel() {
058                    ImageImpl imageImpl = new ImageImpl();
059    
060                    imageImpl.setImageId(imageId);
061    
062                    if (modifiedDate == Long.MIN_VALUE) {
063                            imageImpl.setModifiedDate(null);
064                    }
065                    else {
066                            imageImpl.setModifiedDate(new Date(modifiedDate));
067                    }
068    
069                    if (text == null) {
070                            imageImpl.setText(StringPool.BLANK);
071                    }
072                    else {
073                            imageImpl.setText(text);
074                    }
075    
076                    if (type == null) {
077                            imageImpl.setType(StringPool.BLANK);
078                    }
079                    else {
080                            imageImpl.setType(type);
081                    }
082    
083                    imageImpl.setHeight(height);
084                    imageImpl.setWidth(width);
085                    imageImpl.setSize(size);
086    
087                    imageImpl.resetOriginalValues();
088    
089                    return imageImpl;
090            }
091    
092            public long imageId;
093            public long modifiedDate;
094            public String text;
095            public String type;
096            public int height;
097            public int width;
098            public int size;
099    }