List of usage examples for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBScanExpression addFilterCondition
public void addFilterCondition(String attributeName, Condition condition)
From source file:com.makariev.dynamodb.forum.service.BicycleQueryScanService.java
License:Apache License
public List<Bicycle> findBicyclesOfSpecificTypeWithMultipleThreads( @DsLabel("number of parallel threads") int numberOfThreads, @DsLabel("bicycleType") String bicycleType) throws Exception { final List<Bicycle> result = new ArrayList<>(); final DynamoDBScanExpression scanExpression = new DynamoDBScanExpression(); scanExpression.addFilterCondition("ProductCategory", new Condition().withComparisonOperator(ComparisonOperator.EQ) .withAttributeValueList(new AttributeValue().withS("Bicycle"))); scanExpression.addFilterCondition("BicycleType", new Condition().withComparisonOperator(ComparisonOperator.EQ) .withAttributeValueList(new AttributeValue().withS(bicycleType))); final List<Bicycle> scanResult = mapper.parallelScan(Bicycle.class, scanExpression, numberOfThreads); for (Bicycle bicycle : scanResult) { result.add(bicycle);//from w w w. j av a2s .c o m } return result; }
From source file:com.makariev.dynamodb.preferences.UserPreferenceLowLevelAPIService.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 Map<String, Condition> scanFilter = scanExpression.getScanFilter(); final ScanResult scanResult = dynamoDb.scan(UserPreference.TABLE_NAME, scanFilter); final List<Map<String, AttributeValue>> items = scanResult.getItems(); return toUserPreferenceList(items); }
From source file:com.makariev.dynamodb.preferences.UserPreferenceLowLevelAPIService.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 Map<String, Condition> scanFilter = scanExpression.getScanFilter(); final ScanResult scanResult = dynamoDb.scan(UserPreference.TABLE_NAME, scanFilter); final List<Map<String, AttributeValue>> items = scanResult.getItems(); return toUserPreferenceList(items); }
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: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"); }// ww w . ja v a2 s .c o m 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; }
From source file:org.socialsignin.spring.data.dynamodb.repository.query.DynamoDBEntityWithHashKeyOnlyCriteria.java
License:Apache License
public DynamoDBScanExpression buildScanExpression() { if (sort != null) { throw new UnsupportedOperationException("Sort not supported for scan expressions"); }// ww w . j a v a 2s . co m DynamoDBScanExpression scanExpression = new DynamoDBScanExpression(); if (isHashKeySpecified()) { scanExpression.addFilterCondition(getHashKeyAttributeName(), createSingleValueCondition(getHashKeyPropertyName(), ComparisonOperator.EQ, getHashKeyAttributeValue(), getHashKeyAttributeValue().getClass(), true)); } for (Map.Entry<String, List<Condition>> conditionEntry : attributeConditions.entrySet()) { for (Condition condition : conditionEntry.getValue()) { scanExpression.addFilterCondition(conditionEntry.getKey(), condition); } } return scanExpression; }