@Test void testDeleteResourcesNothing() { resourceDeleteServiceImpl.delete(emptyList(), mock(Progress.class)); verifyZeroInteractions(dataService); }
@Override public Void delete(List<ResourceIdentifier> resources, Progress progress) { progress.status(contextMessageSource.getMessage("progress-delete-started")); Set<Object> packageIds = new LinkedHashSet<>(); Set<Object> entityTypeIds = new LinkedHashSet<>(); resources.forEach( resource -> { switch (resource.getType()) { case PACKAGE: packageIds.add(resource.getId()); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: entityTypeIds.add(resource.getId()); break; default: throw new UnexpectedEnumException(resource.getType()); } }); if (!entityTypeIds.isEmpty()) { deleteEntityTypes(entityTypeIds); } if (!packageIds.isEmpty()) { deletePackages(packageIds); } progress.status(contextMessageSource.getMessage("progress-delete-success")); return null; }
ResourceDeleteServiceImpl implements ResourceDeleteService { @Override public Void delete(List<ResourceIdentifier> resources, Progress progress) { progress.status(contextMessageSource.getMessage("progress-delete-started")); Set<Object> packageIds = new LinkedHashSet<>(); Set<Object> entityTypeIds = new LinkedHashSet<>(); resources.forEach( resource -> { switch (resource.getType()) { case PACKAGE: packageIds.add(resource.getId()); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: entityTypeIds.add(resource.getId()); break; default: throw new UnexpectedEnumException(resource.getType()); } }); if (!entityTypeIds.isEmpty()) { deleteEntityTypes(entityTypeIds); } if (!packageIds.isEmpty()) { deletePackages(packageIds); } progress.status(contextMessageSource.getMessage("progress-delete-success")); return null; } }
ResourceDeleteServiceImpl implements ResourceDeleteService { @Override public Void delete(List<ResourceIdentifier> resources, Progress progress) { progress.status(contextMessageSource.getMessage("progress-delete-started")); Set<Object> packageIds = new LinkedHashSet<>(); Set<Object> entityTypeIds = new LinkedHashSet<>(); resources.forEach( resource -> { switch (resource.getType()) { case PACKAGE: packageIds.add(resource.getId()); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: entityTypeIds.add(resource.getId()); break; default: throw new UnexpectedEnumException(resource.getType()); } }); if (!entityTypeIds.isEmpty()) { deleteEntityTypes(entityTypeIds); } if (!packageIds.isEmpty()) { deletePackages(packageIds); } progress.status(contextMessageSource.getMessage("progress-delete-success")); return null; } ResourceDeleteServiceImpl(DataService dataService, ContextMessageSource contextMessageSource); }
ResourceDeleteServiceImpl implements ResourceDeleteService { @Override public Void delete(List<ResourceIdentifier> resources, Progress progress) { progress.status(contextMessageSource.getMessage("progress-delete-started")); Set<Object> packageIds = new LinkedHashSet<>(); Set<Object> entityTypeIds = new LinkedHashSet<>(); resources.forEach( resource -> { switch (resource.getType()) { case PACKAGE: packageIds.add(resource.getId()); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: entityTypeIds.add(resource.getId()); break; default: throw new UnexpectedEnumException(resource.getType()); } }); if (!entityTypeIds.isEmpty()) { deleteEntityTypes(entityTypeIds); } if (!packageIds.isEmpty()) { deletePackages(packageIds); } progress.status(contextMessageSource.getMessage("progress-delete-success")); return null; } ResourceDeleteServiceImpl(DataService dataService, ContextMessageSource contextMessageSource); @Override Void delete(List<ResourceIdentifier> resources, Progress progress); }
ResourceDeleteServiceImpl implements ResourceDeleteService { @Override public Void delete(List<ResourceIdentifier> resources, Progress progress) { progress.status(contextMessageSource.getMessage("progress-delete-started")); Set<Object> packageIds = new LinkedHashSet<>(); Set<Object> entityTypeIds = new LinkedHashSet<>(); resources.forEach( resource -> { switch (resource.getType()) { case PACKAGE: packageIds.add(resource.getId()); break; case ENTITY_TYPE: case ENTITY_TYPE_ABSTRACT: entityTypeIds.add(resource.getId()); break; default: throw new UnexpectedEnumException(resource.getType()); } }); if (!entityTypeIds.isEmpty()) { deleteEntityTypes(entityTypeIds); } if (!packageIds.isEmpty()) { deletePackages(packageIds); } progress.status(contextMessageSource.getMessage("progress-delete-success")); return null; } ResourceDeleteServiceImpl(DataService dataService, ContextMessageSource contextMessageSource); @Override Void delete(List<ResourceIdentifier> resources, Progress progress);  }