1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.util.GetterUtil;
26 import com.liferay.portal.model.impl.BaseModelImpl;
27 import com.liferay.portal.util.PropsUtil;
28
29 import com.liferay.util.XSSUtil;
30
31 import java.io.Serializable;
32
33 import java.sql.Types;
34
35 import java.util.Date;
36
37
56 public class ImageModelImpl extends BaseModelImpl {
57 public static String TABLE_NAME = "Image";
58 public static Object[][] TABLE_COLUMNS = {
59 { "imageId", new Integer(Types.BIGINT) },
60 { "modifiedDate", new Integer(Types.TIMESTAMP) },
61 { "text_", new Integer(Types.CLOB) },
62 { "type_", new Integer(Types.VARCHAR) },
63 { "height", new Integer(Types.INTEGER) },
64 { "width", new Integer(Types.INTEGER) },
65 { "size_", new Integer(Types.INTEGER) }
66 };
67 public static String TABLE_SQL_CREATE = "create table Image (imageId LONG not null primary key,modifiedDate DATE null,text_ TEXT null,type_ VARCHAR(75) null,height INTEGER,width INTEGER,size_ INTEGER)";
68 public static String TABLE_SQL_DROP = "drop table Image";
69 public static boolean XSS_ALLOW_BY_MODEL = GetterUtil.getBoolean(PropsUtil.get(
70 "xss.allow.com.liferay.portal.model.Image"), XSS_ALLOW);
71 public static boolean XSS_ALLOW_TEXT = GetterUtil.getBoolean(PropsUtil.get(
72 "xss.allow.com.liferay.portal.model.Image.text"),
73 XSS_ALLOW_BY_MODEL);
74 public static boolean XSS_ALLOW_TYPE = GetterUtil.getBoolean(PropsUtil.get(
75 "xss.allow.com.liferay.portal.model.Image.type"),
76 XSS_ALLOW_BY_MODEL);
77 public static long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
78 "lock.expiration.time.com.liferay.portal.model.ImageModel"));
79
80 public ImageModelImpl() {
81 }
82
83 public long getPrimaryKey() {
84 return _imageId;
85 }
86
87 public void setPrimaryKey(long pk) {
88 setImageId(pk);
89 }
90
91 public Serializable getPrimaryKeyObj() {
92 return new Long(_imageId);
93 }
94
95 public long getImageId() {
96 return _imageId;
97 }
98
99 public void setImageId(long imageId) {
100 if (imageId != _imageId) {
101 _imageId = imageId;
102 }
103 }
104
105 public Date getModifiedDate() {
106 return _modifiedDate;
107 }
108
109 public void setModifiedDate(Date modifiedDate) {
110 if (((modifiedDate == null) && (_modifiedDate != null)) ||
111 ((modifiedDate != null) && (_modifiedDate == null)) ||
112 ((modifiedDate != null) && (_modifiedDate != null) &&
113 !modifiedDate.equals(_modifiedDate))) {
114 _modifiedDate = modifiedDate;
115 }
116 }
117
118 public String getText() {
119 return GetterUtil.getString(_text);
120 }
121
122 public void setText(String text) {
123 if (((text == null) && (_text != null)) ||
124 ((text != null) && (_text == null)) ||
125 ((text != null) && (_text != null) && !text.equals(_text))) {
126 if (!XSS_ALLOW_TEXT) {
127 text = XSSUtil.strip(text);
128 }
129
130 _text = text;
131 }
132 }
133
134 public String getType() {
135 return GetterUtil.getString(_type);
136 }
137
138 public void setType(String type) {
139 if (((type == null) && (_type != null)) ||
140 ((type != null) && (_type == null)) ||
141 ((type != null) && (_type != null) && !type.equals(_type))) {
142 if (!XSS_ALLOW_TYPE) {
143 type = XSSUtil.strip(type);
144 }
145
146 _type = type;
147 }
148 }
149
150 public int getHeight() {
151 return _height;
152 }
153
154 public void setHeight(int height) {
155 if (height != _height) {
156 _height = height;
157 }
158 }
159
160 public int getWidth() {
161 return _width;
162 }
163
164 public void setWidth(int width) {
165 if (width != _width) {
166 _width = width;
167 }
168 }
169
170 public int getSize() {
171 return _size;
172 }
173
174 public void setSize(int size) {
175 if (size != _size) {
176 _size = size;
177 }
178 }
179
180 public Object clone() {
181 ImageImpl clone = new ImageImpl();
182 clone.setImageId(getImageId());
183 clone.setModifiedDate(getModifiedDate());
184 clone.setText(getText());
185 clone.setType(getType());
186 clone.setHeight(getHeight());
187 clone.setWidth(getWidth());
188 clone.setSize(getSize());
189
190 return clone;
191 }
192
193 public int compareTo(Object obj) {
194 if (obj == null) {
195 return -1;
196 }
197
198 ImageImpl image = (ImageImpl)obj;
199 int value = 0;
200
201 if (getImageId() < image.getImageId()) {
202 value = -1;
203 }
204 else if (getImageId() > image.getImageId()) {
205 value = 1;
206 }
207 else {
208 value = 0;
209 }
210
211 if (value != 0) {
212 return value;
213 }
214
215 return 0;
216 }
217
218 public boolean equals(Object obj) {
219 if (obj == null) {
220 return false;
221 }
222
223 ImageImpl image = null;
224
225 try {
226 image = (ImageImpl)obj;
227 }
228 catch (ClassCastException cce) {
229 return false;
230 }
231
232 long pk = image.getPrimaryKey();
233
234 if (getPrimaryKey() == pk) {
235 return true;
236 }
237 else {
238 return false;
239 }
240 }
241
242 public int hashCode() {
243 return (int)getPrimaryKey();
244 }
245
246 private long _imageId;
247 private Date _modifiedDate;
248 private String _text;
249 private String _type;
250 private int _height;
251 private int _width;
252 private int _size;
253 }