Example usage for com.amazonaws.services.simpleworkflow.model WorkflowExecutionInfo getExecution

List of usage examples for com.amazonaws.services.simpleworkflow.model WorkflowExecutionInfo getExecution

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleworkflow.model WorkflowExecutionInfo getExecution.

Prototype


public WorkflowExecution getExecution() 

Source Link

Document

The workflow execution this information is about.

Usage

From source file:org.diksha.common.dyutils.SchedulerUDE.java

License:Apache License

public static void listActivitiesInWEI(SchedulerConfig schedulerConfig,
        List<WorkflowExecutionInfo> listWorkflowExecutionInfo) {

    AmazonSimpleWorkflowClient amazonSimpleWorkflowClient = new AmazonSimpleWorkflowClient(
            DyDBUtils.getAwsCredentials());
    amazonSimpleWorkflowClient.setEndpoint(schedulerConfig.getEndPoint());

    for (int cnt2 = 0; cnt2 < listWorkflowExecutionInfo.size(); cnt2++) {

        WorkflowExecutionInfo workflowExecutionInfo = listWorkflowExecutionInfo.get(cnt2);
        WorkflowExecution workflowExecution = workflowExecutionInfo.getExecution();
        //             System.out.println(workflowExecution);

        GetWorkflowExecutionHistoryRequest getWorkflowExecutionHistoryRequest = new GetWorkflowExecutionHistoryRequest()
                .withDomain(schedulerConfig.getDomain()).withExecution(workflowExecution);

        History history = amazonSimpleWorkflowClient
                .getWorkflowExecutionHistory(getWorkflowExecutionHistoryRequest);

        List<HistoryEvent> historyEvents;
        String nextPageToken;/*from   ww w .  ja v  a  2 s .  c  o  m*/

        do {
            historyEvents = history.getEvents();
            for (int cnt3 = 0; cnt3 < historyEvents.size(); cnt3++) {

                // , , , , , , 

                HistoryEvent he = historyEvents.get(cnt3);
                String eventType = historyEvents.get(cnt3).getEventType();
                if (eventType.equals("ActivityTaskStarted") || eventType.equals("ActivityTaskCompleted")
                        || eventType.equals("ActivityTaskFailed") || eventType.equals("ActivityTaskTimedOut")
                        || eventType.equals("ActivityTaskCanceled")
                        || eventType.equals("ActivityTaskCancelRequested")

                ) {

                    if (he.getEventType().equals("ActivityTaskCompleted"))
                        System.out.format("\n         %30s       %20s      ", he.getEventType(),
                                he.getEventTimestamp());

                }
            }
            nextPageToken = history.getNextPageToken();
            history.setNextPageToken(nextPageToken);
        } while (nextPageToken != null);

    }

}