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: NamedBeanPrefixInjection.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine.testelements.inputs;
09:
10: import com.uwyn.rife.engine.Element;
11: import com.uwyn.rife.site.ValidationError;
12:
13: import java.util.Set;
14:
15: public class NamedBeanPrefixInjection extends Element {
16: public void processElement() {
17: BeanImpl bean = getNamedInputBean("the_bean");
18: boolean notnumeric_int = false;
19: boolean notnumeric_double = false;
20: boolean notnumeric_longobject = false;
21:
22: Set<ValidationError> errors = bean.getValidationErrors();
23: for (ValidationError error : errors) {
24: if (error.getIdentifier().equals("NOTNUMERIC")) {
25: if (error.getSubject().equals("int")) {
26: notnumeric_int = true;
27: }
28: if (error.getSubject().equals("double")) {
29: notnumeric_double = true;
30: }
31: if (error.getSubject().equals("longObject")) {
32: notnumeric_longobject = true;
33: }
34: }
35: }
36: if (notnumeric_int) {
37: print("NOTNUMERIC : int\n");
38: }
39: if (notnumeric_double) {
40: print("NOTNUMERIC : double\n");
41: }
42: if (notnumeric_longobject) {
43: print("NOTNUMERIC : longObject\n");
44: }
45: print(bean.getString() + "," + bean.getStringbuffer() + ","
46: + bean.getInt() + "," + bean.getInteger() + ","
47: + bean.getChar() + "," + bean.getCharacter() + ","
48: + bean.isBoolean() + "," + bean.getBooleanObject()
49: + "," + bean.getByte() + "," + bean.getByteObject()
50: + "," + bean.getDouble() + "," + bean.getDoubleObject()
51: + "," + bean.getFloat() + "," + bean.getFloatObject()
52: + "," + bean.getLong() + "," + bean.getLongObject()
53: + "," + bean.getShort() + "," + bean.getShortObject());
54: }
55: }
|