use of eu.bcvsolutions.idm.core.workflow.api.dto.WorkflowDeploymentDto in project CzechIdMng by bcvsolutions.
the class BasicEmailTest method testSendEmailFromWorkflow.
/**
* Send email through {@link EmailNotificationSender}
*/
@Test
public void testSendEmailFromWorkflow() {
// Deploy process - annotation @Deployment can't be used - we need custom behavior to work
InputStream is = this.getClass().getClassLoader().getResourceAsStream("eu/bcvsolutions/idm/workflow/deploy/testEmailer.bpmn20.xml");
WorkflowDeploymentDto deploymentDto = processDeploymentService.create(PROCESS_KEY, "testEmailer.bpmn20.xml", is);
IdmNotificationFilter filter = new IdmNotificationFilter();
//
Assert.assertNotNull(deploymentDto);
filter.setText(EMAIL_TEXT);
filter.setRecipient(EMAIL_RECIPIENT);
Assert.assertEquals(0, emailLogService.find(filter, null).getTotalElements());
RuntimeService runtimeService = activitiRule.getRuntimeService();
ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_KEY);
//
Assert.assertTrue(instance.isEnded());
long count = runtimeService.createProcessInstanceQuery().processDefinitionKey(PROCESS_KEY).count();
Assert.assertEquals(0, count);
Assert.assertEquals(1, emailLogService.find(filter, null).getTotalElements());
}
use of eu.bcvsolutions.idm.core.workflow.api.dto.WorkflowDeploymentDto 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);
}
Aggregations