Example usage for com.amazonaws.services.dynamodbv2.model LocalSecondaryIndex setKeySchema

List of usage examples for com.amazonaws.services.dynamodbv2.model LocalSecondaryIndex setKeySchema

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model LocalSecondaryIndex setKeySchema.

Prototype


public void setKeySchema(java.util.Collection<KeySchemaElement> keySchema) 

Source Link

Document

The complete key schema for the local secondary index, consisting of one or more pairs of attribute names and key types:

  • HASH - partition key

  • RANGE - sort key

The partition key of an item is also known as its hash attribute.

Usage

From source file:io.venable.amazonaws.dynamo.table.builder.LocalSecondaryIndexBuilderImpl.java

License:Apache License

void buildSecondaryIndexes(KeySchemaElement primaryHashKeySchemaElement,
        Collection<LocalSecondaryIndex> localSecondaryIndexCollection,
        Collection<AttributeDefinition> attributeDefinitionCollection) {
    LocalSecondaryIndex localSecondaryIndex = new LocalSecondaryIndex();

    localSecondaryIndex.setIndexName(indexName);
    Collection<KeySchemaElement> keySchemaElementCollection = new ArrayList<>();
    keySchemaElementCollection.add(primaryHashKeySchemaElement);
    buildRangeKey(keySchemaElementCollection, attributeDefinitionCollection);
    localSecondaryIndex.setKeySchema(keySchemaElementCollection);

    projection.build(localSecondaryIndex);

    localSecondaryIndexCollection.add(localSecondaryIndex);
}

From source file:org.xmlsh.aws.util.AWSDDBCommand.java

License:BSD License

protected LocalSecondaryIndex parseLocalSecondaryIndex(XValue xv)
        throws InvalidArgumentException, UnexpectedException {

    if (!xv.isXdmNode())
        throw new InvalidArgumentException(
                "Unexpected argument type for global secondary index: " + xv.describe());
    XdmNode node = xv.asXdmNode();/*from   ww w  .j ava  2s. c  o m*/
    if (!node.getNodeName().getLocalName().equals("local-secondary-index"))
        throw new InvalidArgumentException(
                "Unexpected element: " + node.getNodeName().toString() + " expected: local-secondary-index");

    LocalSecondaryIndex li = new LocalSecondaryIndex()
            .withIndexName(node.getAttributeValue(new QName("index-name")));

    li.setKeySchema(parseKeySchemaList(xpath(xv, "./key-schema")));
    return li;

}