Example usage for com.amazonaws.services.simpleworkflow.model ListClosedWorkflowExecutionsRequest ListClosedWorkflowExecutionsRequest

List of usage examples for com.amazonaws.services.simpleworkflow.model ListClosedWorkflowExecutionsRequest ListClosedWorkflowExecutionsRequest

Introduction

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

Prototype

ListClosedWorkflowExecutionsRequest

Source Link

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/*ww w  . j ava  2 s  .  com*/
            .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");

}