@@ -37,6 +37,10 @@ public class AsyncApiImporter {
37
37
38
38
private EpNewVersionStrategy versionStrategy ;
39
39
40
+ private boolean disableCascadeUpdate ;
41
+
42
+ private boolean disableApplicationImport ;
43
+
40
44
private String applicationDomainId ;
41
45
42
46
/**
@@ -45,6 +49,8 @@ public class AsyncApiImporter {
45
49
* @param asyncApiSpecToImport - String representation of full asyncapi spec to import
46
50
* @param eventPortalBaseUrl - Can be NULL, will use default URL for US/Canada
47
51
* @param newVersionStrategy - Used to indicate how semantic versions for created object are incremented.
52
+ * @param disableCascadeUpdate - Set to TRUE to prevent new versions of objects from being created by cascade update (See Documentation)
53
+ * @param disableApplicationImport - Do not import an application with the AsyncApi spec, Events, schemas, and enums only
48
54
* Allowed values are MAJOR, MINOR, and PATCH.
49
55
* Can be NULL, will default increment MAJOR version;
50
56
* @throws Exception
@@ -54,7 +60,9 @@ public AsyncApiImporter(
54
60
final String eventPortalBearerToken ,
55
61
final String asyncApiSpecToImport ,
56
62
final String eventPortalBaseUrl ,
57
- final String newVersionStrategy
63
+ final String newVersionStrategy ,
64
+ final boolean disableCascadeUpdate ,
65
+ final boolean disableApplicationImport
58
66
) throws Exception
59
67
{
60
68
this .applicationDomainName = applicationDomainName ;
@@ -66,6 +74,29 @@ public AsyncApiImporter(
66
74
} else {
67
75
this .versionStrategy = EpNewVersionStrategy .MAJOR ;
68
76
}
77
+ this .disableCascadeUpdate = disableCascadeUpdate ;
78
+ this .disableApplicationImport = disableApplicationImport ;
79
+ }
80
+
81
+ /**
82
+ * @param applicationDomainName - Name of Application Domain in Event Portal where objects represented in the AsyncApi spec will be imported.
83
+ * @param eventPortalBearerToken - Event Portal Bearer Token, must have read and write privileges
84
+ * @param asyncApiSpecToImport - String representation of full asyncapi spec to import
85
+ * @param eventPortalBaseUrl - Can be NULL, will use default URL for US/Canada
86
+ * @param newVersionStrategy - Used to indicate how semantic versions for created object are incremented.
87
+ * Allowed values are MAJOR, MINOR, and PATCH.
88
+ * Can be NULL, will default increment MAJOR version;
89
+ * @throws Exception
90
+ */
91
+ public AsyncApiImporter (
92
+ final String applicationDomainName ,
93
+ final String eventPortalBearerToken ,
94
+ final String asyncApiSpecToImport ,
95
+ final String eventPortalBaseUrl ,
96
+ final String newVersionStrategy
97
+ ) throws Exception
98
+ {
99
+ this (applicationDomainName , eventPortalBearerToken , asyncApiSpecToImport , eventPortalBaseUrl , newVersionStrategy , false , false );
69
100
}
70
101
71
102
/**
@@ -75,6 +106,41 @@ public AsyncApiImporter(
75
106
* @param asyncApiSpecToImport - String representation of full asyncapi spec to import
76
107
* @param eventPortalBaseUrl - Can be NULL, will use default URL for US/Canada
77
108
* @param newVersionStrategy - Used to indicate how semantic versions for created object are incremented.
109
+ * @param disableCascadeUpdate - Set to TRUE to prevent new versions of objects from being created by cascade update (See Documentation)
110
+ * @param disableApplicationImport - Do not import an application with the AsyncApi spec, Events, schemas, and enums only
111
+ * Allowed values are MAJOR, MINOR, and PATCH.
112
+ * Can be NULL, will default increment MAJOR version;
113
+ * @throws Exception
114
+ */
115
+ public static void execImportOperation (
116
+ final String applicationDomainName ,
117
+ final String eventPortalBearerToken ,
118
+ final String asyncApiSpecToImport ,
119
+ final String eventPortalBaseUrl ,
120
+ final String newVersionStrategy ,
121
+ final boolean disableCascadeUpdate ,
122
+ final boolean disableApplicationImport
123
+ ) throws Exception
124
+ {
125
+ final AsyncApiImporter importer = new AsyncApiImporter (
126
+ applicationDomainName ,
127
+ eventPortalBearerToken ,
128
+ asyncApiSpecToImport ,
129
+ eventPortalBaseUrl ,
130
+ newVersionStrategy ,
131
+ disableCascadeUpdate ,
132
+ disableApplicationImport );
133
+ importer .execImportOperation ();
134
+ }
135
+
136
+ /**
137
+ * Statically invoke AsyncApi import operation
138
+ * @param applicationDomainName - Name of Application Domain in Event Portal where objects represented in the AsyncApi spec will be imported.
139
+ * @param eventPortalBearerToken - Event Portal Bearer Token, must have read and write privileges
140
+ * @param asyncApiSpecToImport - String representation of full asyncapi spec to import
141
+ * @param eventPortalBaseUrl - Can be NULL, will use default URL for US/Canada
142
+ * @param newVersionStrategy - Used to indicate how semantic versions for created object are incremented.
143
+ * @param disableCascadeUpdate - Set to TRUE to prevent new versions of objects from being created by cascade update (See Documentation)
78
144
* Allowed values are MAJOR, MINOR, and PATCH.
79
145
* Can be NULL, will default increment MAJOR version;
80
146
* @throws Exception
@@ -129,12 +195,18 @@ public void execImportOperation() throws Exception
129
195
130
196
importOperator .importEvents ();
131
197
132
- importOperator .matchEpApplications ();
198
+ if (! disableApplicationImport )
199
+ {
200
+ importOperator .matchEpApplications ();
133
201
134
- importOperator .importApplications ();
202
+ importOperator .importApplications ();
203
+ }
135
204
136
- importOperator .cascadeUpdateEvents ();
205
+ if (! disableCascadeUpdate )
206
+ {
207
+ importOperator .cascadeUpdateEvents ();
137
208
138
- importOperator .cascadeUpdateApplications ();
209
+ importOperator .cascadeUpdateApplications ();
210
+ }
139
211
}
140
212
}
0 commit comments