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: AutolinkAnnotationSource.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.engine.annotations.Autolink;
13: import com.uwyn.rife.engine.annotations.Elem;
14: import com.uwyn.rife.engine.annotations.InputProperty;
15: import com.uwyn.rife.engine.annotations.OutBeanProperty;
16: import com.uwyn.rife.engine.annotations.OutputProperty;
17: import java.util.Calendar;
18:
19: @Elem(id="AUTOLINK_ANN_SRC",autolinks={@Autolink(destClass=AutolinkAnnotationDestination.class)})
20: public class AutolinkAnnotationSource extends Element {
21: private String mType;
22: private String mValue1;
23: private String mValue2;
24: private String mValue3;
25: private BeanImpl1 mBean1;
26: private BeanImpl2 mBean2;
27:
28: @InputProperty
29: public void setType(String type) {
30: mType = type;
31: }
32:
33: @OutputProperty
34: public String getValue1() {
35: return mValue1;
36: }
37:
38: @OutputProperty
39: public String getValue2() {
40: return mValue2;
41: }
42:
43: @OutputProperty
44: public String getValue3() {
45: return mValue3;
46: }
47:
48: @OutBeanProperty
49: public BeanImpl1 getBean1() {
50: return mBean1;
51: }
52:
53: @OutBeanProperty(prefix="out_")
54: public BeanImpl2 getBean2() {
55: return mBean2;
56: }
57:
58: public void processElement() {
59: Calendar cal = Calendar.getInstance(RifeConfig.Tools
60: .getDefaultTimeZone());
61: cal.clear();
62:
63: mValue1 = "output1 value";
64: mValue2 = "output2 value";
65: mValue3 = "output3 value";
66:
67: cal.set(2007, 3, 21, 8, 23, 32);
68: mBean2 = new BeanImpl2();
69: mBean2.setEnum4(BeanImpl1.Day.SATURDAY);
70: mBean2.setDate5(cal.getTime());
71: mBean2.setString6("stringvalue6");
72: mBean2.setString7("stringvalue7");
73: mBean2.setString8("stringvalue8");
74:
75: cal.set(2007, 2, 13, 8, 23, 32);
76: mBean1 = new BeanImpl1();
77: mBean1.setString1("stringvalue1");
78: mBean1.setString2("stringvalue2");
79: mBean1.setString3("stringvalue3");
80: mBean1.setEnum4(BeanImpl1.Day.TUESDAY);
81: mBean1.setDate5(cal.getTime());
82:
83: if ("directlink".equals(mType)) {
84: print("<html><body>");
85: print("<a href=\"" + getExitQueryUrl("AUTOLINK_ANN_DST")
86: + "\">link</a>");
87: print("</body></html>");
88: } else {
89: exit("AUTOLINK_ANN_DST");
90: }
91: }
92: }
|