Example usage for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBScanExpression DynamoDBScanExpression

List of usage examples for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBScanExpression DynamoDBScanExpression

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBScanExpression DynamoDBScanExpression.

Prototype

DynamoDBScanExpression

Source Link

Usage

From source file:com.makariev.dynamodb.preferences.UserPreferenceObjectMapperService.java

License:Open Source License

@Override
public List<UserPreference> findAll() {
    final DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
    //not quite correct; this thing is limmitted by dynamoDb ( there is no count ) 
    final PaginatedScanList result = mapper.scan(UserPreference.class, scanExpression);
    return result;
}

From source file:com.makariev.dynamodb.preferences.UserPreferenceObjectMapperService.java

License:Open Source License

@Override
public List<UserPreference> scanByFirstName(String searchForName) {

    final DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
    scanExpression.addFilterCondition("firstName",
            new Condition().withComparisonOperator(ComparisonOperator.CONTAINS)
                    .withAttributeValueList(new AttributeValue().withS(searchForName)));

    final PaginatedScanList<UserPreference> scanList = mapper.scan(UserPreference.class, scanExpression);

    return scanList;
}

From source file:com.makariev.dynamodb.preferences.UserPreferenceObjectMapperService.java

License:Open Source License

@Override
public List<UserPreference> scanByLastName(String searchForName) {

    final DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
    scanExpression.addFilterCondition("lastName",
            new Condition().withComparisonOperator(ComparisonOperator.CONTAINS)
                    .withAttributeValueList(new AttributeValue().withS(searchForName)));

    final PaginatedScanList<UserPreference> scanList = mapper.scan(UserPreference.class, scanExpression);

    return scanList;
}

From source file:com.rorrell.personrest.data.PersonDaoDynamo.java

private DynamoDBScanExpression getQuery(String conditionExpression, Pair... values) {
    Map<String, AttributeValue> eav = new HashMap<String, AttributeValue>();
    for (Pair p : values) {
        Fields key = Fields.findByValue(p.getKey().toString());
        switch (key) {
        case ID://w  w  w.  j a v  a2 s .c  o m
        case AGE:
            eav.put(p.getKey().toString(), new AttributeValue().withN(p.getValue().toString()));
            break;
        case FIRSTNAME:
        case LASTNAME:
        case GENDER:
            eav.put(p.getKey().toString(), new AttributeValue().withS(p.getValue().toString()));
            break;
        }
    }
    return new DynamoDBScanExpression().withFilterExpression(conditionExpression)
            .withExpressionAttributeValues(eav);
}

From source file:com.rorrell.personrest.data.PersonDaoDynamo.java

@Override
public List<Person> getAll() {
    List<Person> result = DB.scan(Person.class, new DynamoDBScanExpression());
    List<Person> people = new ArrayList<Person>(result);
    Collections.sort(people);// w  ww.j  av  a2  s . c o m
    return people;
}

From source file:com.tuprofe.api.persistance.implementation.DynamoAdminUserRepository.java

@Override
public AdminUser findByEmail(String email) {
    AdminUser adminUser = null;/*from w ww . ja v  a 2  s.  co  m*/
    AmazonDynamoDB dynamoDB = getDynamoDB();
    DynamoDBMapper mapper = new DynamoDBMapper(dynamoDB);

    Map<String, AttributeValue> eav = new HashMap<>();
    eav.put(":val1", new AttributeValue().withS(email));

    DynamoDBScanExpression scanExpression = new DynamoDBScanExpression().withFilterExpression("email = :val1")
            .withExpressionAttributeValues(eav);

    List<AdminUser> adminUsers = mapper.scan(AdminUser.class, scanExpression);

    if (adminUsers.size() > 0) {
        adminUser = adminUsers.get(0);
    }

    return adminUser;
}

From source file:com.tuprofe.api.persistance.implementation.DynamoInterviewRepository.java

@Override
public List<Interview> findAll(Long current) {
    AmazonDynamoDB dynamoDB = getDynamoDB();
    DynamoDBMapper mapper = new DynamoDBMapper(dynamoDB);

    Map<String, AttributeValue> eav = new HashMap<>();
    eav.put(":val1", new AttributeValue().withN(current.toString()));

    DynamoDBScanExpression scanExpression = new DynamoDBScanExpression()
            .withFilterExpression("startDateTime >= :val1").withExpressionAttributeValues(eav);

    List<Interview> interviews = mapper.scan(Interview.class, scanExpression);

    return interviews;
}

From source file:org.diksha.common.dyutils.DyDBUtils.java

License:Apache License

public static void listFunctions() {
    DynamoDBMapper mapper = getDynamoDBMapper();

    DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
    List<SchedulerUDF> scanResults = mapper.scan(SchedulerUDF.class, scanExpression);

    for (int cnt = 0; cnt < scanResults.size(); cnt++) {

        System.out.println(//from ww w .  j av a2 s .com
                scanResults.get(cnt).getFunctionAlias() + " --> " + scanResults.get(cnt).getFunctionName());
    }

}

From source file:org.diksha.common.dyutils.DyDBUtils.java

License:Apache License

public static void listJobs() {
    DynamoDBMapper mapper = getDynamoDBMapper();

    DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
    List<SchedulerUDJ> scanResults = mapper.scan(SchedulerUDJ.class, scanExpression);

    for (int cnt = 0; cnt < scanResults.size(); cnt++) {

        System.out.println(scanResults.get(cnt).getJobName() + " -->  ("
                + scanResults.get(cnt).getFunctionAlias() + " , " + scanResults.get(cnt).getFunctionContext()
                + " , " + scanResults.get(cnt).getCronExpression() + " , "
                + scanResults.get(cnt).getRepeatTimes() + " , " + scanResults.get(cnt).getStartTimeDate()
                + " , " + scanResults.get(cnt).getEndTimeDate() + " )");
    }/*from w w w .ja v  a  2  s.c om*/

}

From source file:org.socialsignin.spring.data.dynamodb.repository.query.DynamoDBEntityWithHashAndRangeKeyCriteria.java

License:Apache License

public DynamoDBScanExpression buildScanExpression() {

    if (sort != null) {
        throw new UnsupportedOperationException("Sort not supported for scan expressions");
    }// w ww .ja  v  a2  s.c om
    DynamoDBScanExpression scanExpression = new DynamoDBScanExpression();
    if (isHashKeySpecified()) {
        scanExpression.addFilterCondition(getHashKeyAttributeName(),
                createSingleValueCondition(getHashKeyPropertyName(), ComparisonOperator.EQ,
                        getHashKeyAttributeValue(), getHashKeyAttributeValue().getClass(), true));
    }
    if (isRangeKeySpecified()) {
        scanExpression.addFilterCondition(getRangeKeyAttributeName(),
                createSingleValueCondition(getRangeKeyPropertyName(), ComparisonOperator.EQ,
                        getRangeKeyAttributeValue(), getRangeKeyAttributeValue().getClass(), true));
    }
    for (Map.Entry<String, List<Condition>> conditionEntry : attributeConditions.entrySet()) {
        for (Condition condition : conditionEntry.getValue()) {
            scanExpression.addFilterCondition(conditionEntry.getKey(), condition);
        }
    }
    return scanExpression;
}