@Test public void testComputingClauseNameWithoutModelRefWhenLocalPartEndsWithDot() { final ItemDefinition itemComponent = new ItemDefinition(); itemComponent.setName(new Name("age.")); itemComponent.setAllowOnlyVisualChange(true); assertEquals("age.", new DecisionTableEditorDefinitionEnricher(null, null, null) .computeClauseName(itemComponent)); }
String computeClauseName(final ItemDefinition itemComponent) { final String originalName = itemComponent.getName().getValue(); String nameWithoutModelRef = originalName; if (itemComponent.isImported()) { final int positionOfLastDot = originalName.lastIndexOf(DOT_CHAR) + 1; if (positionOfLastDot > 0 && positionOfLastDot != originalName.length()) { nameWithoutModelRef = originalName.substring(positionOfLastDot); } } return nameWithoutModelRef; }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { String computeClauseName(final ItemDefinition itemComponent) { final String originalName = itemComponent.getName().getValue(); String nameWithoutModelRef = originalName; if (itemComponent.isImported()) { final int positionOfLastDot = originalName.lastIndexOf(DOT_CHAR) + 1; if (positionOfLastDot > 0 && positionOfLastDot != originalName.length()) { nameWithoutModelRef = originalName.substring(positionOfLastDot); } } return nameWithoutModelRef; } }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { String computeClauseName(final ItemDefinition itemComponent) { final String originalName = itemComponent.getName().getValue(); String nameWithoutModelRef = originalName; if (itemComponent.isImported()) { final int positionOfLastDot = originalName.lastIndexOf(DOT_CHAR) + 1; if (positionOfLastDot > 0 && positionOfLastDot != originalName.length()) { nameWithoutModelRef = originalName.substring(positionOfLastDot); } } return nameWithoutModelRef; } DecisionTableEditorDefinitionEnricher(); @Inject  DecisionTableEditorDefinitionEnricher(final SessionManager sessionManager,
                                                 final DMNGraphUtils dmnGraphUtils,
                                                 final ItemDefinitionUtils itemDefinitionUtils); }
DecisionTableEditorDefinitionEnricher implements ExpressionEditorModelEnricher<DecisionTable> { String computeClauseName(final ItemDefinition itemComponent) { final String originalName = itemComponent.getName().getValue(); String nameWithoutModelRef = originalName; if (itemComponent.isImported()) { final int positionOfLastDot = originalName.lastIndexOf(DOT_CHAR) + 1; if (positionOfLastDot > 0 && positionOfLastDot != originalName.length()) { nameWithoutModelRef = originalName.substring(positionOfLastDot); } } return nameWithoutModelRef; } 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> { String computeClauseName(final ItemDefinition itemComponent) { final String originalName = itemComponent.getName().getValue(); String nameWithoutModelRef = originalName; if (itemComponent.isImported()) { final int positionOfLastDot = originalName.lastIndexOf(DOT_CHAR) + 1; if (positionOfLastDot > 0 && positionOfLastDot != originalName.length()) { nameWithoutModelRef = originalName.substring(positionOfLastDot); } } return nameWithoutModelRef; } 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);  }