IdmNotificationAttachmentController extends AbstractReadWriteDtoController<IdmNotificationAttachmentDto, IdmNotificationAttachmentFilter> { @Override @ResponseBody @RequestMapping(method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @ApiOperation( value = "Search notification attachments (/search/quick alias)", nickname = "searchNotificationAttachments", tags = { IdmNotificationAttachmentController.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  IdmNotificationAttachmentController(IdmNotificationAttachmentService service); @Override @ResponseBody @RequestMapping(method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @ApiOperation( value = "Search notification attachments (/search/quick alias)", nickname = "searchNotificationAttachments", tags = { IdmNotificationAttachmentController.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 attachments", nickname = "searchQuickNotificationAttachments", tags = { IdmNotificationAttachmentController.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 = "countNotificationAttachments", tags = { IdmNotificationAttachmentController.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 attachment detail", nickname = "getNotificationAttachment", response = IdmNotificationAttachmentDto.class, tags = { IdmNotificationAttachmentController.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 = "Notification attachment 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 = "getPermissionsOnNotificationAttachment", tags = { IdmNotificationAttachmentController.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 attachment uuid identifier.", required = true)
			@PathVariable @NotNull String backendId); @RequestMapping(value = "/{backendId}/download", method = RequestMethod.GET) @ResponseBody @PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATION_READ + "')") @ApiOperation( value = "Download notification attachment", nickname = "downloadNotificationAttachment", tags = { IdmNotificationAttachmentController.TAG }, notes = "Returns input stream to notification attachment.", 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<InputStreamResource> download(
			@ApiParam(value = "Notification attachment uuid identifier.", required = true)
			@PathVariable String backendId);  }
@Test public void testFindByText() { IdmNotificationAttachmentDto attachmentOne = createDto(); createDto(); IdmNotificationAttachmentFilter filter = new IdmNotificationAttachmentFilter(); filter.setText(attachmentOne.getName()); List<IdmNotificationAttachmentDto> attachments = find(filter); Assert.assertEquals(1, attachments.size()); Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(attachmentOne.getId()))); }
@Test public void testFindByNotification() { IdmNotificationAttachmentDto attachmentOne = createDto(); createDto(); IdmNotificationAttachmentFilter filter = new IdmNotificationAttachmentFilter(); filter.setNotification(attachmentOne.getNotification()); List<IdmNotificationAttachmentDto> attachments = find(filter); Assert.assertEquals(1, attachments.size()); Assert.assertTrue(attachments.stream().anyMatch(r -> r.getId().equals(attachmentOne.getId()))); }