@Test public void testAddInputClauseRequirementWhenDataTypeIsStructureAndDontHaveFields() { final ItemDefinition tPerson = mock(ItemDefinition.class); final String inputData = "InputData"; final List<DecisionTableEditorDefinitionEnricher.ClauseRequirement> inputClauseRequirements = new ArrayList<>(); final ItemDefinitionUtils itemDefinitionUtils = new ItemDefinitionUtils(mock(DMNGraphUtils.class)); final DecisionTableEditorDefinitionEnricher enricher = new DecisionTableEditorDefinitionEnricher(null, null, itemDefinitionUtils); when(tPerson.getName()).thenReturn(new Name(TYPE_PERSON)); when(tPerson.getTypeRef()).thenReturn(null); when(tPerson.getItemComponent()).thenReturn(emptyList()); enricher.addInputClauseRequirement(tPerson, inputClauseRequirements, inputData); assertEquals(1, inputClauseRequirements.size()); assertEquals("InputData", inputClauseRequirements.get(0).text); assertEquals(TYPE_PERSON, inputClauseRequirements.get(0).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);  }