1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package tools.gsf.facade.runtag.xlat;
18
19 import COM.FutureTense.Interfaces.ICS;
20 import tools.gsf.facade.runtag.AbstractTagRunner;
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25
26
27
28
29
30
31 public final class Stream extends AbstractTagRunner {
32
33 public Stream() {
34 super("XLAT.STREAM");
35 }
36
37
38
39
40
41
42 public void setKey(String s) {
43
44 if (s == null || s.length() == 0) {
45 throw new IllegalArgumentException("Invalid key string: " + s);
46 }
47 this.set("KEY", s);
48 }
49
50
51
52
53
54
55 public void setLocale(String s) {
56
57 if (s == null || s.length() == 0) {
58 throw new IllegalArgumentException("Invalid locale string: " + s);
59 }
60 this.set("LOCALE", s);
61 }
62
63
64
65
66
67
68 public void setEncode(String s) {
69
70 if (s == null || s.length() == 0 || !s.equals("true") && !s.equals("false")) {
71 throw new IllegalArgumentException("Invalid encode string: " + s);
72 }
73 this.set("ENCODE", s);
74 }
75
76
77
78
79
80
81 public void setEscape(String s) {
82
83 if (s == null || s.length() == 0 || !s.equals("true") && !s.equals("false")) {
84 throw new IllegalArgumentException("Invalid escape string: " + s);
85 }
86 this.set("ESCAPE", s);
87 }
88
89
90
91
92
93
94 public void setEvalAll(String s) {
95
96 if (s == null || s.length() == 0 || !s.equals("true") && !s.equals("false")) {
97 throw new IllegalArgumentException("Invalid evalall string: " + s);
98 }
99 this.set("EVALALL", s);
100 }
101
102
103
104
105
106
107
108
109 public void setArgument(String argname, String argvalue) {
110
111 if (argname == null || argname.length() == 0) {
112 throw new IllegalArgumentException("Invalid argname string: " + argname);
113 }
114 if (argvalue == null || argvalue.length() == 0) {
115 throw new IllegalArgumentException("Invalid argvalue string: " + argvalue);
116 }
117 this.set(argname, argvalue);
118 }
119
120 protected void preExecute(ICS ics) {
121
122
123 super.preExecute(ics);
124
125 List<String> newVars = new ArrayList<String>();
126 for (Object oKey : list.keySet()) {
127 String sKey = (String) oKey;
128 if (ics.GetVar(sKey) == null) {
129 newVars.add(sKey);
130 ics.SetVar(sKey, list.getValString(sKey));
131 }
132 }
133 ics.SetObj("NewVars", newVars);
134 }
135
136 @SuppressWarnings("unchecked")
137 protected void postExecute(ICS ics) {
138 super.postExecute(ics);
139 List<String> newVars = (List<String>) ics.GetObj("NewVars");
140 for (String toRemove : newVars) {
141 ics.RemoveVar(toRemove);
142 }
143 ics.SetObj("NewVars", null);
144 }
145
146 }