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

The following examples show how to use com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexRangeKey. 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: IndexRangeKeyTestClass.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DoNotEncrypt
@DynamoDBIndexRangeKey(
        localSecondaryIndexName = "index_foo",
        attributeName = "indexFooRangeKey"
)
public Double getIndexFooRangeKeyWithFakeName() {
    return indexFooRangeKey;
}
 
Example #2
Source File: IndexRangeKeyTestClass.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DoNotEncrypt
@DynamoDBIndexRangeKey(
        localSecondaryIndexName = "index_bar"
)
public Double getIndexBarRangeKey() {
    return indexBarRangeKey;
}
 
Example #3
Source File: IndexRangeKeyTestClass.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DoNotEncrypt
@DynamoDBIndexRangeKey(
        localSecondaryIndexNames = {"index_foo_copy", "index_bar_copy"}
)
public Double getMultipleIndexRangeKey() {
    return multipleIndexRangeKey;
}
 
Example #4
Source File: MapperQueryExpressionCryptoTest.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DynamoDBRangeKey
@DynamoDBIndexRangeKey(
        globalSecondaryIndexNames = {"GSI-index-hash-primary-range"},
        localSecondaryIndexName = "LSI-primary-range"
)
public String getPrimaryRangeKey() {
    return primaryRangeKey;
}
 
Example #5
Source File: MapperQueryExpressionCryptoTest.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DynamoDBIndexRangeKey(
        globalSecondaryIndexNames = {
                "GSI-primary-hash-index-range-1",
                "GSI-index-hash-index-range-1",
                "GSI-index-hash-index-range-2"},
        localSecondaryIndexNames = {"LSI-index-range-1", "LSI-index-range-2"}
)
public String getIndexRangeKey() {
    return indexRangeKey;
}
 
Example #6
Source File: MapperQueryExpressionCryptoTest.java    From aws-dynamodb-encryption-java with Apache License 2.0 5 votes vote down vote up
@DynamoDBIndexRangeKey(
        localSecondaryIndexName = "LSI-index-range-3",
        globalSecondaryIndexName = "GSI-primary-hash-index-range-2"
)
public String getAnotherIndexRangeKey() {
    return anotherIndexRangeKey;
}
 
Example #7
Source File: DynamoDBHashAndRangeKeyExtractingEntityMetadataImpl.java    From spring-data-dynamodb with Apache License 2.0 5 votes vote down vote up
@Override
public Set<String> getIndexRangeKeyPropertyNames() {
	final Set<String> propertyNames = new HashSet<String>();
	ReflectionUtils.doWithMethods(getJavaType(), new MethodCallback() {
		public void doWith(Method method) {
			if (method.getAnnotation(DynamoDBIndexRangeKey.class) != null) {
				if ((method.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName() != null && method
						.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName().trim().length() > 0)
						|| (method.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames() != null && method
								.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames().length > 0)) {
					propertyNames.add(getPropertyNameForAccessorMethod(method));
				}
			}
		}
	});
	ReflectionUtils.doWithFields(getJavaType(), new FieldCallback() {
		public void doWith(Field field) {
			if (field.getAnnotation(DynamoDBIndexRangeKey.class) != null) {
				if ((field.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName() != null && field
						.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexName().trim().length() > 0)
						|| (field.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames() != null && field
								.getAnnotation(DynamoDBIndexRangeKey.class).localSecondaryIndexNames().length > 0)) {
					propertyNames.add(getPropertyNameForField(field));
				}
			}
		}
	});
	return propertyNames;
}
 
Example #8
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 #9
Source File: HashKeyOnlyTableWithGSIITCase.java    From aws-dynamodb-encryption-java with Apache License 2.0 4 votes vote down vote up
@DoNotEncrypt
@DynamoDBIndexRangeKey(globalSecondaryIndexName = "statusAndCreation")
public String getTs() {
    return ts;
}
 
Example #10
Source File: MapperQueryExpressionCryptoTest.java    From aws-dynamodb-encryption-java with Apache License 2.0 4 votes vote down vote up
@DynamoDBIndexRangeKey(localSecondaryIndexName = "LSI")
public String getLsiRangeKey() {
    return lsiRangeKey;
}
 
Example #11
Source File: Thread.java    From spring-data-dynamodb-demo with Apache License 2.0 4 votes vote down vote up
@DynamoDBIndexRangeKey(attributeName = "Message")
public String getMessage() {
	return message;
}
 
Example #12
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;

}