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: ContentImage.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: import com.uwyn.rife.site.Validation;
13:
14: public class ContentImage extends Validation {
15: private int mId = -1;
16: private String mName = null;
17: private byte[] mImage = null;
18:
19: public ContentImage() {
20: }
21:
22: protected void activateValidation() {
23: addConstraint(new ConstrainedProperty("name").maxLength(64)
24: .notNull(true).notEmpty(true));
25: addConstraint(new ConstrainedProperty("image").notNull(true)
26: .mimeType(MimeType.IMAGE_PNG).name("myimage.png"));
27: }
28:
29: public void setId(int id) {
30: mId = id;
31: }
32:
33: public int getId() {
34: return mId;
35: }
36:
37: public void setName(String name) {
38: mName = name;
39: }
40:
41: public String getName() {
42: return mName;
43: }
44:
45: public ContentImage name(String name) {
46: mName = name;
47:
48: return this ;
49: }
50:
51: public byte[] getImage() {
52: return mImage;
53: }
54:
55: public void setImage(byte[] image) {
56: mImage = image;
57: }
58:
59: public ContentImage image(byte[] image) {
60: mImage = image;
61:
62: return this;
63: }
64: }
|