use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class IdmNotificationTemplateController method backup.
@ResponseBody
@RequestMapping(value = "/{backendId}/backup", method = RequestMethod.GET)
@PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATIONTEMPLATE_READ + "')")
@ApiOperation(value = "Backup notification template", nickname = "backupNotificationTemplate", response = IdmNotificationTemplateDto.class, tags = { IdmNotificationTemplateController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATIONTEMPLATE_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATIONTEMPLATE_READ, description = "") }) }, notes = "Backup template to directory given in application properties.")
public ResponseEntity<?> backup(@ApiParam(value = "Template's uuid identifier or code.", required = true) @PathVariable @NotNull String backendId) {
IdmNotificationTemplateDto template = notificationTemplateService.get(backendId);
if (template == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, backendId);
}
notificationTemplateService.backup(template);
return new ResponseEntity<>(toResource(template), HttpStatus.OK);
}
use of eu.bcvsolutions.idm.core.notification.api.dto.IdmNotificationTemplateDto in project CzechIdMng by bcvsolutions.
the class IdmNotificationTemplateController method redeploy.
@ResponseBody
@RequestMapping(value = "/{backendId}/redeploy", method = RequestMethod.GET)
@PreAuthorize("hasAuthority('" + NotificationGroupPermission.NOTIFICATIONTEMPLATE_UPDATE + "')")
@ApiOperation(value = "Redeploy notification template", nickname = "redeployNotificationTemplate", response = IdmNotificationTemplateDto.class, tags = { IdmNotificationTemplateController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATIONTEMPLATE_UPDATE, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = NotificationGroupPermission.NOTIFICATIONTEMPLATE_UPDATE, description = "") }) }, notes = "Redeploy template. Redeployed will be only templates, that has pattern in resource." + " Before save newly loaded DO will be backup the old template into backup directory.")
public ResponseEntity<?> redeploy(@ApiParam(value = "Template's uuid identifier or code.", required = true) @PathVariable @NotNull String backendId) {
IdmNotificationTemplateDto template = notificationTemplateService.get(backendId);
if (template == null) {
throw new ResultCodeException(CoreResultCode.NOT_FOUND, backendId);
}
template = notificationTemplateService.redeploy(template);
return new ResponseEntity<>(toResource(template), HttpStatus.OK);
}
Aggregations