Java Code Examples for org.camunda.bpm.engine.variable.VariableMap#clear()
The following examples show how to use
org.camunda.bpm.engine.variable.VariableMap#clear() .
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: InvoiceTestCase.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources= {"invoice.v1.bpmn", "invoiceBusinessDecisions.dmn"}) public void testHappyPathV1() { InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf"); VariableMap variables = Variables.createVariables() .putValue("creditor", "Great Pizza for Everyone Inc.") .putValue("amount", 300.0d) .putValue("invoiceCategory", "Travel Expenses") .putValue("invoiceNumber", "GPFE-23232323") .putValue("invoiceDocument", fileValue("invoice.pdf") .file(invoiceInputStream) .mimeType("application/pdf") .create()); ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables); Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); assertEquals("approveInvoice", task.getTaskDefinitionKey()); List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId()); Set<String> approverGroups = new HashSet<String>(); for (IdentityLink link : links) { approverGroups.add(link.getGroupId()); } assertEquals(2, approverGroups.size()); assertTrue(approverGroups.contains("accounting")); assertTrue(approverGroups.contains("sales")); variables.clear(); variables.put("approved", Boolean.TRUE); taskService.complete(task.getId(), variables); task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); assertEquals("prepareBankTransfer", task.getTaskDefinitionKey()); taskService.complete(task.getId()); Job archiveInvoiceJob = managementService.createJobQuery().singleResult(); assertNotNull(archiveInvoiceJob); managementService.executeJob(archiveInvoiceJob.getId()); assertProcessEnded(pi.getId()); }
Example 2
Source File: InvoiceTestCase.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources= {"invoice.v2.bpmn", "invoiceBusinessDecisions.dmn"}) public void testHappyPathV2() { InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf"); VariableMap variables = Variables.createVariables() .putValue("creditor", "Great Pizza for Everyone Inc.") .putValue("amount", 300.0d) .putValue("invoiceCategory", "Travel Expenses") .putValue("invoiceNumber", "GPFE-23232323") .putValue("invoiceDocument", fileValue("invoice.pdf") .file(invoiceInputStream) .mimeType("application/pdf") .create()); ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables); Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); assertEquals("approveInvoice", task.getTaskDefinitionKey()); List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId()); Set<String> approverGroups = new HashSet<String>(); for (IdentityLink link : links) { approverGroups.add(link.getGroupId()); } assertEquals(2, approverGroups.size()); assertTrue(approverGroups.contains("accounting")); assertTrue(approverGroups.contains("sales")); variables.clear(); variables.put("approved", Boolean.TRUE); taskService.complete(task.getId(), variables); task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); assertEquals("prepareBankTransfer", task.getTaskDefinitionKey()); taskService.complete(task.getId()); Job archiveInvoiceJob = managementService.createJobQuery().singleResult(); assertNotNull(archiveInvoiceJob); managementService.executeJob(archiveInvoiceJob.getId()); assertProcessEnded(pi.getId()); }
Example 3
Source File: InvoiceTestCase.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Deployment(resources= {"invoice.v2.bpmn", "reviewInvoice.bpmn", "invoiceBusinessDecisions.dmn"}) public void testNonSuccessfulPath() { InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf"); VariableMap variables = Variables.createVariables() .putValue("creditor", "Great Pizza for Everyone Inc.") .putValue("amount", 300.0d) .putValue("invoiceCategory", "Travel Expenses") .putValue("invoiceNumber", "GPFE-23232323") .putValue("invoiceDocument", fileValue("invoice.pdf") .file(invoiceInputStream) .mimeType("application/pdf") .create()); ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables); Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult(); assertEquals("approveInvoice", task.getTaskDefinitionKey()); List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId()); Set<String> approverGroups = new HashSet<String>(); for (IdentityLink link : links) { approverGroups.add(link.getGroupId()); } assertEquals(2, approverGroups.size()); assertTrue(approverGroups.contains("accounting")); assertTrue(approverGroups.contains("sales")); variables.clear(); variables.put("approved", Boolean.FALSE); taskService.complete(task.getId(), variables); task = taskService.createTaskQuery().singleResult(); assertEquals("assignReviewer", task.getTaskDefinitionKey()); variables.clear(); variables.put("reviewer", "peter"); taskService.complete(task.getId(), variables); task = taskService.createTaskQuery().singleResult(); assertEquals("reviewInvoice", task.getTaskDefinitionKey()); variables.clear(); variables.put("clarified", Boolean.FALSE); taskService.complete(task.getId(), variables); assertProcessEnded(task.getProcessInstanceId()); assertProcessEnded(pi.getId()); }
Example 4
Source File: BusinessProcess.java From camunda-bpm-platform with Apache License 2.0 | 3 votes |
/** * Get the {@link VariableMap} of cached variables and clear the internal variable cache. * * @return the {@link VariableMap} of cached variables * * @since 7.3 */ public VariableMap getAndClearCachedVariableMap() { VariableMap cachedVariables = associationManager.getCachedVariables(); VariableMap copy = new VariableMapImpl(cachedVariables); cachedVariables.clear(); return copy; }
Example 5
Source File: BusinessProcess.java From camunda-bpm-platform with Apache License 2.0 | 3 votes |
/** * Get the {@link VariableMap} of local cached variables and clear the internal variable cache. * * @return the {@link VariableMap} of cached variables * * @since 7.3 */ public VariableMap getAndClearCachedLocalVariableMap() { VariableMap cachedVariablesLocal = associationManager.getCachedLocalVariables(); VariableMap copy = new VariableMapImpl(cachedVariablesLocal); cachedVariablesLocal.clear(); return copy; }