Java 类com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBIndexHashKey 实例源码

项目:nfscan    文件:BaseDatabaseControllerTest.java   
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);
}
项目:micro-genie    文件:DynamoAdmin.java   
/***
 * Create the table and the associated indexes if it does not already exist
 * @param reflections
 * @param clazz
 */
private CreateTableResult createTable(Class<?> clazz) {

    final String tableName = this.getClassAnnotationValue(clazz, DynamoDBTable.class, String.class, "tableName");

    final Method hashKeyMember = this.getMethodForAnnotation(clazz, DynamoDBHashKey.class);
    final DynamoDBHashKey hashKeyAnno = hashKeyMember.getAnnotation(DynamoDBHashKey.class);
    final String hashKeyName = this.getAnnotationValue(hashKeyAnno, "attributeName", String.class);
    String rangeKeyName = null;


    final Method rangeKeyMember = this.getMethodForAnnotation(clazz, DynamoDBRangeKey.class);
    if(rangeKeyMember!=null){
        DynamoDBRangeKey rangeKeyAnno = rangeKeyMember.getAnnotation(DynamoDBRangeKey.class);   
        rangeKeyName = this.getAnnotationValue(rangeKeyAnno, "attributeName", String.class);
    }
    final Set<Method> hashKeyIndexFields = this.getMethodsAnnotatedWith(DynamoDBIndexHashKey.class, clazz);
    final Set<Method> rangeKeyIndexFields = this.getMethodsAnnotatedWith(DynamoDBIndexRangeKey.class, clazz);

    final Map<String, GlobalIndex> globalIndexes = this.createGlobalIndexes(hashKeyIndexFields, rangeKeyIndexFields, clazz);
    final Map<String, RangeKeyIndexField> localIndexes = this.createLocalIndexMap(rangeKeyIndexFields);

    final CreateTableRequest tableRequest = this.createCreateTableRequest(tableName, hashKeyName, rangeKeyName, globalIndexes, localIndexes);
    final CreateTableResult result = this.client.createTable(tableRequest);
    return result;
}
项目:aws-dynamodb-encryption-java    文件:MapperQueryExpressionCryptoTest.java   
@DynamoDBHashKey
@DynamoDBIndexHashKey (
        globalSecondaryIndexNames = {
                "GSI-primary-hash-index-range-1",
                "GSI-primary-hash-index-range-2"}
)
public String getPrimaryHashKey() {
    return primaryHashKey;
}
项目:aws-dynamodb-encryption-java    文件:MapperQueryExpressionCryptoTest.java   
@DynamoDBIndexHashKey (
        globalSecondaryIndexNames = {
                "GSI-index-hash-primary-range",
                "GSI-index-hash-index-range-1",
                "GSI-index-hash-index-range-2"}
)
public String getIndexHashKey() {
    return indexHashKey;
}
项目:spring-data-dynamodb    文件:DynamoDBEntityMetadataSupport.java   
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;

    }
