Package com.amazonaws.services.dynamodb.model

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


     */
    public void setHashKeySchema(String tableName, String keyName, String keyType){
      KeySchema kSchema = tablesToKeySchemas.get(tableName);
        if ( kSchema == null)
          kSchema = new KeySchema();
        KeySchemaElement hashKey = new KeySchemaElement().withAttributeName(keyName).withAttributeType(keyType);
        kSchema.setHashKeyElement(hashKey);
        tablesToKeySchemas.put(tableName, kSchema);
    }
View Full Code Here


      KeySchema kSchema = tablesToKeySchemas.get(tableName);
 
      if (kSchema == null)
        return false;
 
      KeySchemaElement rangeKey = kSchema.getRangeKeyElement();
      KeySchemaElement hashKey = kSchema.getHashKeyElement();
      // A range key must have a hash key as well
     
      if (rangeKey != null){
        if (hashKey != null
          return true;
View Full Code Here

       
        CreateTableRequest createRequest = new CreateTableRequest();
        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);
       
View Full Code Here

        }

        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;
        com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput v2ThruPut = v2Request.getProvisionedThroughput();
View Full Code Here

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

  public List<Error> validate(Object target) {
    KeySchemaElement instance = (KeySchemaElement) target;
    List<Error> errors = ValidatorUtils.invokeValidator(new AttributeNameValidator(), instance.getAttributeName());
    errors.addAll(ValidatorUtils.invokeValidator(new AttributeTypeValidator(), instance.getAttributeType()));

    return removeNulls(errors);
  }
View Full Code Here

    if (table == null) {
      throw new ResourceNotFoundException("The table '" + request.getTableName() + "' doesn't exist.");
    }

    // Make sure that item specifies hash key and range key (if in schema)
    KeySchemaElement hashKey = table.getKeySchema().getHashKeyElement();
    KeySchemaElement rangeKey = table.getKeySchema().getRangeKeyElement();
    AttributeValue hashItem = request.getItem().get(hashKey.getAttributeName());
    AttributeValueType hashItemType = getAttributeValueType(hashItem);
    if (hashItem == null || hashItemType != AttributeValueType.fromString(hashKey.getAttributeType())) {
      throw new InternalServerErrorException("Missing hash key (" + hashKey.getAttributeName() + ") from item: " + request.getItem());
    }
    if (rangeKey != null) {
      AttributeValue rangeItem = request.getItem().get(rangeKey.getAttributeName());
      AttributeValueType rangeItemType = getAttributeValueType(rangeItem);
      if (rangeItem == null || rangeItemType != AttributeValueType.fromString(rangeKey.getAttributeType())) {
        throw new InternalServerErrorException("Missing range key (" + rangeKey.getAttributeName() + ") from item: " + request.getItem());
      }
    }

    // Get current item if it exists
//    Map<String, AttributeValue> item = table.getItem(getKeyValue(request.getItem().get(table.getHashKeyName())));
View Full Code Here

    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("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());
            }
            if (rangeKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(rangeKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }
          jsonWriter.endObject();
        }
View Full Code Here

        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());
            }
            if (rangeKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(rangeKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }
          jsonWriter.endObject();
        }
View Full Code Here

        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());
            }
            if (rangeKeyElement.getAttributeType() != null) {
              jsonWriter.key("AttributeType").value(rangeKeyElement.getAttributeType());
            }
            jsonWriter.endObject();
          }
          jsonWriter.endObject();
        }
View Full Code Here

TOP

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

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.