Example usage for com.amazonaws.services.dynamodbv2.document Item getBoolean

List of usage examples for com.amazonaws.services.dynamodbv2.document Item getBoolean

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.document Item getBoolean.

Prototype

public boolean getBoolean(String attrName) 

Source Link

Document

Returns the value of the specified attribute in the current item as a primitive boolean.

Usage

From source file:com.yahoo.athenz.zts.cert.impl.DynamoDBCertRecordStoreConnection.java

License:Apache License

@Override
public X509CertRecord getX509CertRecord(String provider, String instanceId, String service) {

    final String primaryKey = getPrimaryKey(provider, instanceId, service);
    try {//  w w w . j a  v a 2 s  . c om
        Item item = table.getItem(KEY_PRIMARY, primaryKey);
        if (item == null) {
            LOGGER.error("DynamoDB Get Error for {}: item not found", primaryKey);
            return null;
        }
        X509CertRecord certRecord = new X509CertRecord();
        certRecord.setProvider(provider);
        certRecord.setInstanceId(instanceId);
        certRecord.setService(service);
        certRecord.setCurrentSerial(item.getString(KEY_CURRENT_SERIAL));
        certRecord.setCurrentIP(item.getString(KEY_CURRENT_IP));
        certRecord.setCurrentTime(new Date(item.getLong(KEY_CURRENT_TIME)));
        certRecord.setPrevSerial(item.getString(KEY_PREV_SERIAL));
        certRecord.setPrevIP(item.getString(KEY_PREV_IP));
        certRecord.setPrevTime(new Date(item.getLong(KEY_PREV_TIME)));
        certRecord.setClientCert(item.getBoolean(KEY_CLIENT_CERT));
        return certRecord;
    } catch (Exception ex) {
        LOGGER.error("DynamoDB Get Error for {}: {}/{}", primaryKey, ex.getClass(), ex.getMessage());
        return null;
    }
}