public void requestCancelWorkflowExecution(WorkflowExecution execution) {
   String workflowId = execution.getWorkflowId();
   if (workflowId == null) {
     throw new IllegalArgumentException("null workflowId");
   }
   final ChildWorkflowTryCatchFinally childTryCatch = workflowExecutions.get(workflowId);
   if (childTryCatch == null) {
     throw new UnknownResourceException("Unknown excution: " + execution.toString());
   }
   String openExecutionRunId = childTryCatch.getWorkflowExecution().getRunId();
   if (execution.getRunId() != null && !openExecutionRunId.equals(execution.getRunId())) {
     throw new UnknownResourceException("Unknown Execution (runId doesn't match)");
   }
   childTryCatch.cancel(new CancellationException());
 }
 public String getWorkflowState(WorkflowExecution execution) throws WorkflowException {
   String workflowId = execution.getWorkflowId();
   if (workflowId == null) {
     throw new IllegalArgumentException("null workflowId");
   }
   final ChildWorkflowTryCatchFinally childTryCatch = workflowExecutions.get(workflowId);
   if (childTryCatch == null) {
     throw new UnknownResourceException(execution.toString());
   }
   String openExecutionRunId = childTryCatch.getWorkflowExecution().getRunId();
   if (execution.getRunId() != null && !openExecutionRunId.equals(execution.getRunId())) {
     throw new UnknownResourceException("Unknown Execution (runId doesn't match)");
   }
   return childTryCatch.getWorkflowState();
 }
 public Promise<Void> signalWorkflowExecution(
     final SignalExternalWorkflowParameters signalParameters) {
   WorkflowExecution signaledExecution = new WorkflowExecution();
   signaledExecution.setWorkflowId(signalParameters.getWorkflowId());
   signaledExecution.setRunId(signalParameters.getRunId());
   final ChildWorkflowTryCatchFinally childTryCatch =
       workflowExecutions.get(signalParameters.getWorkflowId());
   if (childTryCatch == null) {
     throw new SignalExternalWorkflowException(
         0, signaledExecution, "UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION");
   }
   String openExecutionRunId = childTryCatch.getWorkflowExecution().getRunId();
   if (signalParameters.getRunId() != null
       && !openExecutionRunId.equals(signalParameters.getRunId())) {
     throw new SignalExternalWorkflowException(
         0, signaledExecution, "Unknown Execution (runId doesn't match)");
   }
   childTryCatch.signalRecieved(signalParameters.getSignalName(), signalParameters.getInput());
   return Promise.Void();
 }