private Integer getLatestDeployedBotVersion(String botId) throws ServiceException { return botFactory.getLatestBot(unrestricted, botId).getBotVersion(); }
private Status checkDeploymentStatus(Deployment.Environment environment, String botId, Integer version) { try { IBot bot = botFactory.getBot(environment, botId, version); if (bot != null) { return bot.getDeploymentStatus(); } else { return Status.NOT_FOUND; } } catch (ServiceException e) { return throwError(botId, version, e, "Error while deploying bot! (botId=%s , version=%s)"); } }
IConversation conversation = latestBot.startConversation(userId, context, createPropertiesHandler(userId), null);
@Override public IBot getBot(final String botId, final Integer version) throws ServiceException, IllegalAccessException { final IBot bot = new Bot(botId, version); final BotConfiguration botConfiguration = botStoreService.getBotConfiguration(botId, version); for (final URI packageURI : botConfiguration.getPackages()) { URIUtilities.ResourceId resourceId = URIUtilities.extractResourceId(packageURI); IExecutablePackage thePackage = packageFactory.getExecutablePackage(resourceId.getId(), resourceId.getVersion()); bot.addPackage(thePackage); } return bot; } }
final IConversation conversation = bot.continueConversation(conversationMemory, createPropertiesHandler(conversationMemory.getUserId()), returnConversationMemory -> {
@Override public IBot getLatestBot(Deployment.Environment environment, String botId) { Map<BotId, IBot> bots = getBotEnvironment(environment); List<BotId> botVersions = bots.keySet().stream().filter(id -> id.getId().equals(botId)). sorted(Collections.reverseOrder((botId1, botId2) -> botId1.getVersion() < botId2.getVersion() ? -1 : botId1.getVersion().equals(botId2.getVersion()) ? 0 : 1)). collect(Collectors.toCollection(LinkedList::new)); IBot latestBot = null; if (!botVersions.isEmpty()) { for (BotId botVersion : botVersions) { IBot bot = bots.get(botVersion); if (bot.getDeploymentStatus() == Deployment.Status.READY) { latestBot = bot; break; } } } return latestBot; }
private Integer getLatestDeployedBotVersion(String botId) throws ServiceException { return botFactory.getLatestBot(unrestricted, botId) != null ? botFactory.getLatestBot(unrestricted, botId).getBotVersion() : Integer.valueOf(1); }