-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathConversionRules.json
More file actions
565 lines (565 loc) · 35.8 KB
/
ConversionRules.json
File metadata and controls
565 lines (565 loc) · 35.8 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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
{
"hierarchyRules" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Parent element name",
"value" : "BOX",
"operator" : "Equal"
} ],
"script" : "// ---- Link job to folder Rule ----\n\nString argument = \"BOX\";\ndef jobsList = ctmWorkspace.getAllJobs();\njobsList.each { ctmJob ->\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\n\tCtmXmlElement parentElement = jobElement.getParent();\n\tif(parentElement != null && parentElement.getTagName().equals(argument))\n\t{\n\t\tCtmFolder ctmFolder = ctmWorkspace.getFolder(parentElement);\n\t\tctmWorkspace.insertJobToFolder(ctmJob, ctmFolder);\n\t}\n}"
},
"name" : "Link jobs to folders",
"category" : 2,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "",
"value" : "",
"operator" : "Equal"
} ],
"script" : "//---Link folder to folder Rule---\n\nString argument = \"\";\ndef foldersList = ctmWorkspace.getAllFolders();\nfoldersList.each { ctmSubFolder ->\n\tCtmXmlElement subFolderElement = ctmSubFolder.getFolderInputXmlData();\n\tCtmXmlElement parentElement = subFolderElement.getParent();\n\tif(parentElement != null && parentElement.getTagName().equals(argument))\n\t{\n\t\tCtmFolder ctmFolder = ctmWorkspace.getFolder(parentElement);\n\t\tctmWorkspace.insertFolderToFolder(ctmSubFolder, ctmFolder);\n\t}\n}"
},
"name" : "Link folders to folders",
"category" : 2,
"type" : "regular"
} ],
"rulesForServer" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "BOX",
"operator" : "Equal"
} ],
"script" : "// ---- Create Folder Rule ----\n\nString xpathQuery = \"//BOX\"; // XPath query of the XML element we look for in XML Input Data\n\n// Retrieve all elements with tag name equals to \"BOX\" XML elements into folderElements list\nList<CtmXmlElement> folderElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n\n// Run in a loop on all elements with tag name equals to \"BOX\" XML elements found, and create a Control-M Folder for each one of them\n// For each Control-M Folder created we keep the equivalent XML element data\nfor(CtmXmlElement folderElement : folderElements) {\n CtmFolder ctmFolder = ctmWorkspace.createFolder(folderElement);\n}"
},
"name" : "Create Folder",
"category" : 0,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Box_Name",
"operator" : "Equal"
} ],
"script" : "// ---- Folder Name Rule ----\n\n// For each Control-M Folder created we getting the value of attribute name \"Box_Name\" from\n// the equivalent XML element data and set the value to be the Folder name\nString argument = \"Box_Name\";\nctmWorkspace.getAllFolders().each{ ctmFolder ->\n\tCtmXmlElement folderElement = ctmFolder.getFolderInputXmlData();\n\tString folderName = folderElement.getAttribute(argument);\n\tctmFolder.setName(folderName);\n}\n"
},
"name" : "Folder Name",
"category" : 0,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "JOB",
"operator" : "Equal"
} ],
"script" : "// ---- Create Job Rule ----\n\nString xpathQuery = \"//JOB\"; // XPath query of the XML element we look for in XML Input Data\n\n// Retrieve all elements with tag name equals to \"JOB\" XML elements into jobElements list\nList<CtmXmlElement> jobElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n\n// Run in a loop on all elements with tag name equals to \"JOB\" XML elements found, and create a Control-M Job for each one of them\n// For each Control-M Job created we keep the equivalent XML element data\nfor(CtmXmlElement jobElement : jobElements) {\n CtmJob ctmJob = ctmWorkspace.createJob(jobElement);\n}"
},
"name" : "Create Job",
"category" : 1,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Name",
"operator" : "Equal"
} ],
"script" : "// ---- Job Name Rule ----\n\n// For each Control-M Job created we getting the value of attribute name \"Name\" from\n// the equivalent XML element data and set the value to be the Job name\nString argument = \"Name\";\nctmWorkspace.getAllJobs().each{ ctmJob ->\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\n\tString jobName = jobElement.getAttribute(argument);\n\tctmJob.setName(jobName);\n}\n"
},
"name" : "Job Name",
"category" : 1,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Parent element name",
"value" : "BOX",
"operator" : "Equal"
} ],
"script" : "// ---- Link job to folder Rule ----\n\nString argument = \"BOX\";\ndef jobsList = ctmWorkspace.getAllJobs();\njobsList.each { ctmJob ->\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\n\tCtmXmlElement parentElement = jobElement.getParent();\n\tif(parentElement != null && parentElement.getTagName().equals(argument))\n\t{\n\t\tCtmFolder ctmFolder = ctmWorkspace.getFolder(parentElement);\n\t\tctmWorkspace.insertJobToFolder(ctmJob, ctmFolder);\n\t}\n}"
},
"name" : "Link jobs to folders",
"category" : 2,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "After",
"operator" : "Equal"
} ],
"script" : "// ---- In Condition Rule ----\n\ndef jobsList = ctmWorkspace.getAllJobs();\njobsList.each { ctmJob ->\n String targetJob = ctmJob.general().getName();\n // Retrieve all Dependency elements that contain current job name in \"ToJob\" attribute\n String xpathQuery = \"//Dependency[@ToJob=\\\"\" + targetJob + \"\\\"]\";\n List<CtmXmlElement> dependenciesXmlElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n for(CtmXmlElement dependencyElement: dependenciesXmlElements) \n {\n // Get the source job name\n \tString sourceJob = dependencyElement.getAttribute(\"FromJOB\");\n \t// Build condiiton name in {SourceJob-To-TagetJob} pattern\n \tString inConditionName = sourceJob + \"-TO-\" + targetJob;\n \tctmJob.prerequisites().addInCondition(inConditionName);\n }\n}"
},
"name" : "In Condition",
"category" : 4,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Before",
"operator" : "Equal"
} ],
"script" : "// ---- Out Condition Rule ----\n\ndef jobsList = ctmWorkspace.getAllJobs();\njobsList.each { ctmJob ->\n String sourceJob = ctmJob.general().getName();\n // Retrieve all Dependency elements that contain current job name in \"FromJob\" attribute\n String xpathQuery = \"//Dependency[@FromJOB=\\\"\" + sourceJob + \"\\\"]\";\n List<CtmXmlElement> dependenciesXmlElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n for(CtmXmlElement dependencyElement: dependenciesXmlElements) \n {\n // Get the target job name\n \tString targetJob = dependencyElement.getAttribute(\"ToJob\");\n \t// Build condiiton name in {SourceJob-To-TagetJob} pattern\n \tString outConditionName = sourceJob + \"-TO-\" + targetJob;\n \tctmJob.actions().addOutCondition(outConditionName);\n }\n}"
},
"name" : "Out Condition",
"category" : 4,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create Os Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElement.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"OS\")){\r\n\t\tctmJob.setOsType();\r\n\t}\r\n}"
},
"jobTypeName" : "OS",
"name" : "OS Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Command",
"operator" : "Equal"
} ],
"script" : "// ---- Create Os Command Rule ----\r\n\r\nString argument = \"Command\";\r\nctmWorkspace.getOsJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString commandValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().osParameters().setCommand(commandValue);\r\n}"
},
"jobTypeName" : "OS",
"name" : "OS Command",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create Os Run As Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getOsJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString runAsValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().osParameters().setRunAs(runAsValue);\r\n}"
},
"jobTypeName" : "OS",
"name" : "OS Run As",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElementData.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"SAP\")){\r\n\t\tctmJob.setSapR3Type();\r\n\t}\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "SAP R3 Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "jobname",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 jobname Rule ----\r\n\r\nString xpathQuery = \"jobname\";\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> sapXmlElements = jobElementData.getAllDecnedElementByName(xpathQuery);\r\n\tfor(CtmXmlElement sapXmlElement : sapXmlElements) {\r\n\t\tString sAPJobNameValue = sapXmlElement.getText()\r\n\tctmJob.general().sapR3Parameters().setSAPJobName(sAPJobNameValue);\r\n\t}\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "SAP R3 SAP Job Name",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 Connection Profile Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString connectionProfileValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().sapR3Parameters().setConnectionProfile(connectionProfileValue);\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "SAP R3 Connection Profile",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "",
"value" : "",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 Action Rule ----\r\n\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tctmJob.general().sapR3Parameters().setAction(SapR3Action.CreateANewJob);\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "SAP R3 Action",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "abap",
"operator" : "Equal"
} ],
"script" : "//---- Create SapR3 abap Rule ----\r\n\r\nString xpathQuery = \"abap\";\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> abapXmlElements = jobElementData.getAllDecnedElementByName(xpathQuery);\r\n\tfor(CtmXmlElement abapXmlElement : abapXmlElements) {\r\n\t String variant = abapXmlElement.getFirstChildElementByName(\"varientvalue\").getText();\r\n\t String abapProgram = abapXmlElement.getFirstChildElementByName(\"abapprogram\").getText();\r\n \tSapR3AbapStepAPI step = ctmJob.general().sapR3Parameters().addAbapStep();\r\n\t step.setAbapProgramName(abapProgram);\r\n\t step.setVariantName(variant);\r\n }\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "SAP R3 Create - Step Attributes",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapBW Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElement.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"SAPBW\")){\r\n\t\tctmJob.setSapBWType();\r\n\t}\r\n}"
},
"jobTypeName" : "SAP BW",
"name" : "SAP BW Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapBW Connection Profile Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getSapBWJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString connectionProfileValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().sapBWParameters().setConnectionProfile(connectionProfileValue);\r\n}"
},
"jobTypeName" : "SAP BW",
"name" : "SAP BW Connection Profile",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "//---Create SAP BW Process Chain Rule ---\r\n\r\nctmWorkspace.getSapBWJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> ctmXmlElementResult = jobElement.getAllDecnedElementByName(\"type\");\r\n\tfor(CtmXmlElement ctmXmlElement : ctmXmlElementResult)\r\n\t{\r\n\t\tString type = ctmXmlElement.getText();\r\n\t\tif (type != null && type.equals(\"ProcessChain\"))\r\n\t\t{\r\n\t\t CtmXmlElement processChainElement = jobElement.getAllDecnedElementByName(\"ProcessChain\").get(0);\r\n\t\t System.out.println(processChainElement.toString());\r\n\t\t if (processChainElement != null)\r\n\t {\r\n\t ctmJob.general().sapBWParameters().setProcessType(SapBWProcessType.ProcessChain);\r\n\t CtmXmlElement idElement = processChainElement.getFirstChildElementByName(\"ID\");\r\n\t if (idElement != null)\r\n\t ctmJob.general().sapBWParameters().setID(idElement.getText());\r\n\t CtmXmlElement descElement = processChainElement.getFirstChildElementByName(\"Description\");\r\n\t if (descElement != null)\r\n\t ctmJob.general().sapBWParameters().setDescription(descElement.getText());\r\n\t CtmXmlElement rerunOptionElement = processChainElement.getFirstChildElementByName(\"RerunOption\");\r\n\t if (rerunOptionElement != null)\r\n\t {\r\n\t String rerunOption = rerunOptionElement.getText();\r\n\t if (rerunOption.equals(\"FromStart\"))\r\n\t ctmJob.general().sapBWParameters().setReRunOption(SapBWRerunOption.RerunFromStart);\r\n\t }\r\n\t }\r\n\t\t}\r\n\t} \r\n}"
},
"jobTypeName" : "SAP BW",
"name" : "SAP BW Process Chain",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create FileTransfer Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElementData.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"MFT\")){\r\n\t\tctmJob.setFileTransferType();\r\n\t}\r\n}"
},
"jobTypeName" : "File Transfer",
"name" : "File Transfer Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create FileTransfer Connection Profile Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getFileTransferJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString connectionProfileValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().fileTransferParameters().setConnectionProfile(connectionProfileValue);\r\n}"
},
"jobTypeName" : "File Transfer",
"name" : "File Transfer Connection Profile",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "transfer",
"operator" : "Equal"
} ],
"script" : "//---- Create FileTransfer transfer Rule ----\r\n\r\nString xpathQuery = \"transfer\";\r\nctmWorkspace.getFileTransferJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> transferXmlElements = jobElementData.getDirectChildsElementbyName(xpathQuery);\r\n\tfor(CtmXmlElement transferElement : transferXmlElements) {\r\n String tranfertype = transferElement.getFirstChildElementByName(\"tranfertype\").getText();\r\n String leftPath = transferElement.getFirstChildElementByName(\"source\").getText();\r\n String rightPath = transferElement.getFirstChildElementByName(\"destination\").getText();\r\n\t CtmTransfer transfer = ctmJob.general().fileTransferParameters().addNewTransfer();\r\n \ttransfer.setRightPath(rightPath);\r\n \ttransfer.setLeftPath(leftPath);\r\n \tif(tranfertype != null && tranfertype.equals(\"BINARY\")){\r\n \t transfer.setTransferType(TransferType.Binary);\r\n \t}else{\r\n \t transfer.setTransferType(TransferType.Ascii);\r\n \t}\r\n \ttransfer.setTransferOption(TransferOption.Filewatch_And_Transfer_from_left_to_right);\r\n\t}\r\n}"
},
"jobTypeName" : "File Transfer",
"name" : "File Transfer Transfer Attributes",
"category" : 3,
"type" : "script"
} ],
"projectRuleSetDescription" : "",
"folderRules" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "BOX",
"operator" : "Equal"
} ],
"script" : "// ---- Create Folder Rule ----\n\nString xpathQuery = \"//BOX\"; // XPath query of the XML element we look for in XML Input Data\n\n// Retrieve all elements with tag name equals to \"BOX\" XML elements into foldersElementData list\nList<CtmXmlElement> foldersElementData = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n\n// Run in a loop on all elements with tag name equals to \"BOX\" XML elements found, and create a Control-M Folder for each one of them\n// For each Control-M Folder created we keep the equivalent XML element data\nfor(CtmXmlElement folderElementData : foldersElementData) {\n CtmFolder ctmFolder = ctmWorkspace.createFolder(folderElementData);\n}"
},
"name" : "Create Folder",
"category" : 0,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Box_Name",
"operator" : "Equal"
} ],
"script" : "// ---- Folder Name Rule ----\n\n// For each Control-M Folder created we getting the value of attribute name \"Box_Name\" from\n// the equivalent XML element data and set the value to be the Folder name\nString argument = \"Box_Name\";\nctmWorkspace.getAllFolders().each{ ctmFolder ->\n\tCtmXmlElement folderElement = ctmFolder.getFolderInputXmlData();\n\tString folderName = folderElement.getAttribute(argument);\n\tctmFolder.setName(folderName);\n}\n"
},
"name" : "Folder Name",
"category" : 0,
"type" : "regular"
} ],
"jobTypesRules" : {
"OS" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create Os Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElement.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"OS\")){\r\n\t\tctmJob.setOsType();\r\n\t}\r\n}"
},
"jobTypeName" : "OS",
"name" : "Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Command",
"operator" : "Equal"
} ],
"script" : "//---Create Os Command Rule---\r\n\r\nString argument = \"Command\";\r\nctmWorkspace.getOsJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString commandValue = jobElementData.getAttribute(argument);\r\n\tctmJob.general().osParameters().setCommand(commandValue);\r\n}"
},
"jobTypeName" : "OS",
"name" : "Command",
"category" : 3,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "//---Create Os Run As Rule---\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getOsJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString runAsValue = jobElementData.getAttribute(argument);\r\n\tctmJob.general().osParameters().setRunAs(runAsValue);\r\n}"
},
"jobTypeName" : "OS",
"name" : "Run As",
"category" : 3,
"type" : "regular"
} ],
"SAP R3" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElementData.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"SAP\")){\r\n\t\tctmJob.setSapR3Type();\r\n\t}\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "jobname",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 jobname Rule ----\r\n\r\nString xpathQuery = \"jobname\";\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> sapXmlElements = jobElementData.getAllDecnedElementByName(xpathQuery);\r\n\tfor(CtmXmlElement sapXmlElement : sapXmlElements) {\r\n\t\tString sAPJobNameValue = sapXmlElement.getText()\r\n\tctmJob.general().sapR3Parameters().setSAPJobName(sAPJobNameValue);\r\n\t}\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "SAP Job Name",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 Connection Profile Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString connectionProfileValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().sapR3Parameters().setConnectionProfile(connectionProfileValue);\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "Connection Profile",
"category" : 3,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "",
"value" : "",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapR3 Action Rule ----\r\n\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tctmJob.general().sapR3Parameters().setAction(SapR3Action.CreateANewJob);\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "Action",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "abap",
"operator" : "Equal"
} ],
"script" : "//---- Create SapR3 abap Rule ----\r\n\r\nString xpathQuery = \"abap\";\r\nctmWorkspace.getSapR3Jobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> abapXmlElements = jobElementData.getAllDecnedElementByName(xpathQuery);\r\n\tfor(CtmXmlElement abapXmlElement : abapXmlElements) {\r\n\t String variant = abapXmlElement.getFirstChildElementByName(\"varientvalue\").getText();\r\n\t String abapProgram = abapXmlElement.getFirstChildElementByName(\"abapprogram\").getText();\r\n \tSapR3AbapStepAPI step = ctmJob.general().sapR3Parameters().addAbapStep();\r\n\t step.setAbapProgramName(abapProgram);\r\n\t step.setVariantName(variant);\r\n }\r\n}"
},
"jobTypeName" : "SAP R3",
"name" : "Create - Step Attributes",
"category" : 3,
"type" : "script"
} ],
"SAP BW" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapBW Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElement.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"SAPBW\")){\r\n\t\tctmJob.setSapBWType();\r\n\t}\r\n}"
},
"jobTypeName" : "SAP BW",
"name" : "Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create SapBW Connection Profile Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getSapBWJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tString connectionProfileValue = jobElement.getAttribute(argument);\r\n\tctmJob.general().sapBWParameters().setConnectionProfile(connectionProfileValue);\r\n}"
},
"jobTypeName" : "SAP BW",
"name" : "Connection Profile",
"category" : 3,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "//---Create SAP BW Process Chain Rule ---\r\n\r\nctmWorkspace.getSapBWJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> ctmXmlElementResult = jobElement.getAllDecnedElementByName(\"type\");\r\n\tfor(CtmXmlElement ctmXmlElement : ctmXmlElementResult)\r\n\t{\r\n\t\tString type = ctmXmlElement.getText();\r\n\t\tif (type != null && type.equals(\"ProcessChain\"))\r\n\t\t{\r\n\t\t CtmXmlElement processChainElement = jobElement.getAllDecnedElementByName(\"ProcessChain\").get(0);\r\n\t\t System.out.println(processChainElement.toString());\r\n\t\t if (processChainElement != null)\r\n\t {\r\n\t ctmJob.general().sapBWParameters().setProcessType(SapBWProcessType.ProcessChain);\r\n\t CtmXmlElement idElement = processChainElement.getFirstChildElementByName(\"ID\");\r\n\t if (idElement != null)\r\n\t ctmJob.general().sapBWParameters().setID(idElement.getText());\r\n\t CtmXmlElement descElement = processChainElement.getFirstChildElementByName(\"Description\");\r\n\t if (descElement != null)\r\n\t ctmJob.general().sapBWParameters().setDescription(descElement.getText());\r\n\t CtmXmlElement rerunOptionElement = processChainElement.getFirstChildElementByName(\"RerunOption\");\r\n\t if (rerunOptionElement != null)\r\n\t {\r\n\t String rerunOption = rerunOptionElement.getText();\r\n\t if (rerunOption.equals(\"FromStart\"))\r\n\t ctmJob.general().sapBWParameters().setReRunOption(SapBWRerunOption.RerunFromStart);\r\n\t }\r\n\t }\r\n\t\t}\r\n\t} \r\n}"
},
"jobTypeName" : "SAP BW",
"name" : "Process Chain",
"category" : 3,
"type" : "script"
} ],
"File Transfer" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Type",
"operator" : "Equal"
} ],
"script" : "// ---- Create FileTransfer Job rule ----\r\n\r\nString argument = \"Type\";\r\nctmWorkspace.getAllJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString attributeValue = jobElementData.getAttribute(argument);\r\n\tif(attributeValue != null && attributeValue.equals(\"MFT\")){\r\n\t\tctmJob.setFileTransferType();\r\n\t}\r\n}"
},
"jobTypeName" : "File Transfer",
"name" : "Job",
"category" : 3,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "UserName",
"operator" : "Equal"
} ],
"script" : "// ---- Create FileTransfer Connection Profile Rule ----\r\n\r\nString argument = \"UserName\";\r\nctmWorkspace.getFileTransferJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tString connectionProfileValue = jobElementData.getAttribute(argument);\r\n\tctmJob.general().fileTransferParameters().setConnectionProfile(connectionProfileValue);\r\n}"
},
"jobTypeName" : "File Transfer",
"name" : "Connection Profile",
"category" : 3,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "transfer",
"operator" : "Equal"
} ],
"script" : "//---- Create FileTransfer transfer Rule ----\r\n\r\nString xpathQuery = \"transfer\";\r\nctmWorkspace.getFileTransferJobs().each{ ctmJob ->\r\n\tCtmXmlElement jobElementData = ctmJob.getJobInputXmlData();\r\n\tList<CtmXmlElement> transferXmlElements = jobElementData.getDirectChildsElementbyName(xpathQuery);\r\n\tfor(CtmXmlElement transferElement : transferXmlElements) {\r\n String tranfertype = transferElement.getFirstChildElementByName(\"tranfertype\").getText();\r\n String leftPath = transferElement.getFirstChildElementByName(\"source\").getText();\r\n String rightPath = transferElement.getFirstChildElementByName(\"destination\").getText();\r\n\t CtmTransfer transfer = ctmJob.general().fileTransferParameters().addNewTransfer();\r\n \ttransfer.setRightPath(rightPath);\r\n \ttransfer.setLeftPath(leftPath);\r\n \tif(tranfertype != null && tranfertype.equals(\"BINARY\")){\r\n \t transfer.setTransferType(TransferType.Binary);\r\n \t}else{\r\n \t transfer.setTransferType(TransferType.Ascii);\r\n \t}\r\n \ttransfer.setTransferOption(TransferOption.Filewatch_And_Transfer_from_left_to_right);\r\n\t}\r\n}"
},
"jobTypeName" : "File Transfer",
"name" : "Transfer Attributes",
"category" : 3,
"type" : "script"
} ]
},
"projectRuleSetName" : "ConversionRules",
"projectRuleSetControlMVersion" : "9.0.18",
"projectRuleSetDateCreated" : "Tue Feb 12 2019",
"folderAttributesRules" : [ ],
"scriptModeString" : "",
"projectRuleSetConversionType" : "UI\\Script Mode",
"dependencyRules" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "After",
"operator" : "Equal"
} ],
"script" : "// ---- In Condition Rule ----\n\ndef jobsList = ctmWorkspace.getAllJobs();\njobsList.each { ctmJob ->\n String targetJob = ctmJob.general().getName();\n // Retrieve all Dependency elements that contain current job name in \"ToJob\" attribute\n String xpathQuery = \"//Dependency[@ToJob=\\\"\" + targetJob + \"\\\"]\";\n List<CtmXmlElement> dependenciesXmlElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n for(CtmXmlElement dependencyElement: dependenciesXmlElements) \n {\n // Get the source job name\n \tString sourceJob = dependencyElement.getAttribute(\"FromJOB\");\n \t// Build condiiton name in {SourceJob-To-TagetJob} pattern\n \tString inConditionName = sourceJob + \"-TO-\" + targetJob;\n \tctmJob.prerequisites().addInCondition(inConditionName);\n }\n}"
},
"name" : "In Condition",
"category" : 4,
"type" : "script"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Before",
"operator" : "Equal"
} ],
"script" : "// ---- Out Condition Rule ----\n\ndef jobsList = ctmWorkspace.getAllJobs();\njobsList.each { ctmJob ->\n String sourceJob = ctmJob.general().getName();\n // Retrieve all Dependency elements that contain current job name in \"FromJob\" attribute\n String xpathQuery = \"//Dependency[@FromJOB=\\\"\" + sourceJob + \"\\\"]\";\n List<CtmXmlElement> dependenciesXmlElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n for(CtmXmlElement dependencyElement: dependenciesXmlElements) \n {\n // Get the target job name\n \tString targetJob = dependencyElement.getAttribute(\"ToJob\");\n \t// Build condiiton name in {SourceJob-To-TagetJob} pattern\n \tString outConditionName = sourceJob + \"-TO-\" + targetJob;\n \tctmJob.actions().addOutCondition(outConditionName);\n }\n}"
},
"name" : "Out Condition",
"category" : 4,
"type" : "script"
} ],
"jobRules" : [ {
"rulesData" : {
"triplets" : [ {
"entityType" : "Element Name",
"value" : "JOB",
"operator" : "Equal"
} ],
"script" : "// ---- Create Job Rule ----\n\nString xpathQuery = \"//JOB\"; // XPath query of the XML element we look for in XML Input Data\n\n// Retrieve all elements with tag name equals to \"JOB\" XML elements into jobElements list\nList<CtmXmlElement> jobElements = ctmXmlQuery.findXmlElementsByXPath(xpathQuery);\n\n// Run in a loop on all elements with tag name equals to \"JOB\" XML elements found, and create a Control-M Job for each one of them\n// For each Control-M Job created we keep the equivalent XML element data\nfor(CtmXmlElement jobElement : jobElements) {\n CtmJob ctmJob = ctmWorkspace.createJob(jobElement);\n}"
},
"name" : "Create Job",
"category" : 1,
"type" : "regular"
}, {
"rulesData" : {
"triplets" : [ {
"entityType" : "Attribute Name",
"value" : "Name",
"operator" : "Equal"
} ],
"script" : "// ---- Job Name Rule ----\n\n// For each Control-M Job created we getting the value of attribute name \"Name\" from\n// the equivalent XML element data and set the value to be the Job name\nString argument = \"Name\";\nctmWorkspace.getAllJobs().each{ ctmJob ->\n\tCtmXmlElement jobElement = ctmJob.getJobInputXmlData();\n\tString jobName = jobElement.getAttribute(argument);\n\tctmJob.setName(jobName);\n}\n"
},
"name" : "Job Name",
"category" : 1,
"type" : "regular"
} ],
"jobAttributesRules" : [ ]
}