-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOptionsConverter.java
More file actions
301 lines (287 loc) · 10.5 KB
/
Copy pathOptionsConverter.java
File metadata and controls
301 lines (287 loc) · 10.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
package org.databunker.options;
import java.util.HashMap;
import java.util.Map;
/**
* Utility class to convert option objects to Map<String, Object> for backward compatibility
*/
public class OptionsConverter {
/**
* Converts BasicOptions to Map<String, Object>
* @param options The BasicOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(BasicOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getFinaltime() != null) {
map.put("finaltime", options.getFinaltime());
}
if (options.getSlidingtime() != null) {
map.put("slidingtime", options.getSlidingtime());
}
}
return map;
}
/**
* Converts UserOptions to Map<String, Object>
* @param options The UserOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(UserOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getGroupname() != null) {
map.put("groupname", options.getGroupname());
}
if (options.getGroupid() != null) {
map.put("groupid", options.getGroupid());
}
if (options.getRolename() != null) {
map.put("rolename", options.getRolename());
}
if (options.getRoleid() != null) {
map.put("roleid", options.getRoleid());
}
if (options.getSlidingtime() != null) {
map.put("slidingtime", options.getSlidingtime());
}
if (options.getFinaltime() != null) {
map.put("finaltime", options.getFinaltime());
}
}
return map;
}
/**
* Converts SharedRecordOptions to Map<String, Object>
* @param options The SharedRecordOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(SharedRecordOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getFields() != null) {
map.put("fields", options.getFields());
}
if (options.getPartner() != null) {
map.put("partner", options.getPartner());
}
if (options.getAppname() != null) {
map.put("appname", options.getAppname());
}
if (options.getFinaltime() != null) {
map.put("finaltime", options.getFinaltime());
}
}
return map;
}
/**
* Converts LegalBasisOptions to Map<String, Object>
* @param options The LegalBasisOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(LegalBasisOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getBrief() != null) {
map.put("brief", options.getBrief());
}
if (options.getStatus() != null) {
map.put("status", options.getStatus());
}
if (options.getModule() != null) {
map.put("module", options.getModule());
}
if (options.getFulldesc() != null) {
map.put("fulldesc", options.getFulldesc());
}
if (options.getShortdesc() != null) {
map.put("shortdesc", options.getShortdesc());
}
if (options.getBasistype() != null) {
map.put("basistype", options.getBasistype());
}
if (options.getRequiredmsg() != null) {
map.put("requiredmsg", options.getRequiredmsg());
}
if (options.getRequiredflag() != null) {
map.put("requiredflag", options.getRequiredflag());
}
}
return map;
}
/**
* Converts AgreementAcceptOptions to Map<String, Object>
* @param options The AgreementAcceptOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(AgreementAcceptOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getAgreementmethod() != null) {
map.put("agreementmethod", options.getAgreementmethod());
}
if (options.getReferencecode() != null) {
map.put("referencecode", options.getReferencecode());
}
if (options.getStarttime() != null) {
map.put("starttime", options.getStarttime());
}
if (options.getFinaltime() != null) {
map.put("finaltime", options.getFinaltime());
}
if (options.getStatus() != null) {
map.put("status", options.getStatus());
}
if (options.getLastmodifiedby() != null) {
map.put("lastmodifiedby", options.getLastmodifiedby());
}
}
return map;
}
/**
* Converts TenantOptions to Map<String, Object>
* @param options The TenantOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(TenantOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getTenantname() != null) {
map.put("tenantname", options.getTenantname());
}
if (options.getTenantorg() != null) {
map.put("tenantorg", options.getTenantorg());
}
if (options.getEmail() != null) {
map.put("email", options.getEmail());
}
}
return map;
}
/**
* Converts ProcessingActivityOptions to Map<String, Object>
* @param options The ProcessingActivityOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(ProcessingActivityOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getActivity() != null) {
map.put("activity", options.getActivity());
}
if (options.getTitle() != null) {
map.put("title", options.getTitle());
}
if (options.getScript() != null) {
map.put("script", options.getScript());
}
if (options.getFulldesc() != null) {
map.put("fulldesc", options.getFulldesc());
}
if (options.getApplicableto() != null) {
map.put("applicableto", options.getApplicableto());
}
}
return map;
}
/**
* Converts GroupOptions to Map<String, Object>
* @param options The GroupOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(GroupOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getGroupname() != null) {
map.put("groupname", options.getGroupname());
}
if (options.getGrouptype() != null) {
map.put("grouptype", options.getGrouptype());
}
if (options.getGroupdesc() != null) {
map.put("groupdesc", options.getGroupdesc());
}
}
return map;
}
/**
* Converts RoleOptions to Map<String, Object>
* @param options The RoleOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(RoleOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getRolename() != null) {
map.put("rolename", options.getRolename());
}
if (options.getRoledesc() != null) {
map.put("roledesc", options.getRoledesc());
}
}
return map;
}
/**
* Converts TokenOptions to Map<String, Object>
* @param options The TokenOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(TokenOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getUnique() != null) {
map.put("unique", options.getUnique());
}
if (options.getSlidingtime() != null) {
map.put("slidingtime", options.getSlidingtime());
}
if (options.getFinaltime() != null) {
map.put("finaltime", options.getFinaltime());
}
}
return map;
}
/**
* Converts PolicyOptions to Map<String, Object>
* @param options The PolicyOptions object
* @return A Map representation of the options
*/
public static Map<String, Object> toMap(PolicyOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getPolicyname() != null) {
map.put("policyname", options.getPolicyname());
}
if (options.getPolicydesc() != null) {
map.put("policydesc", options.getPolicydesc());
}
if (options.getPolicy() != null) {
map.put("policy", options.getPolicy());
}
}
return map;
}
/**
* Converts FileOptions to a Map
* @param options The FileOptions to convert
* @return A Map containing the non-null options
*/
public static Map<String, Object> toMap(FileOptions options) {
Map<String, Object> map = new HashMap<>();
if (options != null) {
if (options.getMimetype() != null) {
map.put("mimetype", options.getMimetype());
}
if (options.getTags() != null) {
map.put("tags", options.getTags());
}
if (options.getFinaltime() != null) {
map.put("finaltime", options.getFinaltime());
}
if (options.getSlidingtime() != null) {
map.put("slidingtime", options.getSlidingtime());
}
}
return map;
}
}