use of model.db.StandingOrderDB in project amos-ss17-alexa by c-i-ber.
the class SavingsPlanService method standingOrderCategoryResponse.
private SpeechletResponse standingOrderCategoryResponse(Intent intent, Session session) {
String categoryName = intent.getSlot(CATEGORY_SLOT) != null ? intent.getSlot(CATEGORY_SLOT).getValue().toLowerCase() : null;
LOGGER.info("Category: " + categoryName);
// DynamoDbClient.instance.getItems(Category.TABLE_NAME, Category::new);
List<Category> categories = DynamoDbMapper.getInstance().loadAll(Category.class);
for (Category category : categories) {
if (category.getName().equals(categoryName)) {
String standingOrderId = (String) session.getAttribute(STANDING_ORDER_ID_ATTRIBUTE);
dynamoDbMapper.save(new StandingOrderDB(SOURCE_ACCOUNT, standingOrderId, "" + category.getId()));
return getResponse(SAVINGS_PLAN, "Verstanden. Der Dauerauftrag wurde zur Kategorie " + categoryName + " hinzugefügt");
}
}
return getResponse(SAVINGS_PLAN, "Ich konnte die Kategorie nicht finden. Tschüss");
}
Aggregations