Example usage for com.amazonaws.services.simpleworkflow.model History getNextPageToken

List of usage examples for com.amazonaws.services.simpleworkflow.model History getNextPageToken

Introduction

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

Prototype


public String getNextPageToken() 

Source Link

Document

If a NextPageToken was returned by a previous call, there are more results available.

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.  j a 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);

    }

}