use of amosalexa.services.pricequery.aws.model.Item in project amos-ss17-alexa by c-i-ber.
the class PriceQueryService method getProductInformation.
private SpeechletResponse getProductInformation(Intent intent, Session session) {
// get keyword for product search
Slot slot = intent.getSlot("ProductKeyword");
String keyword = slot.getValue();
String speechTextStart = "";
String speechText;
if (keyword != null) {
log.warn(getClass().toString() + " Keyword: " + keyword);
List<Item> items = AWSLookup.itemSearch(keyword, 1, null);
if (!items.isEmpty()) {
speechTextStart = "Bingo, Ich habe etwas gefunden!";
}
String specheTextItems = "";
for (int i = 0; i < 3; i++) {
Offer offer = AWSLookup.offerLookup(items.get(i).getASIN());
specheTextItems = specheTextItems + AWSUtil.shortTitle(items.get(i).getTitle()) + "fuer " + offer.getLowestNewPrice() / 100 + " Euro";
}
speechText = speechTextStart + specheTextItems;
} else {
speechText = speechTextWelcome;
}
return getSpeechletResponse(speechText, repromptTextWelcome);
}
use of amosalexa.services.pricequery.aws.model.Item in project amos-ss17-alexa by c-i-ber.
the class ItemCreator method createItem.
private static Item createItem() {
Item item = new Item();
//Timestamp
java.util.Date date = new java.util.Date();
Timestamp timestamp = new Timestamp(date.getTime());
item.setAdded(timestamp);
// ASIN
String ASIN = XMLParser.readValue(itemXML, new String[] { "ASIN" });
item.setASIN(ASIN);
// Locale
item.setLocale("de");
// ParentASIN
String parentASIN = XMLParser.readValue(itemXML, new String[] { "ParentASIN" });
if (parentASIN != null && parentASIN.length() == "B00KAKPZYG".length()) {
item.setParentASIN(parentASIN);
}
// DetailPageURL
String detailPageURL = XMLParser.readValue(itemXML, new String[] { "DetailPageURL" });
item.setDetailPageURL(detailPageURL);
// Itemlink - WishList
String itemLinkWishList = XMLParser.readValue(itemXML, new String[] { "ItemLinks", "ItemLink", "URL" });
item.setItemLinkWishList(itemLinkWishList);
// ImageURL
String imageURL = XMLParser.readValue(itemXML, new String[] { "LargeImage", "URL" });
item.setImageURL(imageURL);
// Binding
String binding = XMLParser.readValue(itemXML, new String[] { "ItemAttributes", "Binding" });
if (binding.length() < 30) {
item.setBinding(binding);
}
// Brand
String brand = XMLParser.readValue(itemXML, new String[] { "ItemAttributes", "Brand" });
if (brand.length() < 30) {
item.setBrand(brand);
}
// EAN
String ean = XMLParser.readValue(itemXML, new String[] { "ItemAttributes", "EAN" });
if (ean.length() < 15) {
item.setEan(ean);
}
// ProductGroup
String productGroup = XMLParser.readValue(itemXML, new String[] { "ItemAttributes", "ProductGroup" });
item.setProductGroup(productGroup);
// ProductTypeName
String productTypeName = XMLParser.readValue(itemXML, new String[] { "ItemAttributes", "ProductTypeName" });
item.setProductTypeName(productTypeName);
// Title
String title = XMLParser.readValue(itemXML, new String[] { "ItemAttributes", "Title" });
item.setTitle(title);
return item;
}