@Test @SuppressWarnings("unchecked") public void testIsReadOnly() { final Node target = mock(Node.class); final View content = mock(View.class); final DynamicReadOnly dynamicReadonly = mock(DynamicReadOnly.class); when(dynamicReadonly.isAllowOnlyVisualChange()).thenReturn(true); when(content.getDefinition()).thenReturn(dynamicReadonly); when(target.getContent()).thenReturn(content); when(context.getTarget()).thenReturn(Optional.of(target)); final boolean actual = check.isReadOnly(Optional.of(target)); assertTrue(actual); verify(check).isReadOnly(any(Optional.class)); }
boolean isReadOnly(final Optional<Node<? extends View<?>, ? extends Edge>> oTarget) { final Node<? extends View<?>, ? extends Edge> target = oTarget.get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); if (definition instanceof DynamicReadOnly) { if (((DynamicReadOnly) definition).isAllowOnlyVisualChange()) { return true; } } return false; }
NoInputNodesInImportedDecisionRule extends RuleExtensionHandler<NoInputNodesInImportedDecisionRule, GraphConnectionContext> { boolean isReadOnly(final Optional<Node<? extends View<?>, ? extends Edge>> oTarget) { final Node<? extends View<?>, ? extends Edge> target = oTarget.get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); if (definition instanceof DynamicReadOnly) { if (((DynamicReadOnly) definition).isAllowOnlyVisualChange()) { return true; } } return false; } }
NoInputNodesInImportedDecisionRule extends RuleExtensionHandler<NoInputNodesInImportedDecisionRule, GraphConnectionContext> { boolean isReadOnly(final Optional<Node<? extends View<?>, ? extends Edge>> oTarget) { final Node<? extends View<?>, ? extends Edge> target = oTarget.get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); if (definition instanceof DynamicReadOnly) { if (((DynamicReadOnly) definition).isAllowOnlyVisualChange()) { return true; } } return false; }  }
NoInputNodesInImportedDecisionRule extends RuleExtensionHandler<NoInputNodesInImportedDecisionRule, GraphConnectionContext> { boolean isReadOnly(final Optional<Node<? extends View<?>, ? extends Edge>> oTarget) { final Node<? extends View<?>, ? extends Edge> target = oTarget.get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); if (definition instanceof DynamicReadOnly) { if (((DynamicReadOnly) definition).isAllowOnlyVisualChange()) { return true; } } return false; }  @Override Class<NoInputNodesInImportedDecisionRule> getExtensionType(); @Override Class<GraphConnectionContext> getContextType(); @Override boolean accepts(final RuleExtension rule,
                           final GraphConnectionContext context); @Override RuleViolations evaluate(final RuleExtension rule,
                                   final GraphConnectionContext context); }
NoInputNodesInImportedDecisionRule extends RuleExtensionHandler<NoInputNodesInImportedDecisionRule, GraphConnectionContext> { boolean isReadOnly(final Optional<Node<? extends View<?>, ? extends Edge>> oTarget) { final Node<? extends View<?>, ? extends Edge> target = oTarget.get(); final View<?> content = target.getContent(); if (Objects.isNull(content)) { return false; } final Object definition = content.getDefinition(); if (definition instanceof DynamicReadOnly) { if (((DynamicReadOnly) definition).isAllowOnlyVisualChange()) { return true; } } return false; }  @Override Class<NoInputNodesInImportedDecisionRule> getExtensionType(); @Override Class<GraphConnectionContext> getContextType(); @Override boolean accepts(final RuleExtension rule,
                           final GraphConnectionContext context); @Override RuleViolations evaluate(final RuleExtension rule,
                                   final GraphConnectionContext context);  }