@@ -0,0 +1,3002 @@
+package com.snail.exam;%0D%0A%0D%0Aimport java.util.HashMap;%0D%0Aimport java.util.Map;%0D%0A%0D%0Aimport org.activiti.engine.ActivitiException;%0D%0Aimport org.activiti.engine.ProcessEngine;%0D%0Aimport org.activiti.engine.ProcessEngines;%0D%0Aimport org.activiti.engine.RepositoryService;%0D%0Aimport org.activiti.engine.RuntimeService;%0D%0Aimport org.activiti.engine.runtime.ProcessInstance;%0D%0Aimport org.apache.commons.lang3.time.DateUtils;%0D%0Aimport org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A%0D%0Apublic class MyProcess2 %7B%0D%0A%0D%0A    private static final Logger log = LoggerFactory.getLogger(MyProcess2.class);%0D%0A%0D%0A    public static void main(String%5B%5D args) %7B%0D%0A        try %7B%0D%0A            ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();%0D%0A%0D%0A            // ----- 4.3.1. Deploying the process%0D%0A            log.info(%22--- #1. Deploying the process%22);%0D%0A            RepositoryService repositoryService = processEngine.getRepositoryService();%0D%0A            repositoryService.createDeployment()%0D%0A                    .addClasspathResource(%22org/activiti/test/VacationRequest.bpmn20.xml%22)%0D%0A                    .deploy();%0D%0A            %0D%0A            // ----- 4.3.4. Suspending and activating a process%0D%0A            log.info(%22--- #2. Suspend Process%22);%0D%0A            repositoryService.suspendProcessDefinitionByKey(%22vacationRequest%22);%0D%0A%0D%0A            // ----- 4.3.2. Starting a process instance%0D%0A            log.info(%22--- #3. Starting a process instance (will fail)%22);%0D%0A%0D%0A            Map%3CString, Object%3E variables = new HashMap%3CString, Object%3E();%0D%0A            variables.put(%22employeeName%22, %22Kermit%22);%0D%0A            variables.put(%22numberOfDays%22, new Integer(4));%0D%0A            variables.put(%22startDate%22, DateUtils.parseDate(%221999-12-31%22, %22yyyy-MM-dd%22));%0D%0A            variables.put(%22vacationMotivation%22, %22I'm really tired!%22);%0D%0A%0D%0A            // the process to run%0D%0A            // id        : %3Cprocess id=%22vacationRequest%22%3E%0D%0A            // arguments : %3Cactiviti:formProperty%3E%0D%0A            RuntimeService runtimeService = processEngine.getRuntimeService();%0D%0A            try %7B%0D%0A                ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(%22vacationRequest%22, variables);%0D%0A            %7D catch (ActivitiException e) %7B%0D%0A                log.error(%22ERROR%22, e);%0D%0A            %7D%0D%0A            %0D%0A            // ----- 4.3.4. Suspending and activating a process%0D%0A            log.info(%22--- #5. Activate Process%22);%0D%0A            repositoryService.activateProcessDefinitionByKey(%22vacationRequest%22);%0D%0A            %0D%0A            log.info(%22--- #6. Starting a process instance (will success)%22);            %0D%0A            try %7B%0D%0A                ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(%22vacationRequest%22, variables);%0D%0A                log.info(%22%7B%7D was started%22, processInstance.getProcessDefinitionId());%0D%0A            %7D catch (ActivitiException e) %7B%0D%0A                log.error(%22ERROR%22, e);%0D%0A            %7D%0D%0A %0D%0A        %7D catch (Throwable th) %7B%0D%0A            log.error(%22ERROR%22, th);%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Add suspend process example