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

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

Introduction

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

Prototype

public long getLong(String attrName) 

Source Link

Document

Returns the value of the specified attribute in the current item as an long.

Usage

From source file:com.exorath.service.party.service.DynamoDatabaseProvider.java

License:Apache License

/**
 * Convert an item containing information about a party into a party object
 *
 * @param item The item containing the information
 * @return A party object containing all possible information from the item
 *//*from   www .j a v a 2  s  . com*/
private Party getPartyFromItem(Item item) {
    String owner_uuid = item.hasAttribute(OWNER_UUID) ? item.getString(OWNER_UUID) : null;
    String party_uuid = item.hasAttribute(PARTY_UUID) ? item.getString(PARTY_UUID) : null;
    String serverId = item.hasAttribute(SERVER_ID) ? item.getString(SERVER_ID) : null;
    ArrayList<String> members = item.hasAttribute(MEMBERS) ? new ArrayList<>(item.getStringSet(MEMBERS)) : null;
    Long expiry = item.hasAttribute(EXPIRE) ? item.getLong(EXPIRE) : null;
    return new Party(party_uuid, owner_uuid, serverId, members, expiry);
}

From source file:com.netflix.hollow.example.consumer.infrastructure.DynamoDBAnnouncementWatcher.java

License:Apache License

public long readLatestVersion() {
    Table table = dynamoDB.getTable(tableName);

    Item item = table.getItem("namespace", blobNamespace, "version, pin_version", null);

    if (item.isPresent("pin_version") && !item.isNull("pin_version"))
        return item.getLong("pin_version");

    return item.getLong("version");
}

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 {/*from  ww w  .  ja  v a2  s.c  o m*/
        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;
    }
}