01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ContentImageAutoRetrieved.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf.dam;
09:
10: import com.uwyn.rife.cmf.MimeType;
11: import com.uwyn.rife.site.ConstrainedProperty;
12:
13: public class ContentImageAutoRetrieved extends ContentImage {
14: private int mId = -1;
15: private String mName = null;
16: private byte[] mImage = null;
17:
18: public ContentImageAutoRetrieved() {
19: }
20:
21: protected void activateValidation() {
22: addConstraint(new ConstrainedProperty("name").maxLength(64)
23: .notNull(true).notEmpty(true));
24: addConstraint(new ConstrainedProperty("image").notNull(true)
25: .mimeType(MimeType.IMAGE_PNG).autoRetrieved(true));
26: }
27:
28: public void setId(int id) {
29: mId = id;
30: }
31:
32: public int getId() {
33: return mId;
34: }
35:
36: public void setName(String name) {
37: mName = name;
38: }
39:
40: public String getName() {
41: return mName;
42: }
43:
44: public ContentImageAutoRetrieved name(String name) {
45: mName = name;
46:
47: return this ;
48: }
49:
50: public byte[] getImage() {
51: return mImage;
52: }
53:
54: public void setImage(byte[] image) {
55: mImage = image;
56: }
57:
58: public ContentImageAutoRetrieved image(byte[] image) {
59: mImage = image;
60:
61: return this;
62: }
63: }
|