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: BeanSnapback.java 3714 2007-04-08 02:57:38Z gbevin $
07: */
08: package com.uwyn.rife.engine.testelements.exits;
09:
10: import com.uwyn.rife.config.RifeConfig;
11: import com.uwyn.rife.engine.Element;
12: import com.uwyn.rife.tools.BeanUtils;
13: import java.util.Calendar;
14:
15: public class BeanSnapback extends Element {
16: public void processElement() {
17: Calendar cal = Calendar.getInstance(RifeConfig.Tools
18: .getDefaultTimeZone());
19: cal.clear();
20:
21: if (hasInputValue("selector")
22: && getInput("selector").equals("exit")) {
23: BeanImpl1 bean = new BeanImpl1();
24: bean.setString1("stringvalue1");
25: bean.setString2("stringvalue2");
26: bean.setString3("stringvalue3");
27: bean.setEnum4(BeanImpl1.Day.SUNDAY);
28: cal.set(2007, 2, 13, 8, 27, 12);
29: bean.setDate5(cal.getTime());
30:
31: setOutputBean(bean);
32: exit("beanexit");
33: }
34: BeanImpl1 bean1 = getInputBean(BeanImpl1.class);
35: print(bean1.getString1()
36: + ","
37: + bean1.getString2()
38: + ","
39: + bean1.getString3()
40: + ","
41: + bean1.getEnum4()
42: + ","
43: + BeanUtils.getConcisePreciseDateFormat().format(
44: bean1.getDate5()));
45: }
46: }
|