IdmNotificationRecipientController extends AbstractReadWriteDtoController<IdmNotificationRecipientDto, IdmNotificationRecipientFilter> { @Override @ResponseBody @RequestMapping(method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @ApiOperation( value = "Search notification recipients (/search/quick alias)", nickname = "searchNotificationRecipients", tags = { IdmNotificationRecipientController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }) }) public Resources<?> find( @RequestParam(required = false) MultiValueMap<String, Object> parameters, @PageableDefault Pageable pageable) { return super.find(parameters, pageable); } @Autowired  IdmNotificationRecipientController(IdmNotificationRecipientService service); @Override @ResponseBody @RequestMapping(method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @ApiOperation( value = "Search notification recipients (/search/quick alias)", nickname = "searchNotificationRecipients", tags = { IdmNotificationRecipientController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }) }) Resources<?> find(
			@RequestParam(required = false) MultiValueMap<String, Object> parameters, 
			@PageableDefault Pageable pageable); @ResponseBody @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @RequestMapping(value = "/search/quick", method = RequestMethod.GET) @ApiOperation( value = "Search notification recipients", nickname = "searchQuickNotificationRecipients", tags = { IdmNotificationRecipientController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }) }) Resources<?> findQuick(
			@RequestParam(required = false) MultiValueMap<String, Object> parameters,
			@PageableDefault Pageable pageable); @Override @ResponseBody @RequestMapping(value = "/search/count", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_COUNT + "')") @ApiOperation( value = "The number of entities that match the filter", nickname = "countNotificationRecipients", tags = { IdmNotificationRecipientController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_COUNT, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_COUNT, description = "") }) }) long count(@RequestParam(required = false) MultiValueMap<String, Object> parameters); @Override @ResponseBody @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @RequestMapping(value = "/{backendId}", method = RequestMethod.GET) @ApiOperation( value = "Notification recipient detail", nickname = "getNotificationRecipient", response = IdmNotificationRecipientDto.class, tags = { IdmNotificationRecipientController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "") }) }) ResponseEntity<?> get(
			@ApiParam(value = "Recipient's uuid identifier.", required = true)
			@PathVariable @NotNull String backendId); @Override @ResponseBody @RequestMapping(value = "/{backendId}/permissions", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @ApiOperation( value = "What logged identity can do with given record", nickname = "getPermissionsOnNotificationRecipient", tags = { IdmNotificationRecipientController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "")}), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATION_READ, description = "")}) }) Set<String> getPermissions(
			@ApiParam(value = "Notification recipient uuid identifier.", required = true)
			@PathVariable @NotNull String backendId);  }
@Test public void testFindByText() { IdmNotificationRecipientDto recipentOne = createDto(); createDto(); IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter(); filter.setText(recipentOne.getRealRecipient()); List<IdmNotificationRecipientDto> attachments = find(filter); Assert.assertEquals(1, attachments.size()); Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId()))); }
@Test public void testFindByRealRecipient() { IdmNotificationRecipientDto recipentOne = createDto(); createDto(); IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter(); filter.setRealRecipient(recipentOne.getRealRecipient()); List<IdmNotificationRecipientDto> attachments = find(filter); Assert.assertEquals(1, attachments.size()); Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId()))); }
@Test public void testFindByIdentityRecipient() { IdmNotificationRecipientDto recipentOne = createDto(); createDto(); IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter(); filter.setIdentityRecipient(recipentOne.getIdentityRecipient()); List<IdmNotificationRecipientDto> attachments = find(filter); Assert.assertEquals(1, attachments.size()); Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId()))); }
@Test public void testFindByNotification() { IdmNotificationRecipientDto recipentOne = createDto(); createDto(); IdmNotificationRecipientFilter filter = new IdmNotificationRecipientFilter(); filter.setNotification(recipentOne.getNotification()); List<IdmNotificationRecipientDto> attachments = find(filter); Assert.assertEquals(1, attachments.size()); Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(recipentOne.getId()))); }