1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.rundeck.api;
17
18 import java.util.Properties;
19 import org.apache.commons.lang.StringUtils;
20
21
22
23
24
25
26 public class NodeFiltersBuilder {
27
28 private final Properties filters;
29
30
31
32
33 public NodeFiltersBuilder() {
34 filters = new Properties();
35 }
36
37
38
39
40
41
42
43
44 public NodeFiltersBuilder hostname(String hostname) {
45 if (StringUtils.isNotBlank(hostname)) {
46 filters.put("hostname", hostname);
47 }
48 return this;
49 }
50
51
52
53
54
55
56
57
58 public NodeFiltersBuilder type(String type) {
59 if (StringUtils.isNotBlank(type)) {
60 filters.put("type", type);
61 }
62 return this;
63 }
64
65
66
67
68
69
70
71
72 public NodeFiltersBuilder tags(String tags) {
73 if (StringUtils.isNotBlank(tags)) {
74 filters.put("tags", tags);
75 }
76 return this;
77 }
78
79
80
81
82
83
84
85
86 public NodeFiltersBuilder name(String name) {
87 if (StringUtils.isNotBlank(name)) {
88 filters.put("name", name);
89 }
90 return this;
91 }
92
93
94
95
96
97
98
99
100 public NodeFiltersBuilder osName(String osName) {
101 if (StringUtils.isNotBlank(osName)) {
102 filters.put("os-name", osName);
103 }
104 return this;
105 }
106
107
108
109
110
111
112
113
114 public NodeFiltersBuilder osFamily(String osFamily) {
115 if (StringUtils.isNotBlank(osFamily)) {
116 filters.put("os-family", osFamily);
117 }
118 return this;
119 }
120
121
122
123
124
125
126
127
128 public NodeFiltersBuilder osArch(String osArch) {
129 if (StringUtils.isNotBlank(osArch)) {
130 filters.put("os-arch", osArch);
131 }
132 return this;
133 }
134
135
136
137
138
139
140
141
142 public NodeFiltersBuilder osVersion(String osVersion) {
143 if (StringUtils.isNotBlank(osVersion)) {
144 filters.put("os-version", osVersion);
145 }
146 return this;
147 }
148
149
150
151
152
153
154
155
156
157 public NodeFiltersBuilder excludeHostname(String hostname) {
158 if (StringUtils.isNotBlank(hostname)) {
159 filters.put("exclude-hostname", hostname);
160 }
161 return this;
162 }
163
164
165
166
167
168
169
170
171
172 public NodeFiltersBuilder excludeType(String type) {
173 if (StringUtils.isNotBlank(type)) {
174 filters.put("exclude-type", type);
175 }
176 return this;
177 }
178
179
180
181
182
183
184
185
186
187 public NodeFiltersBuilder excludeTags(String tags) {
188 if (StringUtils.isNotBlank(tags)) {
189 filters.put("exclude-tags", tags);
190 }
191 return this;
192 }
193
194
195
196
197
198
199
200
201
202 public NodeFiltersBuilder excludeName(String name) {
203 if (StringUtils.isNotBlank(name)) {
204 filters.put("exclude-name", name);
205 }
206 return this;
207 }
208
209
210
211
212
213
214
215
216
217 public NodeFiltersBuilder excludeOsName(String osName) {
218 if (StringUtils.isNotBlank(osName)) {
219 filters.put("exclude-os-name", osName);
220 }
221 return this;
222 }
223
224
225
226
227
228
229
230
231
232 public NodeFiltersBuilder excludeOsFamily(String osFamily) {
233 if (StringUtils.isNotBlank(osFamily)) {
234 filters.put("exclude-os-family", osFamily);
235 }
236 return this;
237 }
238
239
240
241
242
243
244
245
246
247 public NodeFiltersBuilder excludeOsArch(String osArch) {
248 if (StringUtils.isNotBlank(osArch)) {
249 filters.put("exclude-os-arch", osArch);
250 }
251 return this;
252 }
253
254
255
256
257
258
259
260
261
262 public NodeFiltersBuilder excludeOsVersion(String osVersion) {
263 if (StringUtils.isNotBlank(osVersion)) {
264 filters.put("exclude-os-version", osVersion);
265 }
266 return this;
267 }
268
269
270
271
272
273
274
275 public NodeFiltersBuilder excludePrecedence(boolean excludePrecedence) {
276 filters.put("exclude-precedence", Boolean.toString(excludePrecedence));
277 return this;
278 }
279
280
281
282
283 public Properties toProperties() {
284 Properties filters = new Properties();
285 filters.putAll(this.filters);
286 return filters;
287 }
288
289 }