private void executeOperations(String transitionKey, FlowSession session, Node node) { for (INodeOperation operation : node.getOperations()) { operation.perform(transitionKey, session); } }
private Integer maxTimeout(Node node) { return node.getMaxTransitionTimeout() == null ? MAX_INPUT_TIMEOUT : node.getMaxTransitionTimeout(); }
@RequestMapping(value = "/tree/example", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) public void createExampleTree() { decisionTreeService.saveDecisionTree(new Tree() .setName("Illness Tree") .setRootTransition(new Transition().setDestinationNode(new Node() .setPrompts(new TextToSpeechPrompt().setMessage("if you feel sick select 1, if not select 2")) .setTransitions(new Object[][]{ {"1", new Transition().setName("pressed1") .setDestinationNode(new Node() .setPrompts(new TextToSpeechPrompt().setMessage("if you have a fever select 1, if not select 3")) .setTransitions(new Object[][]{ {"1", new Transition().setName("pressed1").setDestinationNode( new Node().setPrompts(new TextToSpeechPrompt().setMessage("come to the hospital now")) )}, {"3", new Transition().setName("pressed3").setDestinationNode( new Node().setPrompts(new TextToSpeechPrompt().setMessage("be patient, we will call you")) )} }) )}, {"2", new Transition().setName("pressed2") .setDestinationNode(new Node().setPrompts(new TextToSpeechPrompt().setMessage("Check with us again")))} }) ))); }
private boolean hasNoActions(Node node) { return node.getActionsAfter().isEmpty() && node.getActionsBefore().isEmpty(); }
private boolean isUserInputNeeded(Node node) { return node.hasTransitions() && !node.hasDialPrompts(); }
private ITransition getPreConfiguredTransition(Node parentNode, String userInput) { return parentNode.getTransitions().get(userInput); }
/** * Emits an event after landing on to a particular node on the specified tree. Event subject is the eventId associated with the action. * * @param node landing node * @param params extra information to be passed */ public void sendActionsAfter(Node node, Map<String, Object> params) { Assert.notNull(node, "Node must not be null"); Assert.notNull(params, "Params must not be null"); sendActions(node.getActionsAfter(), params); }
private String transitionKeyEndMarker(Node node) { return node.getTransitionKeyEndMarker() == null ? DEFAULT_END_OF_KEY_MARKER : node.getTransitionKeyEndMarker(); }
private boolean hasSpecialMeaning(String key) { return (anyInput(key) || DialStatus.isValid(key)); }
private Node getCurrentNode(FlowSession session) { return session.getCurrentNode(); }
@Override public void updateSession(FlowSession flowSession) { callRecordsService.add(flowSession.getCallDetailRecord()); allFlowSessionRecords.update((FlowSessionRecord) flowSession); }
private boolean hasNoActions(Node node) { return node.getActionsAfter().isEmpty() && node.getActionsBefore().isEmpty(); }
private void executeOperations(String transitionKey, FlowSession session, Node node) { for (INodeOperation operation : node.getOperations()) { operation.perform(transitionKey, session); } }
private boolean isUserInputNeeded(Node node) { return node.hasTransitions() && !node.hasDialPrompts(); }
private ITransition getPreConfiguredTransition(Node parentNode, String userInput) { return parentNode.getTransitions().get(userInput); }
private Integer maxTimeout(Node node) { return node.getMaxTransitionTimeout() == null ? MAX_INPUT_TIMEOUT : node.getMaxTransitionTimeout(); }
private String transitionKeyEndMarker(Node node) { return node.getTransitionKeyEndMarker() == null ? DEFAULT_END_OF_KEY_MARKER : node.getTransitionKeyEndMarker(); }
private boolean hasSpecialMeaning(String key) { return (anyInput(key) || DialStatus.isValid(key)); }