/** * Function to accept an intent containing a Day slot (date object) and return the Calendar * representation of that slot value. If the user provides a date, then use that, otherwise use * today. The date is in server time, not in the user's time zone. So "today" for the user may * actually be tomorrow. * * @param intent * the intent object containing the day slot * @return the Calendar representation of that date */ private Calendar getCalendar(Intent intent) { Slot daySlot = intent.getSlot(SLOT_DAY); Date date; Calendar calendar = Calendar.getInstance(); if (daySlot != null && daySlot.getValue() != null) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-d"); try { date = dateFormat.parse(daySlot.getValue()); } catch (ParseException e) { date = new Date(); } } else { date = new Date(); } calendar.setTime(date); return calendar; }
Slot citySlot = intent.getSlot(SLOT_CITY); CityDateValues<String, String> cityObject = null;
Slot citySlot = intent.getSlot(SLOT_CITY); CityDateValues<String, String> cityObject = null;
Slot dateSlot = intent.getSlot(SLOT_DATE); CityDateValues<String, String> dateObject;
Slot dateSlot = intent.getSlot(SLOT_DATE); CityDateValues<String, String> dateObject;
List<ColumnName> axes = new ArrayList<>(); if (intent.getSlot(SlotUtil.PLOT_COLUMN_1).getValue() != null) { axes.add(SlotUtil.parseColumnSlot( intent.getSlot(SlotUtil.PLOT_COLUMN_1).getValue())); if (intent.getSlot(SlotUtil.PLOT_COLUMN_2).getValue() != null) { axes.add(SlotUtil.parseColumnSlot( intent.getSlot(SlotUtil.PLOT_COLUMN_2).getValue()));
intent.getSlot(SlotUtil.REFINE_TYPE).getValue()); if (intent.getSlot(SlotUtil.GROUP_BY_COLUMN).getValue() != null) { intent.getSlot(SlotUtil.GROUP_BY_COLUMN).getValue())); if (intent.getSlot(SlotUtil.COMPARISON_COLUMN_1).getValue() != null) { comparisonColumns.add(SlotUtil.parseColumnSlot( intent.getSlot(SlotUtil.COMPARISON_COLUMN_1).getValue()) .setType( (intent.getSlot(SlotUtil.COLUMN_NUMBER_1).getValue() != null) ? ColumnType.NUMBER : ColumnType.STRING)); comparators.add(intent.getSlot(SlotUtil.COMPARATOR_1).getValue()); comparisonValues.add(ObjectUtils.defaultIfNull( intent.getSlot(SlotUtil.COLUMN_VALUE_1).getValue(), intent.getSlot(SlotUtil.COLUMN_NUMBER_1).getValue())); if (intent.getSlot(SlotUtil.COMPARISON_COLUMN_2).getValue() != null) { comparisonColumns.add(SlotUtil.parseColumnSlot( intent.getSlot(SlotUtil.COMPARISON_COLUMN_2).getValue()) .setType( (intent.getSlot(SlotUtil.COLUMN_NUMBER_2).getValue() != null) ? ColumnType.NUMBER : ColumnType.STRING)); comparators.add(intent.getSlot(SlotUtil.COMPARATOR_2).getValue()); comparisonValues.add(ObjectUtils.defaultIfNull( intent.getSlot(SlotUtil.COLUMN_VALUE_2).getValue(), intent.getSlot(SlotUtil.COLUMN_NUMBER_2).getValue())); if (intent.getSlot(SlotUtil.COMPARISON_COLUMN_3).getValue() != null) {
.setFromTable(intent.getSlot(SlotUtil.TABLE_NAME).getValue()) .setFunc(intent.getSlot(SlotUtil.FUNC).getValue()) intent.getSlot(SlotUtil.AGGREGATION_COLUMN).getValue())) intent.getSlot(SlotUtil.COMPARISON_COLUMN_1).getValue()) .setType((intent.getSlot( SlotUtil.COLUMN_NUMBER_1).getValue() != null) ? ColumnType.NUMBER : ColumnType.STRING), intent.getSlot(SlotUtil.COMPARATOR_1).getValue(), intent.getSlot(SlotUtil.COLUMN_VALUE_1).getValue(), intent.getSlot(SlotUtil.COLUMN_NUMBER_1).getValue())) intent.getSlot(SlotUtil.BINARY_LOGIC_OP_1).getValue(), intent.getSlot(SlotUtil.COMPARISON_COLUMN_2).getValue()) .setType((intent.getSlot( SlotUtil.COLUMN_NUMBER_2).getValue() != null) ? ColumnType.NUMBER : ColumnType.STRING), intent.getSlot(SlotUtil.COMPARATOR_2).getValue(), intent.getSlot(SlotUtil.COLUMN_VALUE_2).getValue(), intent.getSlot(SlotUtil.COLUMN_NUMBER_2).getValue())) intent.getSlot(SlotUtil.BINARY_LOGIC_OP_2).getValue(),
Slot categorySlot = intent.getSlot(SLOT_CATEGORY);
Slot categorySlot = intent.getSlot(SLOT_CATEGORY);
SkillContext skillContext) { String playerName = ScoreKeeperTextUtil.getPlayerName(intent.getSlot(SLOT_PLAYER_NAME).getValue()); if (playerName == null) { String speechText = "Sorry, I did not hear the player name. Please say again?"; score = Integer.parseInt(intent.getSlot(SLOT_SCORE_NUMBER).getValue()); } catch (NumberFormatException e) { String speechText = "Sorry, I did not hear the points. Please say again?";
SkillContext skillContext) { String playerName = ScoreKeeperTextUtil.getPlayerName(intent.getSlot(SLOT_PLAYER_NAME).getValue()); if (playerName == null) { String speechText = "Sorry, I did not hear the player name. Please say again?"; score = Integer.parseInt(intent.getSlot(SLOT_SCORE_NUMBER).getValue()); } catch (NumberFormatException e) { String speechText = "Sorry, I did not hear the points. Please say again?";
Slot itemSlot = intent.getSlot(ITEM_SLOT); if (itemSlot != null && itemSlot.getValue() != null) { String itemName = itemSlot.getValue();
Slot itemSlot = intent.getSlot(ITEM_SLOT); if (itemSlot != null && itemSlot.getValue() != null) { String itemName = itemSlot.getValue();
ScoreKeeperTextUtil.getPlayerName(intent.getSlot(SLOT_PLAYER_NAME).getValue()); if (newPlayerName == null) { String speechText = "OK. Who do you want to add?";
ScoreKeeperTextUtil.getPlayerName(intent.getSlot(SLOT_PLAYER_NAME).getValue()); if (newPlayerName == null) { String speechText = "OK. Who do you want to add?";