@Test public void testAddInputClauseRequirement() { final List<DecisionTableEditorDefinitionEnricher.ClauseRequirement> inputClauseRequirements = new ArrayList<>(); final String inputData = "InputData"; final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, null, itemDefinitionUtils); final ItemDefinition tPerson = mockTPersonStructure(); enricher.addInputClauseRequirement(tPerson, inputClauseRequirements, inputData); assertEquals(2, inputClauseRequirements.size()); final DecisionTableEditorDefinitionEnricher.ClauseRequirement inputClause1 = inputClauseRequirements.get(0); final DecisionTableEditorDefinitionEnricher.ClauseRequirement inputClause2 = inputClauseRequirements.get(1); assertEquals("InputData.name", inputClause1.text); assertEquals(STRING.getName(), inputClause1.typeRef.getLocalPart()); assertEquals("InputData.age", inputClause2.text); assertEquals(NUMBER.getName(), inputClause2.typeRef.getLocalPart()); }
private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<ClauseRequirement> inputClauseRequirements, final String text) { if (isBuiltInType(typeRef.getLocalPart())) { inputClauseRequirements.add(new ClauseRequirement(text, typeRef)); return; } definitions.getItemDefinition() .stream() .filter(typeRefIsCustom(typeRef)) .findFirst() .ifPresent(itemDefinition -> addInputClauseRequirement(itemDefinition, inputClauseRequirements, text)); }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<ClauseRequirement> inputClauseRequirements, final String text) { if (isBuiltInType(typeRef.getLocalPart())) { inputClauseRequirements.add(new ClauseRequirement(text, typeRef)); return; } definitions.getItemDefinition() .stream() .filter(typeRefIsCustom(typeRef)) .findFirst() .ifPresent(itemDefinition -> addInputClauseRequirement(itemDefinition, inputClauseRequirements, text)); } }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<ClauseRequirement> inputClauseRequirements, final String text) { if (isBuiltInType(typeRef.getLocalPart())) { inputClauseRequirements.add(new ClauseRequirement(text, typeRef)); return; } definitions.getItemDefinition() .stream() .filter(typeRefIsCustom(typeRef)) .findFirst() .ifPresent(itemDefinition -> addInputClauseRequirement(itemDefinition, inputClauseRequirements, text)); } DecisionTableEditorDefinitionEnricher(); @Inject  DecisionTableEditorDefinitionEnricher(final SessionManager sessionManager,
                                                 final DMNGraphUtils dmnGraphUtils,
                                                 final ItemDefinitionUtils itemDefinitionUtils); }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<ClauseRequirement> inputClauseRequirements, final String text) { if (isBuiltInType(typeRef.getLocalPart())) { inputClauseRequirements.add(new ClauseRequirement(text, typeRef)); return; } definitions.getItemDefinition() .stream() .filter(typeRefIsCustom(typeRef)) .findFirst() .ifPresent(itemDefinition -> addInputClauseRequirement(itemDefinition, inputClauseRequirements, text)); } DecisionTableEditorDefinitionEnricher(); @Inject  DecisionTableEditorDefinitionEnricher(final SessionManager sessionManager,
                                                 final DMNGraphUtils dmnGraphUtils,
                                                 final ItemDefinitionUtils itemDefinitionUtils); @Override void enrich(final Optional<String> nodeUUID,
                       final HasExpression hasExpression,
                       final Optional<DecisionTable> expression); }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { private void addInputClauseRequirement(final QName typeRef, final Definitions definitions, final List<ClauseRequirement> inputClauseRequirements, final String text) { if (isBuiltInType(typeRef.getLocalPart())) { inputClauseRequirements.add(new ClauseRequirement(text, typeRef)); return; } definitions.getItemDefinition() .stream() .filter(typeRefIsCustom(typeRef)) .findFirst() .ifPresent(itemDefinition -> addInputClauseRequirement(itemDefinition, inputClauseRequirements, text)); } DecisionTableEditorDefinitionEnricher(); @Inject  DecisionTableEditorDefinitionEnricher(final SessionManager sessionManager,
                                                 final DMNGraphUtils dmnGraphUtils,
                                                 final ItemDefinitionUtils itemDefinitionUtils); @Override void enrich(final Optional<String> nodeUUID,
                       final HasExpression hasExpression,
                       final Optional<DecisionTable> expression);  }