@Test public void testUpdateDiagramIdWhenDiagramIdIsEmpty() { final String diagramId = "diagram id"; final String currentDiagramId = ""; final HasContentDefinitionId hasContentDefinitionId = mock(HasContentDefinitionId.class); final Element element = getElementForTestUpdateDiagramId(diagramId, currentDiagramId, hasContentDefinitionId); canvasHandler.updateDiagramId(element); verify(hasContentDefinitionId).setDiagramId(diagramId); }
void updateDiagramId(final Element element) { final Object content = element.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof HasContentDefinitionId) { final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) definition; if (Strings.isNullOrEmpty(hasContentDefinitionId.getDiagramId())) { hasContentDefinitionId.setDiagramId(getGraphsProvider().getCurrentDiagramId()); } } } }
DMNCanvasHandler extends CanvasHandlerImpl<D, C> { void updateDiagramId(final Element element) { final Object content = element.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof HasContentDefinitionId) { final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) definition; if (Strings.isNullOrEmpty(hasContentDefinitionId.getDiagramId())) { hasContentDefinitionId.setDiagramId(getGraphsProvider().getCurrentDiagramId()); } } } } }
DMNCanvasHandler extends CanvasHandlerImpl<D, C> { void updateDiagramId(final Element element) { final Object content = element.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof HasContentDefinitionId) { final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) definition; if (Strings.isNullOrEmpty(hasContentDefinitionId.getDiagramId())) { hasContentDefinitionId.setDiagramId(getGraphsProvider().getCurrentDiagramId()); } } } } @Inject  DMNCanvasHandler(final ClientDefinitionManager clientDefinitionManager,
                            final CanvasCommandFactory<AbstractCanvasHandler> commandFactory,
                            final RuleManager ruleManager,
                            final GraphUtils graphUtils,
                            final GraphIndexBuilder<? extends MutableIndex<Node, Edge>> indexBuilder,
                            final ShapeManager shapeManager,
                            final TextPropertyProviderFactory textPropertyProviderFactory,
                            final Event<CanvasElementAddedEvent> canvasElementAddedEvent,
                            final Event<CanvasElementRemovedEvent> canvasElementRemovedEvent,
                            final Event<CanvasElementUpdatedEvent> canvasElementUpdatedEvent,
                            final Event<CanvasElementsClearEvent> canvasElementsClearEvent,
                            final DMNElementsSynchronizer dmnElementsSynchronizer,
                            final GraphsProvider graphsProvider); }
DMNCanvasHandler extends CanvasHandlerImpl<D, C> { void updateDiagramId(final Element element) { final Object content = element.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof HasContentDefinitionId) { final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) definition; if (Strings.isNullOrEmpty(hasContentDefinitionId.getDiagramId())) { hasContentDefinitionId.setDiagramId(getGraphsProvider().getCurrentDiagramId()); } } } } @Inject  DMNCanvasHandler(final ClientDefinitionManager clientDefinitionManager,
                            final CanvasCommandFactory<AbstractCanvasHandler> commandFactory,
                            final RuleManager ruleManager,
                            final GraphUtils graphUtils,
                            final GraphIndexBuilder<? extends MutableIndex<Node, Edge>> indexBuilder,
                            final ShapeManager shapeManager,
                            final TextPropertyProviderFactory textPropertyProviderFactory,
                            final Event<CanvasElementAddedEvent> canvasElementAddedEvent,
                            final Event<CanvasElementRemovedEvent> canvasElementRemovedEvent,
                            final Event<CanvasElementUpdatedEvent> canvasElementUpdatedEvent,
                            final Event<CanvasElementsClearEvent> canvasElementsClearEvent,
                            final DMNElementsSynchronizer dmnElementsSynchronizer,
                            final GraphsProvider graphsProvider); @Override @SuppressWarnings("unchecked") void addChild(final Element parent,
                         final Element child); }
DMNCanvasHandler extends CanvasHandlerImpl<D, C> { void updateDiagramId(final Element element) { final Object content = element.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof HasContentDefinitionId) { final HasContentDefinitionId hasContentDefinitionId = (HasContentDefinitionId) definition; if (Strings.isNullOrEmpty(hasContentDefinitionId.getDiagramId())) { hasContentDefinitionId.setDiagramId(getGraphsProvider().getCurrentDiagramId()); } } } } @Inject  DMNCanvasHandler(final ClientDefinitionManager clientDefinitionManager,
                            final CanvasCommandFactory<AbstractCanvasHandler> commandFactory,
                            final RuleManager ruleManager,
                            final GraphUtils graphUtils,
                            final GraphIndexBuilder<? extends MutableIndex<Node, Edge>> indexBuilder,
                            final ShapeManager shapeManager,
                            final TextPropertyProviderFactory textPropertyProviderFactory,
                            final Event<CanvasElementAddedEvent> canvasElementAddedEvent,
                            final Event<CanvasElementRemovedEvent> canvasElementRemovedEvent,
                            final Event<CanvasElementUpdatedEvent> canvasElementUpdatedEvent,
                            final Event<CanvasElementsClearEvent> canvasElementsClearEvent,
                            final DMNElementsSynchronizer dmnElementsSynchronizer,
                            final GraphsProvider graphsProvider); @Override @SuppressWarnings("unchecked") void addChild(final Element parent,
                         final Element child);  }