|
1 | 1 | package com.sap.piper
|
2 | 2 |
|
3 |
| -// script is present in the signatures in order to keep api compatibility. |
4 |
| -// The script referenced is not used inside the method bodies. |
5 |
| - |
6 | 3 | @API(deprecated = true)
|
7 | 4 | class ConfigurationLoader implements Serializable {
|
8 |
| - |
9 |
| - static Map stepConfiguration(String stepName) { |
10 |
| - return loadConfiguration('steps', stepName, ConfigurationType.CUSTOM_CONFIGURATION) |
11 |
| - } |
12 |
| - @Deprecated |
13 |
| - /** Use stepConfiguration(stepName) instead */ |
14 | 5 | static Map stepConfiguration(script, String stepName) {
|
15 |
| - return stepConfiguration(stepName) |
| 6 | + return loadConfiguration(script, 'steps', stepName, ConfigurationType.CUSTOM_CONFIGURATION) |
16 | 7 | }
|
17 | 8 |
|
18 |
| - static Map stageConfiguration(String stageName) { |
19 |
| - return loadConfiguration('stages', stageName, ConfigurationType.CUSTOM_CONFIGURATION) |
20 |
| - } |
21 |
| - @Deprecated |
22 |
| - /** Use stageConfiguration(stageName) instead */ |
23 | 9 | static Map stageConfiguration(script, String stageName) {
|
24 |
| - return stageConfiguration(stageName) |
| 10 | + return loadConfiguration(script, 'stages', stageName, ConfigurationType.CUSTOM_CONFIGURATION) |
25 | 11 | }
|
26 | 12 |
|
27 |
| - static Map defaultStepConfiguration(String stepName) { |
28 |
| - return loadConfiguration('steps', stepName, ConfigurationType.DEFAULT_CONFIGURATION) |
29 |
| - } |
30 |
| - @Deprecated |
31 |
| - /** Use defaultStepConfiguration(stepName) instead */ |
32 | 13 | static Map defaultStepConfiguration(script, String stepName) {
|
33 |
| - return defaultStepConfiguration(stepName) |
| 14 | + return loadConfiguration(script, 'steps', stepName, ConfigurationType.DEFAULT_CONFIGURATION) |
34 | 15 | }
|
35 | 16 |
|
36 |
| - static Map defaultStageConfiguration(String stageName) { |
37 |
| - return loadConfiguration('stages', stageName, ConfigurationType.DEFAULT_CONFIGURATION) |
38 |
| - } |
39 |
| - @Deprecated |
40 |
| - /** Use defaultStageConfiguration(stepName) instead */ |
41 | 17 | static Map defaultStageConfiguration(script, String stageName) {
|
42 |
| - return defaultStageConfiguration(stageName) |
| 18 | + return loadConfiguration(script, 'stages', stageName, ConfigurationType.DEFAULT_CONFIGURATION) |
43 | 19 | }
|
44 | 20 |
|
45 |
| - static Map generalConfiguration(){ |
| 21 | + static Map generalConfiguration(script){ |
46 | 22 | try {
|
47 |
| - return CommonPipelineEnvironment.getInstance()?.configuration?.general ?: [:] |
| 23 | + return script?.commonPipelineEnvironment?.configuration?.general ?: [:] |
48 | 24 | } catch (groovy.lang.MissingPropertyException mpe) {
|
49 | 25 | return [:]
|
50 | 26 | }
|
51 | 27 | }
|
52 |
| - @Deprecated |
53 |
| - /** Use generalConfiguration() instead */ |
54 |
| - static Map generalConfiguration(script){ |
55 |
| - return generalConfiguration() |
56 |
| - } |
57 | 28 |
|
58 |
| - static Map defaultGeneralConfiguration(){ |
59 |
| - return DefaultValueCache.getInstance()?.getDefaultValues()?.general ?: [:] |
60 |
| - } |
61 |
| - @Deprecated |
62 |
| - /** Use defaultGeneralConfiguration() instead */ |
63 | 29 | static Map defaultGeneralConfiguration(script){
|
64 |
| - return defaultGeneralConfiguration() |
| 30 | + return DefaultValueCache.getInstance()?.getDefaultValues()?.general ?: [:] |
65 | 31 | }
|
66 | 32 |
|
67 |
| - static Map postActionConfiguration(String actionName){ |
68 |
| - return loadConfiguration('postActions', actionName, ConfigurationType.CUSTOM_CONFIGURATION) |
69 |
| - } |
70 |
| - @Deprecated |
71 |
| - /** Use postActionConfiguration() instead */ |
72 | 33 | static Map postActionConfiguration(script, String actionName){
|
73 |
| - return postActionConfiguration(actionName) |
| 34 | + return loadConfiguration(script, 'postActions', actionName, ConfigurationType.CUSTOM_CONFIGURATION) |
74 | 35 | }
|
75 | 36 |
|
76 |
| - private static Map loadConfiguration(String type, String entryName, ConfigurationType configType){ |
| 37 | + private static Map loadConfiguration(script, String type, String entryName, ConfigurationType configType){ |
77 | 38 | switch (configType) {
|
78 | 39 | case ConfigurationType.CUSTOM_CONFIGURATION:
|
79 | 40 | try {
|
80 |
| - return CommonPipelineEnvironment.getInstance()?.configuration?.get(type)?.get(entryName) ?: [:] |
| 41 | + return script?.commonPipelineEnvironment?.configuration?.get(type)?.get(entryName) ?: [:] |
81 | 42 | } catch (groovy.lang.MissingPropertyException mpe) {
|
82 | 43 | return [:]
|
83 | 44 | }
|
|
0 commit comments