@Override public DMNContext newContext() { // in order to leverage the already existing client inner private class return new DMNResultKS().getContext(); }
@Override public DMNContext getContext() { // TODO rewiew, this means the DMNContext returned is detached from the internal context here. return MapBackedDMNContext.of(dmnContext); }
static MapBackedDMNContext of(Map<String, Object> ctx) { MapBackedDMNContext result = new MapBackedDMNContext(); result.ctx = ctx; return result; }
public static DMNDecisionServiceInfo decisionServiceToInfo(DecisionServiceNode dsNode) { DMNDecisionServiceInfo res = new DMNDecisionServiceInfo(); res.setName(dsNode.getName()); res.setId(dsNode.getId()); return res; }
public static DMNDecisionInfo decisionToInfo(DecisionNode decisionNode) { DMNDecisionInfo res = new DMNDecisionInfo(); res.setName(decisionNode.getName()); res.setId(decisionNode.getId()); return res; }
public static DMNDecisionResultKS of(DMNDecisionResult value) { DMNDecisionResultKS res = new DMNDecisionResultKS(); res.decisionId = value.getDecisionId(); res.decisionName = value.getDecisionName(); res.setResult(value.getResult()); res.setMessages(value.getMessages()); res.status = value.getEvaluationStatus(); return res; }
@Override public void pushScope(String name, String namespace) { Map<String, Object> scopeRef = (Map<String, Object>) getCurrentEntries().computeIfAbsent(name, s -> new LinkedHashMap<String, Object>()); stack.push(new ScopeReference(name, namespace, scopeRef)); }
public static DMNMessageKS of(DMNMessage value) { DMNMessageKS res = new DMNMessageKS(); res.severity = DMNMessageSeverityKS.of( value.getSeverity() ); res.message = value.getMessage(); res.messageType = value.getMessageType(); res.sourceId = value.getSourceId(); return res; }
@Override public Map<String, Object> getAll() { return getCurrentEntries(); }
public void setMessages(List<DMNMessage> messages) { // wrap for serialization: for ( DMNMessage m : messages ) { this.messages.add(DMNMessageKS.of(m)); } }
@Override public Severity getSeverity() { return severity.asSeverity(); }
public void setResult(Object result) { this.result = DMNResultKS.stubDMNResult(result); }
static DMNNodeStub of( Object dmnNode ) { DMNNodeStub res = new DMNNodeStub(); res.dmnNode = dmnNode.toString(); return res; }
private Map<String, Object> getCurrentEntries() { if (stack.isEmpty()) { return ctx; } else { return stack.peek().getRef(); // Intentional, symbol resolution in scope should limit at the top of the stack (for DMN semantic). } }
public static DMNQNameInfo of(QName from) { DMNQNameInfo result = new DMNQNameInfo(); result.namespaceURI = from.getNamespaceURI(); result.localPart = from.getLocalPart(); result.prefix = from.getPrefix(); return result; }
@Override public Object set(String name, Object value) { return getCurrentEntries().put(name, value); }
@Override public DMNContext clone() { return of(this.ctx); }
public void setMessages(List<DMNMessage> messages) { // wrap for serialization: for ( DMNMessage m : messages ) { this.messages.add(DMNMessageKS.of(m)); } } public void setDecisionResults(List<DMNDecisionResult> decisionResults) {
@Override public boolean isDefined(String name) { return getCurrentEntries().containsKey(name); }
@Override public Object get(String name) { return getCurrentEntries().get(name); }