@@ -167,44 +167,36 @@ private static void addCitToApp(CertificateIssuingTemplate cit, Application appl
167167 String apiKey , Cloud cloud ) throws VCertException {
168168 Map <String , String > citAliasIdMap = null ;
169169
170- if ( application .certificateIssuingTemplateAliasIdMap () != null )
170+ if ( application .certificateIssuingTemplateAliasIdMap () != null ) {
171171 citAliasIdMap = application .certificateIssuingTemplateAliasIdMap ();
172+ }
172173 else {
173174 citAliasIdMap = new HashMap <>();
174175 application .certificateIssuingTemplateAliasIdMap ( citAliasIdMap );
175176 }
176177
177- boolean updateApplication = false ;
178-
179178 //if the App doesn't contain the relation to the cit
180179 if ( !citAliasIdMap .containsKey (cit .name ()) ) {
181180 //adding the reference to the cit
182181 citAliasIdMap .put (cit .name (), cit .id ());
183- updateApplication = true ;
184182 }
185183
186184 // Updating the owners list of the Application
187185 List <Application .OwnerIdsAndType > ownersList = CloudConnectorUtils .resolveUsersToCloudOwners (usersList , apiKey , cloud );
188- if (ownersList .size () > 0 ){
189- // application.ownerIdsAndTypes().addAll(ownersList);
190- List <Application .OwnerIdsAndType > newList = mergeOwnersList (application .ownerIdsAndTypes (), ownersList );
191- application .ownerIdsAndTypes (newList );
192- updateApplication = true ;
193- }
186+ application .ownerIdsAndTypes (ownersList );
194187
195- if (updateApplication ) {
196- //getting the appId because it will be used to invoke the API to update the related Application
197- String appId = application .id ();
188+ //getting the appId because it will be used to invoke the API to update the related Application
189+ String appId = application .id ();
198190
199- //The id, companyId, fqDns and internalFqDns needs to be null in the request to update the Application,
200- //therefore these attributes are set to null
201- application .id (null );
202- application .companyId (null );
203- application .fqDns (null );
204- application .internalFqDns (null );
191+ //The id, companyId, fqDns and internalFqDns needs to be null in the request to update the Application,
192+ //therefore these attributes are set to null
193+ application .id (null );
194+ application .companyId (null );
195+ application .fqDns (null );
196+ application .internalFqDns (null );
197+
198+ cloud .updateApplication (application , appId , apiKey );
205199
206- cloud .updateApplication (application , appId , apiKey );
207- }
208200 }
209201
210202 private static List <Application .OwnerIdsAndType > resolveUsersToCloudOwners (String [] usersList , String apiKey , Cloud cloud ) {
0 commit comments