use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessDefinitionDto in project CzechIdMng by bcvsolutions.
the class WorkflowDefinitionAssembler method toResource.
@Override
public ResourceWrapper<WorkflowProcessDefinitionDto> toResource(WorkflowProcessDefinitionDto entity) {
ResourceWrapper<WorkflowProcessDefinitionDto> wrapper = new ResourceWrapper<WorkflowProcessDefinitionDto>(entity);
Link selfLink = linkTo(methodOn(WorkflowDefinitionController.class).get(entity.getKey())).withSelfRel();
wrapper.add(selfLink);
return wrapper;
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessDefinitionDto in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowProcessDefinitionService method toDto.
private WorkflowProcessDefinitionDto toDto(ProcessDefinition processDefinition) {
WorkflowProcessDefinitionDto dto = new WorkflowProcessDefinitionDto();
dto.setId(processDefinition.getKey());
dto.setCategory(processDefinition.getCategory());
dto.setDeploymentId(processDefinition.getDeploymentId());
dto.setDescription(processDefinition.getDescription());
dto.setDiagramResourceName(processDefinition.getDiagramResourceName());
dto.setGraphicalNotation(processDefinition.hasGraphicalNotation());
dto.setKey(processDefinition.getKey());
dto.setName(processDefinition.getName());
dto.setResourceName(processDefinition.getResourceName());
dto.setStartFormKey(processDefinition.hasStartFormKey());
dto.setSuspended(processDefinition.isSuspended());
dto.setTenantId(processDefinition.getTenantId());
dto.setVersion(processDefinition.getVersion());
return dto;
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessDefinitionDto in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowProcessDefinitionService method find.
@Override
public Page<WorkflowProcessDefinitionDto> find(WorkflowFilterDto filter, Pageable pageable, BasePermission... permission) {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
query.active();
query.latestVersion();
if (filter != null && filter.getCategory() != null && !StringUtils.isEmpty(filter.getCategory())) {
query.processDefinitionCategoryLike(filter.getCategory() + '%');
}
if (filter.getProcessDefinitionKey() != null) {
query.processDefinitionKeyLike('%' + filter.getProcessDefinitionKey() + '%');
}
if (filter.getName() != null) {
query.processDefinitionNameLike('%' + filter.getName() + '%');
}
if (pageable != null && pageable.getSort() != null) {
pageable.getSort().forEach(order -> {
if (SORT_BY_KEY.equals(order.getProperty())) {
// Sort by key
query.orderByProcessDefinitionKey();
if (order.isAscending()) {
query.asc();
} else {
query.desc();
}
}
if (SORT_BY_NAME.equals(order.getProperty())) {
// Sort by name
query.orderByProcessDefinitionName();
if (order.isAscending()) {
query.asc();
} else {
query.desc();
}
}
});
}
// paginator
long count = query.count();
List<ProcessDefinition> processInstances = // without pagination
pageable == null ? // without pagination
query.list() : query.listPage((pageable.getPageNumber() * pageable.getPageSize()), pageable.getPageSize());
List<WorkflowProcessDefinitionDto> dtos = new ArrayList<>();
if (processInstances != null) {
for (ProcessDefinition instance : processInstances) {
dtos.add(toDto(instance));
}
}
return toPage(dtos, count, pageable != null ? pageable.getPageNumber() : -1, pageable != null ? pageable.getPageSize() : -1);
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessDefinitionDto in project CzechIdMng by bcvsolutions.
the class DefaultWorkflowProcessDefinitionService method findAllProcessDefinitions.
/**
* Find all last version and active process definitions
*/
@Override
public List<WorkflowProcessDefinitionDto> findAllProcessDefinitions() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
query.active();
query.latestVersion();
List<ProcessDefinition> processDefinitions = query.list();
List<WorkflowProcessDefinitionDto> processDefinitionDtos = new ArrayList<>();
if (processDefinitions == null) {
return processDefinitionDtos;
}
for (ProcessDefinition p : processDefinitions) {
processDefinitionDtos.add(toDto(p));
}
return processDefinitionDtos;
}
use of eu.bcvsolutions.idm.core.workflow.model.dto.WorkflowProcessDefinitionDto in project CzechIdMng by bcvsolutions.
the class DeployAndRunProcessTest method testOverrideAutoDeployedDefinition.
@Test
public void testOverrideAutoDeployedDefinition() {
WorkflowProcessDefinitionDto definitionOne = definitionService.getByName(TEST_PROCESS_KEY_OVERRIDE);
//
Assert.assertNotNull(definitionOne);
Assert.assertEquals("Process for test deploy and run Override", definitionOne.getName());
}
Aggregations