View Javadoc
1   package fr.tiogars.inception.domains.auth.role.services;
2   
3   import java.util.List;
4   
5   import org.springframework.stereotype.Service;
6   import org.springframework.transaction.annotation.Transactional;
7   
8   import fr.tiogars.inception.common.models.DeleteSelectedResponse;
9   import fr.tiogars.inception.common.services.DeleteSelectedSupport;
10  
11  /** Deletes a selection of roles in a single transaction; system roles are skipped. */
12  @Service
13  public class RoleDeleteSelectedService {
14  
15      private final RoleService roleService;
16  
17      public RoleDeleteSelectedService(RoleService roleService) {
18          this.roleService = roleService;
19      }
20  
21      @Transactional
22      public DeleteSelectedResponse deleteSelected(List<Long> ids) {
23          return DeleteSelectedSupport.deleteEach(ids, roleService::delete);
24      }
25  }