Example usage for com.amazonaws.services.iot.model ListThingsResult getThings

List of usage examples for com.amazonaws.services.iot.model ListThingsResult getThings

Introduction

In this page you can find the example usage for com.amazonaws.services.iot.model ListThingsResult getThings.

Prototype


public java.util.List<ThingAttribute> getThings() 

Source Link

Document

The things.

Usage

From source file:io.klerch.alexa.state.handler.AWSIotStateHandler.java

License:Open Source License

private boolean doesThingExist(final String thingName) {
    // if already checked existence than return immediately
    if (thingsExisting.contains(thingName))
        return true;
    // query by an attribute having the name of the thing
    // unfortunately you can only query for things with their attributes, not directly with their names
    final ListThingsRequest request = new ListThingsRequest().withAttributeName(thingAttributeName)
            .withAttributeValue(thingName).withMaxResults(1);
    final ListThingsResult result = awsClient.listThings(request);
    if (result != null && result.getThings() != null && result.getThings().isEmpty()) {
        thingsExisting.add(thingName);//from   ww w.  ja  v a2 s.  com
        return true;
    }
    return false;
}