当前位置: 首页>>代码示例>>Java>>正文


Java Table.getItem方法代码示例

本文整理汇总了Java中com.amazonaws.services.dynamodbv2.document.Table.getItem方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getItem方法的具体用法?Java Table.getItem怎么用?Java Table.getItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.dynamodbv2.document.Table的用法示例。


在下文中一共展示了Table.getItem方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readState

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
@Override
public StorageTestState readState(final String identity)
{
    final Table table = dynamoDBConnection.getDynamoDB().getTable(getTableName());
    final Item item = table.getItem("_id", generateItemId(identity));

    if (item != null)
    {
        try
        {
            final StorageTestState testState = new HelloState();
            dynamoDBConnection.getMapper().readerForUpdating(testState).readValue(item.getJSON("_state"));
            return testState;
        }
        catch (Exception e)
        {
            throw new UncheckedException(e);
        }
    }
    return null;
}
 
开发者ID:orbit,项目名称:orbit-dynamodb,代码行数:22,代码来源:DynamoDBPersistenceTest.java

示例2: retrieveItem

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public static void retrieveItem(String threadId, String replyDateTime) throws IOException {
    
    Table table = dynamoDB.getTable(tableName);
    
    GetItemSpec spec = new GetItemSpec()
        .withPrimaryKey("Id", threadId, "ReplyDateTime", replyDateTime)
        .withConsistentRead(true);

    Item item = table.getItem(spec);
    
    
 // Uncompress the reply message and print
    String uncompressed = uncompressString(ByteBuffer.wrap(item.getBinary("ExtendedMessage")));
    
    System.out.println("Reply message:\n"
        + " Id: " + item.getString("Id") + "\n" 
        + " ReplyDateTime: " + item.getString("ReplyDateTime") + "\n" 
        + " PostedBy: " + item.getString("PostedBy") + "\n"
        + " Message: " + item.getString("Message") + "\n"
        + " ExtendedMessage (uncompressed): " + uncompressed + "\n");
}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:22,代码来源:DocumentAPIItemBinaryExample.java

示例3: readLatestVersion

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
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");
}
 
开发者ID:Netflix,项目名称:hollow-reference-implementation,代码行数:12,代码来源:DynamoDBAnnouncementWatcher.java

示例4: readOwningType

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public String readOwningType(final String identity)
{
    final Table table = dynamoDBConnection.getDynamoDB().getTable(getTableName());
    final Item item = table.getItem("_id", generateItemId(identity));

    if (item != null)
    {
        return item.getString(DynamoDBUtils.FIELD_NAME_OWNING_ACTOR_TYPE);
    }
    return null;
}
 
开发者ID:orbit,项目名称:orbit-dynamodb,代码行数:12,代码来源:DynamoDBPersistenceTest.java

示例5: getConfigItem

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
public Item getConfigItem() {
    Regions currentRegion = getDeploymentRegion();
    AmazonDynamoDBClient dynamoDBClient = new AmazonDynamoDBClient().withRegion(currentRegion);

    String configTableName = getConfigTableName(context.getFunctionName());
    Table configTable = new DynamoDB(dynamoDBClient).getTable(configTableName);
    String environment = getFunctionNameEnvironmentSuffix().orElse(DEFAULT_ENVIRONMENT);

    System.out.println("Looking up config table : " + configTableName + " for config by key: "+environment);
    return configTable.getItem(CONFIG_TABLE_KEY_NAME, environment);
}
 
开发者ID:willh,项目名称:lambda-helloworld-config,代码行数:12,代码来源:ContextWrapper.java

示例6: getItem

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
private Item getItem(String group, String key, Table table) {
  return table.getItem(HASH_KEY, group, RANGE_KEY, key);
}
 
开发者ID:dehora,项目名称:outland,代码行数:4,代码来源:DefaultFeatureStorage.java

示例7: retrieveItem

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
private static void retrieveItem() {
    Table table = dynamoDB.getTable(tableName);

    try {

        Item item = table.getItem("Id", 120,  "Id, ISBN, Title, Authors", null);

        System.out.println("Printing item after retrieving it....");
        System.out.println(item.toJSONPretty());

    } catch (Exception e) {
        System.err.println("GetItem failed.");
        System.err.println(e.getMessage());
    }   

}
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:17,代码来源:DocumentAPIItemCRUDExample.java

示例8: getBook

import com.amazonaws.services.dynamodbv2.document.Table; //导入方法依赖的package包/类
private static void getBook(int id, String tableName) {

        Table table = dynamoDB.getTable(tableName);

        Item item = table.getItem("Id", // attribute name
                id, // attribute value
                "Id, ISBN, Title, Authors", // projection expression
                null); // name map - don't need this

        System.out.println("GetItem: printing results...");
        System.out.println(item.toJSONPretty());

    }
 
开发者ID:awslabs,项目名称:aws-dynamodb-examples,代码行数:14,代码来源:GettingStartedTryQuery.java


注:本文中的com.amazonaws.services.dynamodbv2.document.Table.getItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。