//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public Object invoke(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable public virtual object invoke(MethodInvocation invocation) { System.Reflection.MethodInfo method = invocation.Method; StartProcess startProcess = AnnotationUtils.getAnnotation(method, typeof(StartProcess)); string processKey = startProcess.processKey(); Assert.hasText(processKey, "you must provide the name of process to start"); object result; try { result = invocation.proceed(); IDictionary <string, object> vars = this.processVariablesFromAnnotations(invocation); string businessKey = this.processBusinessKey(invocation); log.info("variables for the started process: " + vars.ToString()); RuntimeService runtimeService = this.processEngine.RuntimeService; ProcessInstance pi; if (null != businessKey && StringUtils.hasText(businessKey)) { pi = runtimeService.startProcessInstanceByKey(processKey, businessKey, vars); log.info("the business key for the started process is '" + businessKey + "' "); } else { pi = runtimeService.startProcessInstanceByKey(processKey, vars); } string pId = pi.Id; if (invocation.Method.ReturnType.Equals(typeof(void))) { return(null); } if (shouldReturnProcessInstance(startProcess, invocation, result)) { return(pi); } if (shouldReturnProcessInstanceId(startProcess, invocation, result)) { return(pId); } if (shouldReturnAsyncResultWithProcessInstance(startProcess, invocation, result)) { return(new AsyncResult <ProcessInstance>(pi)); } } catch (Exception th) { throw new Exception(th); } return(result); }