Example usage for com.amazonaws.services.datapipeline.model QueryObjectsResult getHasMoreResults

List of usage examples for com.amazonaws.services.datapipeline.model QueryObjectsResult getHasMoreResults

Introduction

In this page you can find the example usage for com.amazonaws.services.datapipeline.model QueryObjectsResult getHasMoreResults.

Prototype


public Boolean getHasMoreResults() 

Source Link

Document

Indicates whether there are more results that can be obtained by a subsequent call.

Usage

From source file:com.shazam.dataengineering.pipelinebuilder.AWSProxy.java

License:Apache License

public boolean hasRunningTasks(String pipelineId, String marker) {
    QueryObjectsRequest request = new QueryObjectsRequest().withSphere("ATTEMPT").withPipelineId(pipelineId);
    if (marker != null) {
        request.setMarker(marker);/*from   w w  w  .  ja v a  2s.  com*/
    }

    QueryObjectsResult queryResult = client.queryObjects(request);

    DescribeObjectsResult describeResult = describeTasks(pipelineId, queryResult.getIds());
    List<com.amazonaws.services.datapipeline.model.PipelineObject> tasks = describeResult.getPipelineObjects();
    for (com.amazonaws.services.datapipeline.model.PipelineObject task : tasks) {
        for (Field field : task.getFields()) {
            // Is task running?
            if (field.getKey().equals("@status") && field.getStringValue().equals("RUNNING")) {
                return true;
            }
        }
    }

    if (queryResult.getHasMoreResults()) {
        return hasRunningTasks(pipelineId, queryResult.getMarker());
    } else {
        return false;
    }
}