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