Package com.amazonaws.services.dynamodb.model

Examples of com.amazonaws.services.dynamodb.model.KeySchema


        createRequest.withTableName(tableName);
       
        //Key
        KeySchemaElement pathKey = new KeySchemaElement().withAttributeName(HASH_KEY).withAttributeType(ScalarAttributeType.S);
        KeySchemaElement fileKey = new KeySchemaElement().withAttributeName(RANGE_KEY).withAttributeType(ScalarAttributeType.S);
        KeySchema schema = new KeySchema();
        schema.setHashKeyElement(pathKey);
        schema.setRangeKeyElement(fileKey);
        createRequest.setKeySchema(schema);
       
        //Throughput
        ProvisionedThroughput tp = new ProvisionedThroughput();
        tp.setReadCapacityUnits(readUnits);
View Full Code Here


        List<com.amazonaws.services.dynamodbv2.model.AttributeDefinition> v2Attributes =
            new ArrayList<com.amazonaws.services.dynamodbv2.model.AttributeDefinition>();
        List<com.amazonaws.services.dynamodbv2.model.KeySchemaElement> v2KeySchema =
            new ArrayList<com.amazonaws.services.dynamodbv2.model.KeySchemaElement>();
        KeySchema keySchema = table.getKeySchema();
        if (keySchema != null) {
            if (keySchema.getHashKeyElement() != null) {
                v2Attributes.add(
                    new com.amazonaws.services.dynamodbv2.model.AttributeDefinition()
                        .withAttributeName(keySchema.getHashKeyElement().getAttributeName())
                        .withAttributeType(keySchema.getHashKeyElement().getAttributeType())
                );
                v2KeySchema.add(
                    new com.amazonaws.services.dynamodbv2.model.KeySchemaElement()
                        .withAttributeName(keySchema.getHashKeyElement().getAttributeName())
                        .withKeyType("HASH")
                );
            }
            if (keySchema.getRangeKeyElement() != null) {
                v2Attributes.add(
                    new com.amazonaws.services.dynamodbv2.model.AttributeDefinition()
                        .withAttributeName(keySchema.getRangeKeyElement().getAttributeName())
                        .withAttributeType(keySchema.getRangeKeyElement().getAttributeType())
                );
                v2KeySchema.add(
                    new com.amazonaws.services.dynamodbv2.model.KeySchemaElement()
                        .withAttributeName(keySchema.getRangeKeyElement().getAttributeName())
                        .withKeyType("RANGE")
                );
            }
        }
View Full Code Here

            } else if (attribute.getAttributeName().equals(rangeKeyName)) {
                rangeKeyType = attribute.getAttributeType();
            }
        }

        KeySchema keySchema = new KeySchema();
        if (hashKeyName != null) {
            keySchema.setHashKeyElement(
                new KeySchemaElement().withAttributeName(hashKeyName).withAttributeType(hashKeyType)
            );
        }
        if (rangeKeyName != null) {
            keySchema.setRangeKeyElement(
                new KeySchemaElement().withAttributeName(rangeKeyName).withAttributeType(rangeKeyType)
            );
        }

        ProvisionedThroughput v1ThruPut = null;
