@Test public void testUpdate() { final Decision drgElement1 = makeDecision("model1.tUUID", "string", true); final Decision drgElement2 = makeDecision("model1.imported person", "model1.tPerson", true); final InputData drgElement3 = makeInputData("local person", "model1.tPerson", false); final InputData drgElement4 = makeInputData("regular DRG Element", "boolean", false); setId(drgElement2, "model1.uuid"); final List<DRGElement> drgElements = asList(drgElement1, drgElement2, drgElement3, drgElement4); doNothing().when(handler).updateDRGElementName(any(), anyString()); when(dmnGraphUtils.getModelDRGElements()).thenReturn(drgElements); handler.update("model1", "model2"); verify(handler).updateDRGElementName(drgElement1, "model2.tUUID"); verify(handler).updateDRGElementName(drgElement2, "model2.imported person"); assertEquals("string", drgElement1.getVariable().getTypeRef().getLocalPart()); assertEquals("model2.uuid", drgElement2.getId().getValue()); assertEquals("model2.tPerson", drgElement2.getVariable().getTypeRef().getLocalPart()); assertEquals("model2.tPerson", drgElement3.getVariable().getTypeRef().getLocalPart()); assertEquals("boolean", drgElement4.getVariable().getTypeRef().getLocalPart()); }
@Override public void update(final String oldModelName, final String newModelName) { updateDRGElementsVariableAndId(oldModelName, newModelName); findDRGElementsByOldName(oldModelName) .forEach(drgElement -> { final String oldName = drgElement.getName().getValue(); final String newName = oldName.replaceAll("^" + oldModelName, newModelName); updateDRGElementName(drgElement, newName); }); }
DMNIncludedModelHandler implements DRGElementHandler { @Override public void update(final String oldModelName, final String newModelName) { updateDRGElementsVariableAndId(oldModelName, newModelName); findDRGElementsByOldName(oldModelName) .forEach(drgElement -> { final String oldName = drgElement.getName().getValue(); final String newName = oldName.replaceAll("^" + oldModelName, newModelName); updateDRGElementName(drgElement, newName); }); } }
DMNIncludedModelHandler implements DRGElementHandler { @Override public void update(final String oldModelName, final String newModelName) { updateDRGElementsVariableAndId(oldModelName, newModelName); findDRGElementsByOldName(oldModelName) .forEach(drgElement -> { final String oldName = drgElement.getName().getValue(); final String newName = oldName.replaceAll("^" + oldModelName, newModelName); updateDRGElementName(drgElement, newName); }); } @Inject  DMNIncludedModelHandler(final DMNGraphUtils dmnGraphUtils,
                                   final @DMNEditor DefaultCanvasCommandFactory canvasCommandFactory,
                                   final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                                   final DefinitionUtils definitionUtils); }
DMNIncludedModelHandler implements DRGElementHandler { @Override public void update(final String oldModelName, final String newModelName) { updateDRGElementsVariableAndId(oldModelName, newModelName); findDRGElementsByOldName(oldModelName) .forEach(drgElement -> { final String oldName = drgElement.getName().getValue(); final String newName = oldName.replaceAll("^" + oldModelName, newModelName); updateDRGElementName(drgElement, newName); }); } @Inject  DMNIncludedModelHandler(final DMNGraphUtils dmnGraphUtils,
                                   final @DMNEditor DefaultCanvasCommandFactory canvasCommandFactory,
                                   final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                                   final DefinitionUtils definitionUtils); @Override void update(final String oldModelName,
                       final String newModelName); @Override void destroy(final String oldModelName); }
DMNIncludedModelHandler implements DRGElementHandler { @Override public void update(final String oldModelName, final String newModelName) { updateDRGElementsVariableAndId(oldModelName, newModelName); findDRGElementsByOldName(oldModelName) .forEach(drgElement -> { final String oldName = drgElement.getName().getValue(); final String newName = oldName.replaceAll("^" + oldModelName, newModelName); updateDRGElementName(drgElement, newName); }); } @Inject  DMNIncludedModelHandler(final DMNGraphUtils dmnGraphUtils,
                                   final @DMNEditor DefaultCanvasCommandFactory canvasCommandFactory,
                                   final SessionCommandManager<AbstractCanvasHandler> sessionCommandManager,
                                   final DefinitionUtils definitionUtils); @Override void update(final String oldModelName,
                       final String newModelName); @Override void destroy(final String oldModelName);  }