Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2012-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"). You may not
   * use this file except in compliance with the License. A copy of the License is
   * located at
   * 
   * http://aws.amazon.com/apache2.0
   * 
  * or in the "license" file accompanying this file. This file is distributed on
  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  * express or implied. See the License for the specific language governing
  * permissions and limitations under the License.
  */
 package com.amazonaws.services.simpleworkflow.flow.worker;
 
 import java.util.UUID;
 
 
 
     private final String domain;
 
     private final AmazonSimpleWorkflow service;
 
     public GenericWorkflowClientExternalImpl(AmazonSimpleWorkflow serviceString domain) {
         this. = service;
         this. = domain;
     }
 
     @Override
         StartWorkflowExecutionRequest request = new StartWorkflowExecutionRequest();
         request.setDomain();
 
         request.setInput(startParameters.getInput());
         request.setExecutionStartToCloseTimeout(FlowHelpers.secondsToDuration(startParameters.getExecutionStartToCloseTimeout()));
         request.setTaskStartToCloseTimeout(FlowHelpers.secondsToDuration(startParameters.getTaskStartToCloseTimeoutSeconds()));
         request.setTagList(startParameters.getTagList());
         String taskList = startParameters.getTaskList();
         if (taskList != null && !taskList.isEmpty()) {
             request.setTaskList(new TaskList().withName(taskList));
         }
         request.setWorkflowId(startParameters.getWorkflowId());
         request.setWorkflowType(startParameters.getWorkflowType());
         request.setTaskPriority(FlowHelpers.taskPriorityToString(startParameters.getTaskPriority()));
         
         Run result = .startWorkflowExecution(request);
         WorkflowExecution execution = new WorkflowExecution().withRunId(result.getRunId()).withWorkflowId(request.getWorkflowId());
 
         return execution;
     }
 
     @Override
     public void signalWorkflowExecution(SignalExternalWorkflowParameters signalParameters) {
         request.setDomain();
 
         request.setInput(signalParameters.getInput());
         request.setSignalName(signalParameters.getSignalName());
         request.setRunId(signalParameters.getRunId());
         request.setWorkflowId(signalParameters.getWorkflowId());
 
         .signalWorkflowExecution(request);
     }
 
     @Override
     public void requestCancelWorkflowExecution(WorkflowExecution execution) {
         request.setDomain();
 
         request.setRunId(execution.getRunId());
         request.setWorkflowId(execution.getWorkflowId());
         
         .requestCancelWorkflowExecution(request);
     }
 
     @Override
     public String generateUniqueId() {
         String workflowId = UUID.randomUUID().toString();
         return workflowId;
     }
 
     @Override
    public String getWorkflowState(WorkflowExecution execution) {
        request.setDomain();
        request.setExecution(execution);
        WorkflowExecutionDetail details = .describeWorkflowExecution(request);
        return details.getLatestExecutionContext();
    }
    @Override
    public void terminateWorkflowExecution(TerminateWorkflowExecutionParameters terminateParameters) {
        WorkflowExecution workflowExecution = terminateParameters.getWorkflowExecution();
        request.setWorkflowId(workflowExecution.getWorkflowId());
        request.setRunId(workflowExecution.getRunId());
        request.setDomain();
        request.setDetails(terminateParameters.getDetails());
        request.setReason(terminateParameters.getReason());
        request.setChildPolicy(terminateParameters.getChildPolicy());
        .terminateWorkflowExecution(request);
    }
New to GrepCode? Check out our FAQ X