/** * Gets an input-output map. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input-output map */ public static Map<String, Object> getInputOutputMap(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, ExpressionMapping> inputs = operation.getInputOutputExpressionMappings(); for (Entry<String, ExpressionMapping> entry : inputs.entrySet()) { List<Object> list = getList(message, Collections.singletonList(entry.getValue())); final Object output; switch (list.size()) { case 0: output = null; break; case 1: output = list.get(0); break; default: output = list; } map.put(entry.getKey(), output); } return map; }
/** * Gets an input-output map. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input-output map */ public static Map<String, Object> getInputOutputMap(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> map = new LinkedHashMap<String, Object>(); Map<String, ExpressionMapping> inputs = operation.getInputOutputExpressionMappings(); for (Entry<String, ExpressionMapping> entry : inputs.entrySet()) { List<Object> list = getList(message, Collections.singletonList(entry.getValue())); final Object output; switch (list.size()) { case 0: output = null; break; case 1: output = list.get(0); break; default: output = list; } map.put(entry.getKey(), output); } return map; }
private static List<Object> getInputList(Message message, List<ExpressionMapping> inputs, KnowledgeRuntimeEngine runtime) { List<Object> list = new ArrayList<Object>(); if (inputs.size() > 0) { list.addAll(getList(message, inputs)); } else { expand(filterRemoteDefaultInputContent(message.getContent(), runtime), list); } return list; }
private static List<Object> getInputList(Message message, List<ExpressionMapping> inputs, KnowledgeRuntimeEngine runtime) { List<Object> list = new ArrayList<Object>(); if (inputs.size() > 0) { list.addAll(getList(message, inputs)); } else { expand(filterRemoteDefaultInputContent(message.getContent(), runtime), list); } return list; }
/** * Gets the input. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input */ public static Object getInput(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { List<Object> list = getList(message, operation.getInputExpressionMappings()); switch (list.size()) { case 0: return filterRemoteDefaultInputContent(message.getContent(), runtime); case 1: return list.get(0); default: return list; } }
/** * Gets the input. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input */ public static Object getInput(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { List<Object> list = getList(message, operation.getInputExpressionMappings()); switch (list.size()) { case 0: return filterRemoteDefaultInputContent(message.getContent(), runtime); case 1: return list.get(0); default: return list; } }