Search in sources :

Example 1 with FormDataDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.FormDataDto in project CzechIdMng by bcvsolutions.

the class DefaultWorkflowTaskInstanceService method toResource.

private FormDataDto toResource(FormProperty property, Map<String, String> additionalInformations) {
    FormDataDto dto = new FormDataDto();
    dto.setId(property.getId());
    dto.setName(property.getName());
    dto.setValue(property.getValue());
    dto.setType(property.getType().getName());
    dto.setReadable(property.isReadable());
    dto.setRequired(property.isRequired());
    dto.setWritable(property.isWritable());
    // values)
    if (additionalInformations != null) {
        // extra add tooltip to dto
        if (additionalInformations.containsKey(WorkflowTaskInstanceService.FORM_PROPERTY_TOOLTIP_KEY)) {
            dto.setTooltip(additionalInformations.get(WorkflowTaskInstanceService.FORM_PROPERTY_TOOLTIP_KEY));
        }
        // extra add placeholder to dto
        if (additionalInformations.containsKey(WorkflowTaskInstanceService.FORM_PROPERTY_PLACEHOLDER_KEY)) {
            dto.setPlaceholder(additionalInformations.get(WorkflowTaskInstanceService.FORM_PROPERTY_PLACEHOLDER_KEY));
        }
        dto.getAdditionalInformations().putAll(additionalInformations);
    }
    return dto;
}
Also used : FormDataDto(eu.bcvsolutions.idm.core.workflow.model.dto.FormDataDto)

Example 2 with FormDataDto

use of eu.bcvsolutions.idm.core.workflow.model.dto.FormDataDto in project CzechIdMng by bcvsolutions.

the class DefaultWorkflowTaskInstanceService method historyToResource.

private FormDataDto historyToResource(FormProperty property, List<WorkflowHistoricTaskInstanceDto> history) {
    FormDataDto dto = new FormDataDto();
    dto.setId(property.getId());
    dto.setName(property.getName());
    String value;
    try {
        value = new ObjectMapper().writeValueAsString(history);
    } catch (JsonProcessingException e) {
        throw new CoreException(e);
    }
    dto.setValue(value);
    dto.setType(property.getType().getName());
    dto.setReadable(property.isReadable());
    dto.setRequired(property.isRequired());
    dto.setWritable(property.isWritable());
    return dto;
}
Also used : CoreException(eu.bcvsolutions.idm.core.api.exception.CoreException) FormDataDto(eu.bcvsolutions.idm.core.workflow.model.dto.FormDataDto) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

FormDataDto (eu.bcvsolutions.idm.core.workflow.model.dto.FormDataDto)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 CoreException (eu.bcvsolutions.idm.core.api.exception.CoreException)1