01: package de.schlund.pfixcore.example;
02:
03: import java.util.HashMap;
04:
05: import org.w3c.dom.Element;
06:
07: import de.schlund.pfixcore.workflow.Context;
08: import de.schlund.pfixxml.ResultDocument;
09:
10: /**
11: * Describe class ContextSimpleDataImpl here.
12: *
13: *
14: * Created: Tue Jun 13 12:13:57 2006
15: *
16: * @author <a href="mailto:jtl@schlund.de">Jens Lautenbacher</a>
17: * @version 1.0
18: */
19: public class ContextSimpleDataImpl implements ContextSimpleData {
20:
21: private HashMap<String, String> data;
22:
23: // Implementation of de.schlund.pfixcore.workflow.ContextResource
24:
25: /**
26: * Describe <code>insertStatus</code> method here.
27: *
28: * @param resultDocument a <code>ResultDocument</code> value
29: * @param element an <code>Element</code> value
30: * @exception Exception if an error occurs
31: */
32: public final void insertStatus(final ResultDocument resdoc,
33: final Element element) throws Exception {
34: for (String key : data.keySet()) {
35: String value = data.get(key);
36: Element sub = resdoc.createNode(key);
37: sub.setAttribute("value", value);
38: element.appendChild(sub);
39: }
40:
41: }
42:
43: /**
44: * Describe <code>init</code> method here.
45: *
46: * @param context a <code>Context</code> value
47: * @exception Exception if an error occurs
48: */
49: public final void init(final Context context) throws Exception {
50: data = new HashMap<String, String>();
51: }
52:
53: public final void reset() {
54: data.clear();
55: }
56:
57: // Implementation of de.schlund.pfixcore.example.ContextSimpleData
58:
59: /**
60: * Describe <code>getValue</code> method here.
61: *
62: * @param string a <code>String</code> value
63: * @return a <code>String</code> value
64: */
65: public final String getValue(final String string) {
66: return data.get(string);
67: }
68:
69: /**
70: * Describe <code>setValue</code> method here.
71: *
72: * @param string a <code>String</code> value
73: * @param string1 a <code>String</code> value
74: */
75: public final void setValue(final String key, final String value) {
76: data.put(key, value);
77: }
78:
79: }
|