001
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
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 }