项目:duckdns    文件:Domain.java   
@DynamoDBAttribute
@DynamoDBIndexHashKey(globalSecondaryIndexName = "accountToken-index")
public String getAccountToken() { return accountToken; }
项目:duckdns    文件:Account.java   
@DynamoDBAttribute
@DynamoDBIndexHashKey(globalSecondaryIndexName = "accountToken-index")
public String getAccountToken() {
    return accountToken;
}
项目:duckdns    文件:Domain.java   
@DynamoDBAttribute
@DynamoDBIndexHashKey(globalSecondaryIndexName = "accountToken-index")
public String getAccountToken() { return accountToken; }
项目:duckdns    文件:Account.java   
@DynamoDBAttribute
@DynamoDBIndexHashKey(globalSecondaryIndexName = "accountToken-index")
public String getAccountToken() { return accountToken; }
项目:duckdns    文件:Domain.java   
@DynamoDBAttribute
@DynamoDBIndexHashKey(globalSecondaryIndexName = "accountToken-index")
public String getAccountToken() { return accountToken; }
项目:DenunciaMXBackEnd    文件:DenunciaHistory.java   
@DynamoDBIndexHashKey
public String getFolio() {
    return folio;
}
项目:DenunciaMXBackEnd    文件:DenunciaHistory.java   
@DynamoDBIndexHashKey
public String getIdDenuncia() {
    return idDenuncia;
}
项目:hn_firebase_listener    文件:HNItemItem.java   
@DynamoDBAttribute(attributeName="by") 
@DynamoDBIndexHashKey(attributeName="by", globalSecondaryIndexName="by-time-index") 
public String getBy() {return by; }
项目:micro-genie    文件:DatabaseExamples.java   
@DynamoDBIndexHashKey(attributeName="isbn", globalSecondaryIndexName="isbn-index")
public String getIsbn() {
    return isbn;
}
项目:micro-genie    文件:Book.java   
@DynamoDBIndexHashKey(attributeName="libraryId", globalSecondaryIndexName=GLOBAL_INDEX_LIBRARY_ISBN)
public String getLibraryId() {
    return libraryId;
}
项目:micro-genie    文件:Book.java   
@DynamoDBIndexHashKey(attributeName="isbn", globalSecondaryIndexNames={GLOBAL_INDEX_ISBN})
@DynamoDBIndexRangeKey(attributeName="isbn", globalSecondaryIndexName=GLOBAL_INDEX_LIBRARY_ISBN)
public String getIsbn() {
    return isbn;
}
项目:micro-genie    文件:Book.java   
@DynamoDBIndexHashKey(attributeName="checkedOutBy", globalSecondaryIndexName=GLOBAL_INDEX_CHECKED_OUT_BY)
public String getCheckedOutBy() {
    return checkedOutBy;
}
项目:micro-genie    文件:Book.java   
@DynamoDBIndexHashKey(attributeName="libraryId", globalSecondaryIndexNames={GLOBAL_INDEX_LIBRARY_ID, GLOBAL_INDEX_LIBRARY_ISBN})
public String getLibraryId() {
    return libraryId;
}
项目:micro-genie    文件:Book.java   
@DynamoDBIndexHashKey(attributeName="isbn", globalSecondaryIndexNames={GLOBAL_INDEX_ISBN, GLOBAL_INDEX_ISBN_STATUS})
@DynamoDBIndexRangeKey(attributeName="isbn", globalSecondaryIndexNames={GLOBAL_INDEX_LIBRARY_ISBN})
public String getIsbn() {
    return isbn;
}
项目:micro-genie    文件:DynamoAdmin.java   
/***
 * Get data required to build out global secondary indexes
 * 
 * @param hashKeyIndexFields
 * @param rangeKeyIndexFields
 * @param clazz
 * 
 * @return globalIndexMap
 */
private Map<String, GlobalIndex> createGlobalIndexes(final Set<Method> hashKeyIndexFields, final Set<Method> rangeKeyIndexFields, Class<?> clazz) {

    final Map<String, GlobalIndex> globalIndexes = Maps.newHashMap();   


    for(Method m : hashKeyIndexFields){

        final Set<String> globalIndexNames = Sets.newHashSet();

        final DynamoDBIndexHashKey indexHashKeyAnno = m.getAnnotation(DynamoDBIndexHashKey.class);
        String[] indexNames = this.getAnnotationValue(indexHashKeyAnno, "globalSecondaryIndexNames", String[].class);
        if(indexNames==null || indexNames.length==0){
            String indexName = this.getAnnotationValue(indexHashKeyAnno, "globalSecondaryIndexName", String.class);
            Preconditions.checkArgument(!Strings.isNullOrEmpty(indexName), String.format("Index Name is required for DynamoDBIndexHashKey attribute for class %s field %s", clazz.getName(), m.getName()));
            globalIndexNames.add(indexName);
        }else{
            globalIndexNames.addAll(Sets.newHashSet(indexNames));
        }

        String attributeName = this.getAnnotationValue(indexHashKeyAnno, "attributeName", String.class);
        String dataType = this.getKeyType(m);

        final Map<String, RangeKeyIndexField> globalIndexRangeKeys = this.getGlobalIndexRangeKeys(rangeKeyIndexFields);

        /** Process Global Indexes **/
        for(String name : globalIndexNames){
            final GlobalIndex global = new GlobalIndex();
            global.setName(name);
            global.setHashKey(attributeName);
            global.setHashKeyType(dataType);
            /** Range key is optional for a global secondary index **/
            final RangeKeyIndexField rangeKey = globalIndexRangeKeys.get(name);
            if(rangeKey!=null){
                global.setRangeKeyField(rangeKey);
            }
            globalIndexes.put(name, global);
        }
    }
    return globalIndexes;
}
项目:Fancraft    文件:Post.java   
@DynamoDBIndexHashKey(globalSecondaryIndexName="CraftId-PostTimestamp-index", attributeName="CraftId")
public String getCraftId() {
    return craftId;
}
项目:Fancraft    文件:Post.java   
@DynamoDBIndexHashKey(globalSecondaryIndexName="FandomId-PostTimestamp-index",attributeName="FandomId")
public String getFandomId() {
    return fandomId;
}
项目:spring-data-dynamodb    文件:DynamoDBEntityMetadataSupport.java   
@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;

}