private boolean hasNoActions(Node node) { return node.getActionsAfter().isEmpty() && node.getActionsBefore().isEmpty(); }
private boolean hasNoActionableItems(Node node) { return node.getPrompts().isEmpty() && hasNoActions(node) && node.getTransitions().isEmpty(); }
private Integer maxDigits(Node node) { Map<String, ITransition> transitions = node.getTransitions(); int maxDigits = 1; for (String key : transitions.keySet()) { if (hasSpecialMeaning(key)) { return (node.getMaxTransitionInputDigit() == null) ? MAX_INPUT_DIGITS : node.getMaxTransitionInputDigit(); } if (maxDigits < key.length()) { maxDigits = key.length(); } } return maxDigits; }
private boolean isUserInputNeeded(Node node) { return node.hasTransitions() && !node.hasDialPrompts(); }
private static NodeRecord convertToNodeRecord(final Node node, final Long id) { NodeRecord nodeRecord = new NodeRecord(); nodeRecord.setId(id); nodeRecord.setName(String.format("Message%d", id)); Prompt p = node.getPrompts().get(0); if (p instanceof TextToSpeechPrompt) { nodeRecord.setMessage(((TextToSpeechPrompt) p).getMessage()); } List<Action> actionBefore = node.getActionsBefore(); List<String> actionBeforeRecords = new ArrayList<>(actionBefore.size()); for (Action action : actionBefore) { actionBeforeRecords.add(action.getEventId()); } nodeRecord.setActionsBefore(actionBeforeRecords); List<Action> actionAfter = node.getActionsAfter(); List<String> actionAfterRecords = new ArrayList<>(actionAfter.size()); for (Action action : actionAfter) { actionAfterRecords.add(action.getEventId()); } nodeRecord.setActionsAfter(actionAfterRecords); return nodeRecord; }
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); }
/** * Emits an event before 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 sendActionsBefore(Node node, Map<String, Object> params) { Assert.notNull(node, "Node must not be null"); Assert.notNull(params, "Params must not be null"); sendActions(node.getActionsBefore(), params); }
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(); }
private String transitionKeyEndMarker(Node node) { return node.getTransitionKeyEndMarker() == null ? DEFAULT_END_OF_KEY_MARKER : node.getTransitionKeyEndMarker(); }
private ITransition getPreConfiguredTransition(Node parentNode, String userInput) { return parentNode.getTransitions().get(userInput); }
private boolean isUserInputNeeded(Node node) { return node.hasTransitions() && !node.hasDialPrompts(); }
/** * 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); }
/** * Emits an event before 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 sendActionsBefore(Node node, Map<String, Object> params) { Assert.notNull(node, "Node must not be null"); Assert.notNull(params, "Params must not be null"); sendActions(node.getActionsBefore(), params); }
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(); }
private String transitionKeyEndMarker(Node node) { return node.getTransitionKeyEndMarker() == null ? DEFAULT_END_OF_KEY_MARKER : node.getTransitionKeyEndMarker(); }
private boolean hasNoActionableItems(Node node) { return node.getPrompts().isEmpty() && hasNoActions(node) && node.getTransitions().isEmpty(); }
private boolean hasNoActions(Node node) { return node.getActionsAfter().isEmpty() && node.getActionsBefore().isEmpty(); }