Java Code Examples for org.activiti.engine.form.StartFormData#getFormProperties()
The following examples show how to use
org.activiti.engine.form.StartFormData#getFormProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormPropertyDefaultValueTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testStartFormDefaultValue() throws Exception { String processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey("FormPropertyDefaultValueTest.testDefaultValue").latestVersion().singleResult().getId(); StartFormData startForm = formService.getStartFormData(processDefinitionId); List<FormProperty> formProperties = startForm.getFormProperties(); assertEquals(4, formProperties.size()); for (FormProperty prop : formProperties) { if ("booleanProperty".equals(prop.getId())) { assertEquals("true", prop.getValue()); } else if ("stringProperty".equals(prop.getId())) { assertEquals("someString", prop.getValue()); } else if ("longProperty".equals(prop.getId())) { assertEquals("42", prop.getValue()); } else if ("longExpressionProperty".equals(prop.getId())) { assertEquals("23", prop.getValue()); } else { assertTrue("Invalid form property: " + prop.getId(), false); } } // Override 2 properties. The others should pe posted as the // default-value Map<String, String> formDataUpdate = new HashMap<String, String>(); formDataUpdate.put("longExpressionProperty", "1"); formDataUpdate.put("booleanProperty", "false"); ProcessInstance processInstance = formService.submitStartFormData(processDefinitionId, formDataUpdate); assertEquals(false, runtimeService.getVariable(processInstance.getId(), "booleanProperty")); assertEquals("someString", runtimeService.getVariable(processInstance.getId(), "stringProperty")); assertEquals(42L, runtimeService.getVariable(processInstance.getId(), "longProperty")); assertEquals(1L, runtimeService.getVariable(processInstance.getId(), "longExpressionProperty")); }
Example 2
Source File: FormPropertyDefaultValueTest.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Deployment public void testStartFormDefaultValue() throws Exception { String processDefinitionId = repositoryService.createProcessDefinitionQuery() .processDefinitionKey("FormPropertyDefaultValueTest.testDefaultValue") .latestVersion() .singleResult() .getId(); StartFormData startForm = formService.getStartFormData(processDefinitionId); List<FormProperty> formProperties = startForm.getFormProperties(); assertEquals(4, formProperties.size()); for (FormProperty prop : formProperties) { if ("booleanProperty".equals(prop.getId())) { assertEquals("true", prop.getValue()); } else if ("stringProperty".equals(prop.getId())) { assertEquals("someString", prop.getValue()); } else if ("longProperty".equals(prop.getId())) { assertEquals("42", prop.getValue()); } else if ("longExpressionProperty".equals(prop.getId())) { assertEquals("23", prop.getValue()); } else { assertTrue("Invalid form property: " + prop.getId(), false); } } // Override 2 properties. The others should pe posted as the default-value Map<String, String> formDataUpdate = new HashMap<String, String>(); formDataUpdate.put("longExpressionProperty", "1"); formDataUpdate.put("booleanProperty", "false"); ProcessInstance processInstance = formService.submitStartFormData(processDefinitionId, formDataUpdate); assertEquals(false, runtimeService.getVariable(processInstance.getId(), "booleanProperty")); assertEquals("someString", runtimeService.getVariable(processInstance.getId(), "stringProperty")); assertEquals(42L, runtimeService.getVariable(processInstance.getId(), "longProperty")); assertEquals(1L, runtimeService.getVariable(processInstance.getId(), "longExpressionProperty")); }
Example 3
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 4
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 5
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 6
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 7
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 8
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 9
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 10
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 11
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 12
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 13
Source File: LeaveDynamicFormTest.java From activiti-in-action-codes with Apache License 2.0 | 5 votes |
@Test @Deployment(resources = "chapter6/dynamic-form/leave.bpmn") public void testJavascriptFormType() throws Exception { // 验证是否部署成功 long count = repositoryService.createProcessDefinitionQuery().count(); assertEquals(1, count); ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("leave").singleResult(); StartFormData startFormData = formService.getStartFormData(processDefinition.getId()); List<FormProperty> formProperties = startFormData.getFormProperties(); for (FormProperty formProperty : formProperties) { System.out.println(formProperty.getId() + ",value=" + formProperty.getValue()); } }
Example 14
Source File: ProcessDefinitionPropertiesResource.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
@RequestMapping(value = "/process-definition/{processDefinitionId}/properties", method = RequestMethod.GET, produces = "application/json") public ObjectNode getStartFormProperties(@ApiParam(name = "processDefinitionId") @PathVariable String processDefinitionId) { StartFormData startFormData = formService.getStartFormData(processDefinitionId); ObjectNode responseJSON = objectMapper.createObjectNode(); ArrayNode propertiesJSON = objectMapper.createArrayNode(); if (startFormData != null) { List<FormProperty> properties = startFormData.getFormProperties(); for (FormProperty property : properties) { ObjectNode propertyJSON = objectMapper.createObjectNode(); propertyJSON.put("id", property.getId()); propertyJSON.put("name", property.getName()); if (property.getValue() != null) { propertyJSON.put("value", property.getValue()); } else { propertyJSON.putNull("value"); } if (property.getType() != null) { propertyJSON.put("type", property.getType().getName()); if (property.getType() instanceof EnumFormType) { @SuppressWarnings("unchecked") Map<String, String> valuesMap = (Map<String, String>) property.getType().getInformation("values"); if (valuesMap != null) { ArrayNode valuesArray = objectMapper.createArrayNode(); propertyJSON.put("enumValues", valuesArray); for (String key : valuesMap.keySet()) { ObjectNode valueJSON = objectMapper.createObjectNode(); valueJSON.put("id", key); valueJSON.put("name", valuesMap.get(key)); valuesArray.add(valueJSON); } } } } else { propertyJSON.put("type", "String"); } propertyJSON.put("required", property.isRequired()); propertyJSON.put("readable", property.isReadable()); propertyJSON.put("writable", property.isWritable()); propertiesJSON.add(propertyJSON); } } responseJSON.put("data", propertiesJSON); return responseJSON; }