com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexHashKey Java Examples

The following examples show how to use com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexHashKey. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseDatabaseControllerTest.java    From nfscan with MIT License 6 votes vote down vote up
public void createTable(Class<? extends IDomain> domain){
    CreateTableRequest tableRequest = dynamoDBMapper.generateCreateTableRequest(domain);
    tableRequest = tableRequest.withProvisionedThroughput(new ProvisionedThroughput(5L,5L));

    //check whether or not we need to add a provisioning throughput value for GSI
    for (Method method : domain.getMethods()) {
        if(method.isAnnotationPresent(DynamoDBIndexHashKey.class)){
            String tempGSI = method.getAnnotation(DynamoDBIndexHashKey.class).globalSecondaryIndexName();
            for (GlobalSecondaryIndex globalSecondaryIndex : tableRequest.getGlobalSecondaryIndexes()) {
                if(globalSecondaryIndex.getIndexName().equals(tempGSI)){
                    globalSecondaryIndex.setProvisionedThroughput(new ProvisionedThroughput(5L,5L));
                }
            }
        }
    }

    amazonDynamoDBClient.createTable(tableRequest);
}
 
Example #2
Source File: MapperQueryExpressionCryptoTest.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DynamoDBHashKey
@DynamoDBIndexHashKey(
        globalSecondaryIndexNames = {
                "GSI-primary-hash-index-range-1",
                "GSI-primary-hash-index-range-2"}
)
public String getPrimaryHashKey() {
    return primaryHashKey;
}
 
Example #3
Source File: MapperQueryExpressionCryptoTest.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DynamoDBIndexHashKey(
        globalSecondaryIndexNames = {
                "GSI-index-hash-primary-range",
                "GSI-index-hash-index-range-1",
                "GSI-index-hash-index-range-2"}
)
public String getIndexHashKey() {
    return indexHashKey;
}
 
Example #4
Source File: DynamoDBEntityMetadataSupport.java    From spring-data-dynamodb with Apache License 2.0 5 votes vote down vote up
public String getOverriddenAttributeName(Method method) {

		if (method != null) {
			if (method.getAnnotation(DynamoDBAttribute.class) != null
					&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBAttribute.class).attributeName())) {
				return method.getAnnotation(DynamoDBAttribute.class).attributeName();
			}
			if (method.getAnnotation(DynamoDBHashKey.class) != null
					&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBHashKey.class).attributeName())) {
				return method.getAnnotation(DynamoDBHashKey.class).attributeName();
			}
			if (method.getAnnotation(DynamoDBRangeKey.class) != null
					&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBRangeKey.class).attributeName())) {
				return method.getAnnotation(DynamoDBRangeKey.class).attributeName();
			}
			if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null
					&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) {
				return method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName();
			}
			if (method.getAnnotation(DynamoDBIndexHashKey.class) != null
					&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexHashKey.class).attributeName())) {
				return method.getAnnotation(DynamoDBIndexHashKey.class).attributeName();
			}
			if (method.getAnnotation(DynamoDBVersionAttribute.class) != null
					&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBVersionAttribute.class).attributeName())) {
				return method.getAnnotation(DynamoDBVersionAttribute.class).attributeName();
			}
		}
		return null;

	}
 
Example #5
Source File: Game.java    From eb-java-scorekeep with Apache License 2.0 4 votes vote down vote up
@DynamoDBIndexHashKey(globalSecondaryIndexName="session-index",attributeName="session")
public String getSession() {
  return session;
}
 
Example #6
Source File: State.java    From eb-java-scorekeep with Apache License 2.0 4 votes vote down vote up
@DynamoDBIndexHashKey(globalSecondaryIndexName="game-index",attributeName="game")
public String getGame() {
  return game;
}
 
Example #7
Source File: Move.java    From eb-java-scorekeep with Apache License 2.0 4 votes vote down vote up
@DynamoDBIndexHashKey(globalSecondaryIndexName="game-index",attributeName="game")
public String getGame() {
  return game;
}
 
Example #8
Source File: HashKeyOnlyTableWithGSIITCase.java    From aws-dynamodb-encryption-java with Apache License 2.0 4 votes vote down vote up
@DoNotEncrypt
@DynamoDBIndexHashKey(globalSecondaryIndexName = "statusAndCreation")
public String getStatus() {
    return status;
}
 
Example #9
Source File: DynamoDBEntityMetadataSupport.java    From spring-data-dynamodb with Apache License 2.0 4 votes vote down vote up
@Override
public String getOverriddenAttributeName(final String propertyName) {

	Method method = findMethod(propertyName);
	if (method != null) {
		if (method.getAnnotation(DynamoDBAttribute.class) != null
				&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBAttribute.class).attributeName())) {
			return method.getAnnotation(DynamoDBAttribute.class).attributeName();
		}
		if (method.getAnnotation(DynamoDBHashKey.class) != null
				&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBHashKey.class).attributeName())) {
			return method.getAnnotation(DynamoDBHashKey.class).attributeName();
		}
		if (method.getAnnotation(DynamoDBRangeKey.class) != null
				&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBRangeKey.class).attributeName())) {
			return method.getAnnotation(DynamoDBRangeKey.class).attributeName();
		}
		if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null
				&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) {
			return method.getAnnotation(DynamoDBIndexRangeKey.class).attributeName();
		}
		if (method.getAnnotation(DynamoDBIndexHashKey.class) != null
				&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBIndexHashKey.class).attributeName())) {
			return method.getAnnotation(DynamoDBIndexHashKey.class).attributeName();
		}
		if (method.getAnnotation(DynamoDBVersionAttribute.class) != null
				&& StringUtils.isNotEmpty(method.getAnnotation(DynamoDBVersionAttribute.class).attributeName())) {
			return method.getAnnotation(DynamoDBVersionAttribute.class).attributeName();
		}
	}

	Field field = findField(propertyName);
	if (field != null) {
		if (field.getAnnotation(DynamoDBAttribute.class) != null
				&& StringUtils.isNotEmpty(field.getAnnotation(DynamoDBAttribute.class).attributeName())) {
			return field.getAnnotation(DynamoDBAttribute.class).attributeName();
		}
		if (field.getAnnotation(DynamoDBHashKey.class) != null
				&& StringUtils.isNotEmpty(field.getAnnotation(DynamoDBHashKey.class).attributeName())) {
			return field.getAnnotation(DynamoDBHashKey.class).attributeName();
		}
		if (field.getAnnotation(DynamoDBRangeKey.class) != null
				&& StringUtils.isNotEmpty(field.getAnnotation(DynamoDBRangeKey.class).attributeName())) {
			return field.getAnnotation(DynamoDBRangeKey.class).attributeName();
		}
		if (field.getAnnotation(DynamoDBIndexRangeKey.class) != null
				&& StringUtils.isNotEmpty(field.getAnnotation(DynamoDBIndexRangeKey.class).attributeName())) {
			return field.getAnnotation(DynamoDBIndexRangeKey.class).attributeName();
		}
		if (field.getAnnotation(DynamoDBIndexHashKey.class) != null
				&& StringUtils.isNotEmpty(field.getAnnotation(DynamoDBIndexHashKey.class).attributeName())) {
			return field.getAnnotation(DynamoDBIndexHashKey.class).attributeName();
		}
		if (field.getAnnotation(DynamoDBVersionAttribute.class) != null
				&& StringUtils.isNotEmpty(field.getAnnotation(DynamoDBVersionAttribute.class).attributeName())) {
			return field.getAnnotation(DynamoDBVersionAttribute.class).attributeName();
		}
	}
	return null;

}