use of org.springframework.hateoas.Resource in project CzechIdMng by bcvsolutions.
the class IdmPasswordPolicyController method validate.
/**
* Validate password by given password policy id
*
* @param backendId
* @return
*/
@RequestMapping(value = "/{backendId}/validate", method = RequestMethod.POST)
@ApiOperation(value = "Validate password", nickname = "validatePassword", response = IdmPasswordValidationDto.class, tags = { IdmPasswordPolicyController.TAG }, notes = "Validate password by password policy.")
public Resource<IdmPasswordValidationDto> validate(@ApiParam(value = "Policy's uuid identifier.", required = true) @PathVariable String backendId, @Valid @RequestBody(required = true) IdmPasswordValidationDto password) {
IdmPasswordPolicyDto passwordPolicy = getPasswordPolicy(backendId);
//
this.passwordPolicyService.validate(password, passwordPolicy);
//
password.setValid(true);
//
return new Resource<IdmPasswordValidationDto>(password);
}
use of org.springframework.hateoas.Resource in project CzechIdMng by bcvsolutions.
the class WorkflowDefinitionController method post.
/**
* Upload new deployment to Activiti engine
*
* @param name
* @param fileName
* @param data
* @return
* @throws IOException
*/
@ResponseBody
@RequestMapping(method = RequestMethod.POST)
@PreAuthorize("hasAuthority('" + CoreGroupPermission.WORKFLOW_DEFINITION_CREATE + "') or hasAuthority('" + CoreGroupPermission.WORKFLOW_DEFINITION_UPDATE + "')")
@ApiOperation(value = "Create / update workflow definition", nickname = "postWorkflowDefinition", response = WorkflowDeploymentDto.class, tags = { WorkflowDefinitionController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = CoreGroupPermission.WORKFLOW_DEFINITION_CREATE, description = ""), @AuthorizationScope(scope = CoreGroupPermission.WORKFLOW_DEFINITION_UPDATE, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = CoreGroupPermission.WORKFLOW_DEFINITION_CREATE, description = ""), @AuthorizationScope(scope = CoreGroupPermission.WORKFLOW_DEFINITION_UPDATE, description = "") }) }, notes = "Upload new deployment to Activiti engine." + " If definition with iven key exists, new deployment version is added." + " All running task instances process with their deployment version." + " Newly added version will be used for new instances.")
public Resource<WorkflowDeploymentDto> post(String name, String fileName, MultipartFile data) throws IOException {
WorkflowDeploymentDto deployment = deploymentService.create(name, fileName, data.getInputStream());
Link selfLink = ControllerLinkBuilder.linkTo(this.getClass()).slash(deployment.getId()).withSelfRel();
return new Resource<WorkflowDeploymentDto>(deployment, selfLink);
}
use of org.springframework.hateoas.Resource in project CzechIdMng by bcvsolutions.
the class AbstractReadDtoController method toResource.
/**
* Converts DTO to ResourceSupport
*
* @param dto
* @return
*/
protected ResourceSupport toResource(DTO dto) {
Link selfLink = ControllerLinkBuilder.linkTo(this.getClass()).slash(dto.getId()).withSelfRel();
Resource<DTO> resourceSupport = new Resource<DTO>(dto, selfLink);
return resourceSupport;
}
Aggregations