//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private java.util.Map<String, Object> extractVariables(org.camunda.bpm.engine.cdi.annotation.StartProcess startProcessAnnotation, javax.interceptor.InvocationContext ctx) throws Exception private IDictionary <string, object> extractVariables(StartProcess startProcessAnnotation, InvocationContext ctx) { VariableMap variables = new VariableMapImpl(); foreach (System.Reflection.FieldInfo field in ctx.Method.DeclaringClass.DeclaredFields) { if (!field.isAnnotationPresent(typeof(ProcessVariable)) && !field.isAnnotationPresent(typeof(ProcessVariableTyped))) { continue; } field.Accessible = true; string fieldName = null; ProcessVariable processStartVariable = field.getAnnotation(typeof(ProcessVariable)); if (processStartVariable != null) { fieldName = processStartVariable.value(); } else { ProcessVariableTyped processStartVariableTyped = field.getAnnotation(typeof(ProcessVariableTyped)); fieldName = processStartVariableTyped.value(); } if (string.ReferenceEquals(fieldName, null) || fieldName.Length == 0) { fieldName = field.Name; } object value = field.get(ctx.Target); variables.put(fieldName, value); } return(variables); }
public override VariableMap execute(CommandContext commandContext) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.entity.TaskManager taskManager = commandContext.getTaskManager(); TaskManager taskManager = commandContext.TaskManager; TaskEntity task = taskManager.findTaskById(resourceId); ensureNotNull(typeof(BadUserRequestException), "Cannot find task with id '" + resourceId + "'.", "task", task); checkGetTaskFormVariables(task, commandContext); VariableMapImpl result = new VariableMapImpl(); // first, evaluate form fields TaskDefinition taskDefinition = task.TaskDefinition; if (taskDefinition != null) { TaskFormData taskFormData = taskDefinition.TaskFormHandler.createTaskForm(task); foreach (FormField formField in taskFormData.FormFields) { if (formVariableNames == null || formVariableNames.Contains(formField.Id)) { result.put(formField.Id, createVariable(formField, task)); } } } // collect remaining variables from task scope and parent scopes task.collectVariables(result, formVariableNames, false, deserializeObjectValues); return(result); }
public virtual CaseExecutionCommandBuilder setVariableLocal(string localVariableName, object localVariableValue) { ensureNotNull(typeof(NotValidException), "localVariableName", localVariableName); ensureVariableShouldNotBeRemoved(localVariableName); ensureVariablesLocalInitialized(); variablesLocal.put(localVariableName, localVariableValue); return(this); }
public virtual CaseExecutionCommandBuilder setVariable(string variableName, object variableValue) { ensureNotNull(typeof(NotValidException), "variableName", variableName); ensureVariableShouldNotBeRemoved(variableName); ensureVariablesInitialized(); variables.put(variableName, variableValue); return(this); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public org.camunda.bpm.engine.variable.VariableMap execute(final org.camunda.bpm.engine.impl.interceptor.CommandContext commandContext) public override VariableMap execute(CommandContext commandContext) { StartFormData startFormData = commandContext.runWithoutAuthorization(new CallableAnonymousInnerClass(this, commandContext)); ProcessDefinition definition = startFormData.ProcessDefinition; checkGetStartFormVariables((ProcessDefinitionEntity)definition, commandContext); VariableMap result = new VariableMapImpl(); foreach (FormField formField in startFormData.FormFields) { if (formVariableNames == null || formVariableNames.Contains(formField.Id)) { result.put(formField.Id, createVariable(formField, null)); } } return(result); }
public virtual void collectVariables(VariableMapImpl resultVariables, ICollection <string> variableNames, bool isLocal, bool deserializeValues) { bool collectAll = (variableNames == null); IList <CoreVariableInstance> localVariables = getVariableInstancesLocal(variableNames); foreach (CoreVariableInstance var in localVariables) { if (!resultVariables.containsKey(var.Name) && (collectAll || variableNames.Contains(var.Name))) { resultVariables.put(var.Name, var.getTypedValue(deserializeValues)); } } if (!isLocal) { AbstractVariableScope parentScope = ParentVariableScope; // Do not propagate to parent if all variables in 'variableNames' are already collected! if (parentScope != null && (collectAll || !resultVariables.Keys.Equals(variableNames))) { parentScope.collectVariables(resultVariables, variableNames, isLocal, deserializeValues); } } }