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