test_class.declarator: helper
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private TestHelper helper;
test_class.type: TestHelper
test_class.var_name: helper
test_class.declarator: systemService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private SysSystemService systemService;
test_class.type: SysSystemService
test_class.var_name: systemService
test_class.file: Realization/backend/acc/src/test/java/eu/bcvsolutions/idm/acc/bulk/action/impl/SystemDeleteBulkActionTest.java
test_class.identifier: SystemDeleteBulkActionTest
test_class.superclass: extends AbstractBulkActionTest
test_case.body: @Test
  	public void prevalidationBulkActionByIds() {
  		SysSystemDto system = helper.createSystem(getHelper().createName());
  
  		IdmBulkActionDto bulkAction = this.findBulkAction(SysSystem.class, SystemDeleteBulkAction.NAME);
  		bulkAction.getIdentifiers().add(system.getId());
  
  		// None info results
  		ResultModels resultModels = bulkActionManager.prevalidate(bulkAction);
  		assertEquals(0, resultModels.getInfos().size());
  
  		// Assign identity to system
  		helper.createIdentityAccount(system, getHelper().createIdentity());
  
  		// Warning message, role has identity
  		resultModels = bulkActionManager.prevalidate(bulkAction);
  		assertEquals(1, resultModels.getInfos().size());
  	}
test_case.class_method_signature: SystemDeleteBulkActionTest.prevalidationBulkActionByIds()
test_case.full_signature: @Test public void prevalidationBulkActionByIds()
test_case.identifier: prevalidationBulkActionByIds
test_case.invocations: createSystem createName getHelper findBulkAction add getIdentifiers getId prevalidate assertEquals size getInfos createIdentityAccount createIdentity getHelper prevalidate assertEquals size getInfos
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void prevalidationBulkActionByIds()
focal_class.declarator: NAME = "system-delete-bulk-action"
focal_class.modifier: public static final
focal_class.original_string: public static final String NAME = "system-delete-bulk-action";
focal_class.type: String
focal_class.var_name: NAME
focal_class.declarator: systemService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private SysSystemService systemService;
focal_class.type: SysSystemService
focal_class.var_name: systemService
focal_class.declarator: accountService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private AccAccountService accountService;
focal_class.type: AccAccountService
focal_class.var_name: accountService
focal_class.declarator: provisioningOperationService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private SysProvisioningOperationService provisioningOperationService;
focal_class.type: SysProvisioningOperationService
focal_class.var_name: provisioningOperationService
focal_class.file: Realization/backend/acc/src/main/java/eu/bcvsolutions/idm/acc/bulk/action/impl/SystemDeleteBulkAction.java
focal_class.identifier: SystemDeleteBulkAction
focal_class.class_method_signature: SystemDeleteBulkAction.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: SystemDeleteBulkAction.getAuthoritiesForEntity()
focal_class.full_signature: @Override protected List<String> getAuthoritiesForEntity()
focal_class.identifier: getAuthoritiesForEntity
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: List<String>
focal_class.signature: List<String> getAuthoritiesForEntity()
focal_class.class_method_signature: SystemDeleteBulkAction.prevalidate()
focal_class.full_signature: @Override public ResultModels prevalidate()
focal_class.identifier: prevalidate
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: ResultModels
focal_class.signature: ResultModels prevalidate()
focal_class.class_method_signature: SystemDeleteBulkAction.getService()
focal_class.full_signature: @Override public ReadWriteDtoService<SysSystemDto, SysSystemFilter> getService()
focal_class.identifier: getService
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: ReadWriteDtoService<SysSystemDto, SysSystemFilter>
focal_class.signature: ReadWriteDtoService<SysSystemDto, SysSystemFilter> getService()
focal_class.superclass: extends AbstractRemoveBulkAction<SysSystemDto, SysSystemFilter>
focal_method.body: @Override
  	public ResultModels prevalidate() {
  		IdmBulkActionDto action = getAction();
  		List<UUID> entities = getEntities(action, new StringBuilder());
  		ResultModels result = new ResultModels();
  
  		Map<ResultModel, Long> models = new HashMap<>();
  		entities.forEach(systemId -> {
  			AccAccountFilter accountFilter = new AccAccountFilter();
  			accountFilter.setSystemId(systemId);
  			
  			SysSystemDto system = getService().get(systemId);
  			
  			long count = accountService.count(accountFilter);
  			if (count > 0) {
  				models.put(new DefaultResultModel(AccResultCode.SYSTEM_DELETE_BULK_ACTION_NUMBER_OF_ACCOUNTS,
  						ImmutableMap.of("system", system.getCode(), "count", count)), count);
  			}
  			
  			SysProvisioningOperationFilter operationFilter = new SysProvisioningOperationFilter();
  			operationFilter.setSystemId(system.getId());
  			long countEntities = provisioningOperationService.count(operationFilter);
  			if (countEntities > 0) {
  				models.put(new DefaultResultModel(AccResultCode.SYSTEM_DELETE_BULK_ACTION_NUMBER_OF_PROVISIONINGS,
  						ImmutableMap.of("system", system.getCode(), "count", countEntities)), countEntities);
  			}
  		});
  
  		// Sort by count
  		List<Entry<ResultModel, Long>> collect = models //
  				.entrySet() //
  				.stream() //
  				.sorted(Collections.reverseOrder(Map.Entry.comparingByValue())) //
  				// .limit(5) //
  				.collect(Collectors.toList()); //
  		collect.forEach(entry -> {
  			result.addInfo(entry.getKey());
  		});
  
  		return result;
  	}
focal_method.class_method_signature: SystemDeleteBulkAction.prevalidate()
focal_method.full_signature: @Override public ResultModels prevalidate()
focal_method.identifier: prevalidate
focal_method.invocations: getAction getEntities forEach setSystemId get getService count put of getCode setSystemId getId count put of getCode collect sorted stream entrySet reverseOrder comparingByValue toList forEach addInfo getKey
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: ResultModels
focal_method.signature: ResultModels prevalidate()