@Test public void testIsAllowed() { final Node node = mock(Node.class); final Definition content = mock(Definition.class); final DecisionService decisionService = mock(DecisionService.class); when(node.getContent()).thenReturn(content); when(content.getDefinition()).thenReturn(decisionService); final boolean actual = tested.isAllowed(canvasHandler, node); assertTrue(actual); verify(tested, never()).superIsAllowed(canvasHandler, node); }
@Override protected boolean isAllowed(final AbstractCanvasHandler canvasHandler, final Node node) { final Object content = node.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof DecisionService) { return true; } } return superIsAllowed(canvasHandler, node); }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { @Override protected boolean isAllowed(final AbstractCanvasHandler canvasHandler, final Node node) { final Object content = node.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof DecisionService) { return true; } } return superIsAllowed(canvasHandler, node); } }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { @Override protected boolean isAllowed(final AbstractCanvasHandler canvasHandler, final Node node) { final Object content = node.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof DecisionService) { return true; } } return superIsAllowed(canvasHandler, node); } @Inject  DMNCommonActionsToolboxFactory(final @Any ManagedInstance<DMNEditDecisionToolboxAction> editDecisionToolboxActions,
                                          final @Any ManagedInstance<DMNEditBusinessKnowledgeModelToolboxAction> editBusinessKnowledgeModelToolboxActions,
                                          final @Any ManagedInstance<DMNEditDRDToolboxAction> editDRDToolboxActions,
                                          final @Any @CommonActionsToolbox ManagedInstance<ActionsToolboxView> views,
                                          final CanvasCommandManager<AbstractCanvasHandler> commandManager,
                                          final @DMNEditor DefaultCanvasCommandFactory commandFactory,
                                          final @DMNEditor ManagedInstance<DeleteNodeToolboxAction> deleteNodeActions,
                                          final @DMNEditor ReadOnlyProvider readOnlyProvider); }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { @Override protected boolean isAllowed(final AbstractCanvasHandler canvasHandler, final Node node) { final Object content = node.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof DecisionService) { return true; } } return superIsAllowed(canvasHandler, node); } @Inject  DMNCommonActionsToolboxFactory(final @Any ManagedInstance<DMNEditDecisionToolboxAction> editDecisionToolboxActions,
                                          final @Any ManagedInstance<DMNEditBusinessKnowledgeModelToolboxAction> editBusinessKnowledgeModelToolboxActions,
                                          final @Any ManagedInstance<DMNEditDRDToolboxAction> editDRDToolboxActions,
                                          final @Any @CommonActionsToolbox ManagedInstance<ActionsToolboxView> views,
                                          final CanvasCommandManager<AbstractCanvasHandler> commandManager,
                                          final @DMNEditor DefaultCanvasCommandFactory commandFactory,
                                          final @DMNEditor ManagedInstance<DeleteNodeToolboxAction> deleteNodeActions,
                                          final @DMNEditor ReadOnlyProvider readOnlyProvider); @Override @SuppressWarnings("unchecked") Collection<ToolboxAction<AbstractCanvasHandler>> getActions(final AbstractCanvasHandler canvasHandler,
                                                                       final Element<?> element); @PreDestroy void destroy(); }
DMNCommonActionsToolboxFactory extends CommonActionsToolboxFactory { @Override protected boolean isAllowed(final AbstractCanvasHandler canvasHandler, final Node node) { final Object content = node.getContent(); if (content instanceof Definition) { final Object definition = ((Definition) content).getDefinition(); if (definition instanceof DecisionService) { return true; } } return superIsAllowed(canvasHandler, node); } @Inject  DMNCommonActionsToolboxFactory(final @Any ManagedInstance<DMNEditDecisionToolboxAction> editDecisionToolboxActions,
                                          final @Any ManagedInstance<DMNEditBusinessKnowledgeModelToolboxAction> editBusinessKnowledgeModelToolboxActions,
                                          final @Any ManagedInstance<DMNEditDRDToolboxAction> editDRDToolboxActions,
                                          final @Any @CommonActionsToolbox ManagedInstance<ActionsToolboxView> views,
                                          final CanvasCommandManager<AbstractCanvasHandler> commandManager,
                                          final @DMNEditor DefaultCanvasCommandFactory commandFactory,
                                          final @DMNEditor ManagedInstance<DeleteNodeToolboxAction> deleteNodeActions,
                                          final @DMNEditor ReadOnlyProvider readOnlyProvider); @Override @SuppressWarnings("unchecked") Collection<ToolboxAction<AbstractCanvasHandler>> getActions(final AbstractCanvasHandler canvasHandler,
                                                                       final Element<?> element); @PreDestroy void destroy();  }