public virtual object execute(CommandContext commandContext) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration; DeploymentCache deploymentCache = processEngineConfiguration.DeploymentCache; ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId); ensureNotNull("Process Definition '" + processDefinitionId + "' not found", "processDefinition", processDefinition); foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers) { checker.checkReadProcessDefinition(processDefinition); } StartFormHandler startFormHandler = processDefinition.StartFormHandler; if (startFormHandler == null) { return null; } FormEngine formEngine = Context.ProcessEngineConfiguration.FormEngines[formEngineName]; ensureNotNull("No formEngine '" + formEngineName + "' defined process engine configuration", "formEngine", formEngine); StartFormData startForm = startFormHandler.createStartFormData(processDefinition); object renderedStartForm = null; try { renderedStartForm = formEngine.renderStartForm(startForm); } catch (ScriptEvaluationException e) { LOG.exceptionWhenStartFormScriptEvaluation(processDefinitionId, e); } return renderedStartForm; }
public virtual object renderStartForm(StartFormData startForm) { if (string.ReferenceEquals(startForm.FormKey, null)) { return(null); } string formTemplateString = getFormTemplateString(startForm, startForm.FormKey); return(executeScript(formTemplateString, null)); }
public virtual void testGetStartFormData() { // given string processDefinitionId = selectProcessDefinitionByKey(FORM_PROCESS_KEY).Id; createGrantAuthorization(PROCESS_DEFINITION, FORM_PROCESS_KEY, userId, READ); // when StartFormData startFormData = formService.getStartFormData(processDefinitionId); // then assertNotNull(startFormData); assertEquals("deployment:org/camunda/bpm/engine/test/api/form/start.form", startFormData.FormKey); }
// GetStartForm test //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testGetStartFormWithAuthenticatedTenant() public virtual void testGetStartFormWithAuthenticatedTenant() { testRule.deployForTenant(TENANT_ONE, "org/camunda/bpm/engine/test/api/authorization/formKeyProcess.bpmn20.xml"); ProcessInstance instance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY); identityService.setAuthentication("aUserId", null, Arrays.asList(TENANT_ONE)); StartFormData startFormData = formService.getStartFormData(instance.ProcessDefinitionId); // then assertNotNull(startFormData); assertEquals("aStartFormKey", startFormData.FormKey); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testStartFormDefaultValue() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testStartFormDefaultValue() { string processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("FormPropertyDefaultValueTest.testDefaultValue").latestVersion().singleResult().Id; StartFormData startForm = formService.getStartFormData(processDefinitionId); IList <FormProperty> formProperties = startForm.FormProperties; assertEquals(4, formProperties.Count); foreach (FormProperty prop in formProperties) { if ("booleanProperty".Equals(prop.Id)) { assertEquals("true", prop.Value); } else if ("stringProperty".Equals(prop.Id)) { assertEquals("someString", prop.Value); } else if ("longProperty".Equals(prop.Id)) { assertEquals("42", prop.Value); } else if ("longExpressionProperty".Equals(prop.Id)) { assertEquals("23", prop.Value); } else { assertTrue("Invalid form property: " + prop.Id, false); } } // Override 2 properties. The others should pe posted as the default-value IDictionary <string, string> formDataUpdate = new Dictionary <string, string>(); formDataUpdate["longExpressionProperty"] = "1"; formDataUpdate["booleanProperty"] = "false"; ProcessInstance processInstance = formService.submitStartFormData(processDefinitionId, formDataUpdate); assertEquals(false, runtimeService.getVariable(processInstance.Id, "booleanProperty")); assertEquals("someString", runtimeService.getVariable(processInstance.Id, "stringProperty")); assertEquals(42L, runtimeService.getVariable(processInstance.Id, "longProperty")); assertEquals(1L, runtimeService.getVariable(processInstance.Id, "longExpressionProperty")); }
//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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Deployment public void testCustomStartFormHandlerExecutesQuery() public virtual void testCustomStartFormHandlerExecutesQuery() { // given startProcessInstancesByKey(DEFAULT_PROCESS_KEY, 5); string processDefinitionId = selectProcessDefinitionByKey(DEFAULT_PROCESS_KEY).Id; createGrantAuthorization(PROCESS_DEFINITION, DEFAULT_PROCESS_KEY, userId, READ); // when StartFormData startFormData = formService.getStartFormData(processDefinitionId); // then assertNotNull(startFormData); assertNotNull(MyDelegationService.CURRENT_AUTHENTICATION); assertEquals(userId, MyDelegationService.CURRENT_AUTHENTICATION.UserId); assertEquals(Convert.ToInt64(5), MyDelegationService.INSTANCES_COUNT); }
public virtual object renderStartForm(StartFormData startForm) { return(renderFormData(startForm)); }