 
					
				
		
10-23-2016 06:33 AM
   public ProcessResult readProcessResult(String processId) {
      HistoricProcessInstance hs = historyService.createHistoricProcessInstanceQuery().processInstanceId(processId)
            .includeProcessVariables().singleResult();
      Map<String, Object> variables = hs.getProcessVariables();
      ProcessResult result = new ProcessResult();
      result.setProcessId(hs.getId());
      result.setDurationInMillis(hs.getDurationInMillis());
      result.setResultExec1((String) variables.get("ExecuteS1"));
      result.setResultExec2((String) variables.get("ExecuteS2"));
      result.setResultExec3((String) variables.get("ExecuteS3"));
      result.setResultExec4((String) variables.get("ExecuteS4"));
      return result;
   }
@Service("serviceNo1")
public class ServiceNo1Impl implements ServiceNo1 {
   private static final Logger LOG = LoggerFactory.getLogger(ServiceNo1Impl.class);
   @Override
   public void execute(DelegateExecution execution) throws Exception {
      // do something…
      execution.setVariable("ExecuteS1", "OK");
      LOG.debug("serviceNo1.executed");
   }
}
   @RequestMapping(value = "/postAppExcl", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
   public ProcessResult processUserApplicationExcl(@RequestBody JobApplication jobApplication)
         throws InterruptedException {
      Map<String, Object> vars = Collections.<String, Object> singletonMap("jobApplication", jobApplication);
      String executionId = null;
      // start Activiti process
      identityService.setAuthenticatedUserId(activitiUsername);
      ProcessInstance process = runtimeService.startProcessInstanceByKey("myProcessJobAppExcl", vars);
      executionId = process.getProcessInstanceId();
      LOG.debug("myProcessJobApp: executionId=" + executionId);
      // read process result
      ProcessResult result = serviceResult.readProcessResult(executionId);
      LOG.debug("initial.result=" + result);
      // try 10 times (with 1sec wait between read state)(
      if (result.getDurationInMillis() == null) {
         for (int i = 1; i <= 10; i++) {
            Thread.sleep(1000);
            result = serviceResult.readProcessResult(executionId);
            // LOG.debug(i + ". result=" + result);
            if (result.getDurationInMillis() != null) {
               LOG.debug("End process with executionId=" + executionId);
               break;
            }
         }
         if (result.getDurationInMillis() == null) {
            LOG.debug("Process executionId=" + executionId + " not completed… yet ");
         }
      }
      LOG.debug("final.result=" + result);
      return result;
   }
10-24-2016 12:38 PM
 
					
				
		
10-24-2016 04:39 AM
 mgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns
mgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns mgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
mgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">10-24-2016 05:26 AM
 
					
				
		
10-24-2016 06:46 AM
 ostgresql://localhost:5432/activiti?currentSchema=actsb
ostgresql://localhost:5432/activiti?currentSchema=actsb 
					
				
		
10-24-2016 10:07 AM
10-24-2016 12:38 PM
 
					
				
		
10-26-2016 07:22 AM
 
					
				
				
			
		
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.