Exemple #1
0
        public static ProcessInstanceDto fromProcessInstance(ProcessInstanceWithVariables instance)
        {
            ProcessInstanceWithVariablesDto result = new ProcessInstanceWithVariablesDto(instance);
            VariableMap variables = instance.Variables;

            result.variables = VariableValueDto.fromMap(variables, true);
            return(result);
        }
Exemple #2
0
        protected internal virtual IDictionary <string, VariableValueDto> createResultEntriesDto(DmnDecisionResultEntries entries)
        {
            VariableMap variableMap = Variables.createVariables();

            foreach (string key in entries.Keys)
            {
                TypedValue typedValue = entries.getEntryTyped(key);
                variableMap.putValueTyped(key, typedValue);
            }

            return(VariableValueDto.fromMap(variableMap));
        }
Exemple #3
0
        public virtual IDictionary <string, VariableValueDto> getFormVariables(string variableNames, bool deserializeValues)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.FormService formService = engine.getFormService();
            FormService    formService   = engine.FormService;
            IList <string> formVariables = null;

            if (!string.ReferenceEquals(variableNames, null))
            {
                StringListConverter stringListConverter = new StringListConverter();
                formVariables = stringListConverter.convertQueryParameterToType(variableNames);
            }

            VariableMap startFormVariables = formService.getTaskFormVariables(taskId, formVariables, deserializeValues);

            return(VariableValueDto.fromMap(startFormVariables));
        }
Exemple #4
0
        public static MessageCorrelationResultWithVariableDto fromMessageCorrelationResultWithVariables(MessageCorrelationResultWithVariables result)
        {
            MessageCorrelationResultWithVariableDto dto = new MessageCorrelationResultWithVariableDto();

            if (result != null)
            {
                dto.ResultType = result.ResultType;
                if (result.ProcessInstance != null)
                {
                    dto.ProcessInstance = ProcessInstanceDto.fromProcessInstance(result.ProcessInstance);
                }
                else if (result.Execution != null)
                {
                    dto.Execution = ExecutionDto.fromExecution(result.Execution);
                }

                dto.variables = VariableValueDto.fromMap(result.Variables, true);
            }
            return(dto);
        }
Exemple #5
0
        public virtual Response complete(CompleteTaskDto dto)
        {
            TaskService taskService = engine.TaskService;

            try
            {
                VariableMap variables = VariableValueDto.toMap(dto.Variables, engine, objectMapper);
                if (dto.WithVariablesInReturn)
                {
                    VariableMap taskVariables = taskService.completeWithVariablesInReturn(taskId, variables, false);

                    IDictionary <string, VariableValueDto> body = VariableValueDto.fromMap(taskVariables, true);

                    return(Response.ok(body).type(MediaType.APPLICATION_JSON).build());
                }
                else
                {
                    taskService.complete(taskId, variables);
                    return(Response.noContent().build());
                }
            }
            catch (RestException e)
            {
                string errorMessage = string.Format("Cannot complete task {0}: {1}", taskId, e.Message);
                throw new InvalidRequestException(e.Status, e, errorMessage);
            }
            catch (AuthorizationException e)
            {
                throw e;
            }
            catch (FormFieldValidationException e)
            {
                string errorMessage = string.Format("Cannot complete task {0}: {1}", taskId, e.Message);
                throw new RestException(Response.Status.BAD_REQUEST, e, errorMessage);
            }
            catch (ProcessEngineException e)
            {
                string errorMessage = string.Format("Cannot complete task {0}: {1}", taskId, e.Message);
                throw new RestException(Response.Status.INTERNAL_SERVER_ERROR, e, errorMessage);
            }
        }
Exemple #6
0
        public static LockedExternalTaskDto fromLockedExternalTask(LockedExternalTask task)
        {
            LockedExternalTaskDto dto = new LockedExternalTaskDto();

            dto.activityId         = task.ActivityId;
            dto.activityInstanceId = task.ActivityInstanceId;
            dto.errorMessage       = task.ErrorMessage;
            dto.errorDetails       = task.ErrorDetails;
            dto.executionId        = task.ExecutionId;
            dto.id = task.Id;
            dto.lockExpirationTime   = task.LockExpirationTime;
            dto.processDefinitionId  = task.ProcessDefinitionId;
            dto.processDefinitionKey = task.ProcessDefinitionKey;
            dto.processInstanceId    = task.ProcessInstanceId;
            dto.retries     = task.Retries;
            dto.topicName   = task.TopicName;
            dto.workerId    = task.WorkerId;
            dto.tenantId    = task.TenantId;
            dto.variables   = VariableValueDto.fromMap(task.Variables);
            dto.priority    = task.Priority;
            dto.businessKey = task.BusinessKey;

            return(dto);
        }
Exemple #7
0
        public virtual IDictionary <string, VariableValueDto> getVariables(bool deserializeValues)
        {
            VariableMap variables = getVariableEntities(deserializeValues);

            return(VariableValueDto.fromMap(variables));
        }