Example usage for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflowClient listClosedWorkflowExecutions

List of usage examples for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflowClient listClosedWorkflowExecutions

Introduction

In this page you can find the example usage for com.amazonaws.services.simpleworkflow AmazonSimpleWorkflowClient listClosedWorkflowExecutions.

Prototype

@Override
public WorkflowExecutionInfos listClosedWorkflowExecutions(ListClosedWorkflowExecutionsRequest request) 

Source Link

Document

Returns a list of closed workflow executions in the specified domain that meet the filtering criteria.

Usage

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

License:Apache License

public void listStatus(String clientId, SchedulerConfig schedulerConfig) {

    DynamoDBMapper mapper = DyDBUtils.getDynamoDBMapper();
    SchedulerWorkflowState schedulerWorkflowState = mapper.load(SchedulerWorkflowState.class, clientId);

    System.out.println("clientID : " + clientId);
    System.out.println("     Launch Parameters");
    System.out/* w ww  .  j  av  a 2s.  co m*/
            .println("           Function: (" + this.functionName + ") with context = " + this.functionContext);
    System.out.println("                 CronExpression  : " + this.cronExpression);
    System.out.println("                 RepeatTimes     : " + this.repeatTimes);
    System.out.println("                 StartTimeDate   : " + this.startTimeDate);
    System.out.println("                 EndTimeDate     : " + this.endTimeDate);
    System.out.println("      Current State");

    int cnt = schedulerWorkflowState.loopCount - 1;

    System.out.println("            status of loop       : " + schedulerWorkflowState.getLoopState());

    System.out.println("            # of times executed  : " + cnt);

    System.out.println("            Last Executed @      : " + schedulerWorkflowState.lastExecutionTimeDate);
    System.out.println("            Next Proposed Time @ : " + schedulerWorkflowState.lastProposedTimeDate);

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

    ListOpenWorkflowExecutionsRequest listOpenWorkflowExecutionsRequest = new ListOpenWorkflowExecutionsRequest()
            .withDomain(schedulerConfig.getDomain())
            .withExecutionFilter(new WorkflowExecutionFilter().withWorkflowId(clientId))
            .withReverseOrder(new Boolean("true"))
            .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L)));

    WorkflowExecutionInfos openWorkflowExecutionInfos = amazonSimpleWorkflowClient
            .listOpenWorkflowExecutions(listOpenWorkflowExecutionsRequest);

    List<WorkflowExecutionInfo> listOpenWorkflowExecutionInfo = openWorkflowExecutionInfos.getExecutionInfos();

    ListClosedWorkflowExecutionsRequest listClosedWorkflowExecutionsRequest = new ListClosedWorkflowExecutionsRequest()
            .withDomain(schedulerConfig.getDomain())
            .withExecutionFilter(new WorkflowExecutionFilter().withWorkflowId(clientId))
            .withReverseOrder(new Boolean("true"))
            .withStartTimeFilter(new ExecutionTimeFilter().withOldestDate(new Date(0L)));

    WorkflowExecutionInfos closedWorkflowExecutionInfos = amazonSimpleWorkflowClient
            .listClosedWorkflowExecutions(listClosedWorkflowExecutionsRequest);

    List<WorkflowExecutionInfo> listClosedWorkflowExecutionInfo = closedWorkflowExecutionInfos
            .getExecutionInfos();

    listActivitiesInWEI(schedulerConfig, listOpenWorkflowExecutionInfo);
    listActivitiesInWEI(schedulerConfig, listClosedWorkflowExecutionInfo);

    System.out.println("\n");

}