+ private Either<Service, ResponseFormat> deleteVfGroups(List<GroupDefinition> vfGroupsToDelete, Service resource, CsarInfo csarInfo,
+ boolean shouldLock, boolean inTransaction) {
+ if (vfGroupsToDelete != null && !vfGroupsToDelete.isEmpty()) {
+ for (GroupDefinition gr : vfGroupsToDelete) {
+ List<String> artifacts = gr.getArtifacts();
+ for (String artifactId : artifacts) {
+ Either<ArtifactDefinition, ResponseFormat> handleDelete = artifactsBusinessLogic
+ .handleDelete(resource.getUniqueId(), artifactId, csarInfo.getModifier(), resource, shouldLock, inTransaction);
+ if (handleDelete.isRight()) {
+ log.error("Couldn't delete artifact {}", artifactId);
+ return Either.right(handleDelete.right().value());
+ }
+ }
+ }
+ groupBusinessLogic.deleteGroups(resource, vfGroupsToDelete);
+ Either<Service, StorageOperationStatus> eitherGetResource = toscaOperationFacade.getToscaElement(resource.getUniqueId());
+ if (eitherGetResource.isRight()) {
+ return Either.right(componentsUtils.getResponseFormatByComponent(
+ componentsUtils.convertFromStorageResponse(eitherGetResource.right().value()), resource, resource.getComponentType()));
+ }
+ return Either.left(eitherGetResource.left().value());
+ }
+ return Either.right(componentsUtils.getResponseFormatByComponent(ActionStatus.INVALID_CONTENT, resource, resource.getComponentType()));