View Full Code Here

  public Boolean supports(Class clazz) {
    return KeySchema.class.isAssignableFrom(clazz);
  }

  public List<Error> validate(Object target) {
    KeySchema instance = (KeySchema) target;
    List<Error> errors = ValidatorUtils.rejectIfNull(instance);
    if (errors.size() == 0) {
      errors.addAll(ValidatorUtils.rejectIfNull(instance.getHashKeyElement()));
      if (errors.size() == 0) {
        if (instance.getHashKeyElement() != null) {
          errors.addAll(ValidatorUtils.invokeValidator(new KeySchemaElementValidator(), instance.getHashKeyElement()));
        }

        if (instance.getRangeKeyElement() != null) {
          errors.addAll(ValidatorUtils.invokeValidator(new KeySchemaElementValidator(), instance.getRangeKeyElement()));
          if (instance.getHashKeyElement().getAttributeName().equals(instance.getRangeKeyElement().getAttributeName())) {
            errors.add(new Error("Both the Hash Key and the Range Key element in the KeySchema have the same name."));
          }
        }
      }
    }
View Full Code Here

        List<String> attributesToGet = request.getAttributesToGet();

    QueryResult queryResult = new QueryResult();
    List<Map<String, AttributeValue>> list = new ArrayList<Map<String, AttributeValue>>();

        KeySchema keySchema = table.getKeySchema();
        KeySchemaElement rangeKeyElement = keySchema.getRangeKeyElement();
        ItemRangeGroup rangeGroup = table.getItemRangeGroup(hashKeyValue);
        if (rangeGroup != null) {
      for (Map<String, AttributeValue> item : rangeGroup.getItems(rangeKeyElement, request.getRangeKeyCondition())) {
        if (request.getScanIndexForward() == null || request.getScanIndexForward() == true) {
                    // The default value is true (forward).
View Full Code Here

        jsonWriter.key("TableName").value(table.getTableName());
        jsonWriter.key("TableSizeBytes").value(table.getTableSizeBytes());
        jsonWriter.key("TableStatus").value(table.getTableStatus());
        jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());

        KeySchema keySchema = table.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").object();
          KeySchemaElement hashKeyElement = keySchema.getHashKeyElement();
          if (hashKeyElement != null) {
            jsonWriter.key("HashKeyElement").object();
            if (hashKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(hashKeyElement.getAttributeName());
            }
            if (hashKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(hashKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }

          KeySchemaElement rangeKeyElement = keySchema.getRangeKeyElement();
          if (rangeKeyElement != null) {
            jsonWriter.key("RangeKeyElement").object();
            if (rangeKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(rangeKeyElement.getAttributeName());
            }
View Full Code Here

        jsonWriter.key("TableDescription").object();
        jsonWriter.key("TableName").value(table.getTableName());
        jsonWriter.key("TableStatus").value(table.getTableStatus());
        jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());

        KeySchema keySchema = table.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").object();
          KeySchemaElement hashKeyElement = keySchema.getHashKeyElement();
          if (hashKeyElement != null) {
            jsonWriter.key("HashKeyElement").object();
            if (hashKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(hashKeyElement.getAttributeName());
            }
            if (hashKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(hashKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }

          KeySchemaElement rangeKeyElement = keySchema.getRangeKeyElement();
          if (rangeKeyElement != null) {
            jsonWriter.key("RangeKeyElement").object();
            if (rangeKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(rangeKeyElement.getAttributeName());
            }
View Full Code Here

        jsonWriter.key("TableDescription").object();
        jsonWriter.key("TableName").value(table.getTableName());
        jsonWriter.key("TableStatus").value(table.getTableStatus());
        jsonWriter.key("CreationDateTime").value(table.getCreationDateTime());

        KeySchema keySchema = table.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").object();
          KeySchemaElement hashKeyElement = keySchema.getHashKeyElement();
          if (hashKeyElement != null) {
            jsonWriter.key("HashKeyElement").object();
            if (hashKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(hashKeyElement.getAttributeName());
            }
            if (hashKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(hashKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }

          KeySchemaElement rangeKeyElement = keySchema.getRangeKeyElement();
          if (rangeKeyElement != null) {
            jsonWriter.key("RangeKeyElement").object();
            if (rangeKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(rangeKeyElement.getAttributeName());
            }
View Full Code Here

        }
        if (desc.getTableStatus() != null) {
          jsonWriter.key("TableStatus").value(desc.getTableStatus());
        }

        KeySchema keySchema = desc.getKeySchema();
        if (keySchema != null) {
          jsonWriter.key("KeySchema").object();
          KeySchemaElement hashKeyElement = keySchema.getHashKeyElement();
          if (hashKeyElement != null) {
            jsonWriter.key("HashKeyElement").object();
            if (hashKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(hashKeyElement.getAttributeName());
            }
            if (hashKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(hashKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }
          KeySchemaElement rangeKeyElement = keySchema.getRangeKeyElement();
          if (rangeKeyElement != null) {
            jsonWriter.key("RangeKeyElement").object();
            if (rangeKeyElement.getAttributeName() != null) {
              jsonWriter.key("AttributeName").value(rangeKeyElement.getAttributeName());
            }
View Full Code Here

    }
   
    @Test
    public void queryUpdate() {
        // Setup table with items
        KeySchema schema = new KeySchema(new KeySchemaElement().withAttributeName("id").withAttributeType(ScalarAttributeType.S));
        createTable(tableName, schema);
       
        Key key = new Key();
        key.setHashKeyElement(new AttributeValue().withS("1"));
       
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodb.model.KeySchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.