conversationDescriptor.setEnvironment(memorySnapshot.getEnvironment()); conversationDescriptor.setConversationStepSize(memorySnapshot.getConversationSteps().size()); URI createdBy = conversationDescriptor.getCreatedBy();
public static SimpleConversationMemorySnapshot convertSimpleConversationMemory(ConversationMemorySnapshot conversationMemorySnapshot, boolean returnDetailed) { SimpleConversationMemorySnapshot simpleSnapshot = new SimpleConversationMemorySnapshot(); if (conversationMemorySnapshot.getUserId() != null) { simpleSnapshot.setUserId(conversationMemorySnapshot.getUserId()); } simpleSnapshot.setBotId(conversationMemorySnapshot.getBotId()); simpleSnapshot.setBotVersion(conversationMemorySnapshot.getBotVersion()); simpleSnapshot.setConversationState(conversationMemorySnapshot.getConversationState()); simpleSnapshot.setEnvironment(conversationMemorySnapshot.getEnvironment()); simpleSnapshot.setRedoCacheSize(conversationMemorySnapshot.getRedoCache().size()); simpleSnapshot.getConversationOutputs().addAll(conversationMemorySnapshot.getConversationOutputs()); simpleSnapshot.getConversationProperties().putAll(conversationMemorySnapshot.getConversationProperties()); for (ConversationMemorySnapshot.ConversationStepSnapshot conversationStepSnapshot : conversationMemorySnapshot.getConversationSteps()) { SimpleConversationMemorySnapshot.SimpleConversationStep simpleConversationStep = new SimpleConversationMemorySnapshot.SimpleConversationStep(); simpleSnapshot.getConversationSteps().add(simpleConversationStep); for (ConversationMemorySnapshot.PackageRunSnapshot packageRunSnapshot : conversationStepSnapshot.getPackages()) { for (ConversationMemorySnapshot.ResultSnapshot resultSnapshot : packageRunSnapshot.getLifecycleTasks()) { if (returnDetailed || resultSnapshot.isPublic()) { Object result = resultSnapshot.getResult(); simpleConversationStep.getConversationStep().add( new SimpleConversationMemorySnapshot.ConversationStepData(resultSnapshot.getKey(), result)); } else { continue; } simpleConversationStep.setTimestamp(resultSnapshot.getTimestamp()); } } } return simpleSnapshot; }