org.kie.workbench.common.stunner.core.graph.Graph.getUUID()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.kie.workbench.common.stunner.core.graph.Graph.getUUID()方法的一些代码示例,展示了Graph.getUUID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getUUID()方法的具体详情如下:
包路径:org.kie.workbench.common.stunner.core.graph.Graph
类名称:Graph
方法名:getUUID

Graph.getUUID介绍

暂无

代码示例

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-forms-client

private Optional<String> getGraphUUID() {
  if (Objects.isNull(getGraph())) {
    return Optional.empty();
  }
  return Optional.of(getGraph().getUUID());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-forms-client

@Override
public void deregister(final Element element) {
  if (null != renderer) {
    renderer.clear(getDiagram().getGraph().getUUID(), element);
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-forms-client

@Override
public void clear() {
  if (null != renderer) {
    renderer.clearAll(getDiagram().getGraph().getUUID());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

private void domainValidation(Diagram diagram, Consumer<DiagramElementViolation<RuleViolation>> callback) {
    StreamSupport.stream(validators.spliterator(), false)
        .filter(validator -> Objects.equals(validator.getDefinitionSetId(), diagram.getMetadata().getDefinitionSetId()))
        .findFirst()
        .ifPresent(validator -> validator.validate(diagram, domainViolations ->
            callback.accept(new ElementViolationImpl.Builder()
                        .setUuid(diagram.getGraph().getUUID())
                        .setDomainViolations(domainViolations)
                        .build())));
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Override
public void startGraphTraversal(final Graph<DefinitionSet, Node<View, Edge>> graph) {
  if (graph == null) {
    error("Graph is null!");
  } else {
    final DefinitionSet view = graph.getContent();
    log(indent + "Graph UUID: " + graph.getUUID());
    log(indent + "  Graph Starting nodes");
    log(indent + "  ====================");
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-backend-common

@Before
public void setUp() {
  when(validators.spliterator()).thenReturn(Arrays.asList(domainValidator).spliterator());
  when(domainValidator.getDefinitionSetId()).thenReturn(DEF_SET_ID);
  when(diagram.getMetadata()).thenReturn(metadata);
  when(metadata.getDefinitionSetId()).thenReturn(DEF_SET_ID);
  when(diagram.getGraph()).thenReturn(graph);
  when(graph.getUUID()).thenReturn(GRAPH_UUID);
  when(domainViolation.getViolationType()).thenReturn(Violation.Type.ERROR);
  validationService = new ValidationServiceImpl(validators);
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@SuppressWarnings("unchecked")
public void init() {
  MockitoAnnotations.initMocks(this);
  when(graph.getUUID()).thenReturn(GRAPH_UUID);
  when(graph.getContent()).thenReturn(graphContent);
  when(graph.nodes()).thenReturn(graphNodes);
  when(definitionManager.adapters()).thenReturn(adapterManager);
  when(adapterManager.registry()).thenReturn(adapterRegistry);
  when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
  when(adapterManager.forProperty()).thenReturn(propertyAdapter);
  when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter);
  when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter);
  when(graphCommandExecutionContext.getDefinitionManager()).thenReturn(definitionManager);
  when(graphCommandExecutionContext.getFactoryManager()).thenReturn(factoryManager);
  when(graphCommandExecutionContext.getRuleManager()).thenReturn(ruleManager);
  when(graphCommandExecutionContext.getGraphIndex()).thenReturn(graphIndex);
  when(graphCommandExecutionContext.getRuleSet()).thenReturn(ruleSet);
  when(graphIndex.getGraph()).thenReturn(graph);
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(EMPTY_VIOLATIONS);
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

@Override
public <S extends ClientSession> void destroy(final S session) {
  final boolean isCurrent = session.equals(current);
  final String uuid = session.getSessionUUID();
  final Diagram diagram = session.getCanvasHandler().getDiagram();
  final String name = null != diagram ? diagram.getName() : null;
  final String graphUuid = null != diagram ? diagram.getGraph().getUUID() : null;
  final Metadata metadata = null != diagram ? diagram.getMetadata() : null;
  ((AbstractSession) session).destroy();
  sessionInstances.destroy(session);
  if (isCurrent) {
    current = null;
  }
  sessionDestroyedEvent.fire(new SessionDestroyedEvent(uuid,
                             name,
                             graphUuid,
                             metadata));
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
@SuppressWarnings("unchecked")
public void testExecuteCheckFailed() {
  final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
      .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                            UUID));
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
  CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext);
  assertEquals(CommandResult.Type.ERROR,
         result.getType());
  verify(graph,
      times(0)).addNode(eq(node));
  verify(graphIndex,
      times(0)).addNode(eq(node));
  verify(graphIndex,
      times(0)).addEdge(any(Edge.class));
  verify(graph,
      times(0)).removeNode(eq(UUID));
  verify(graphIndex,
      times(0)).removeNode(eq(node));
  verify(graphIndex,
      times(0)).removeEdge(any(Edge.class));
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
@SuppressWarnings("unchecked")
public void testNotAllowed() {
  final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
      .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                            PARENT_UUID));
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
  CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext);
  assertEquals(CommandResult.Type.ERROR,
         result.getType());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
@SuppressWarnings("unchecked")
public void testNotAllowed() {
  final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
      .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                            PARENT_UUID));
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
  CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext);
  assertEquals(CommandResult.Type.ERROR,
         result.getType());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
@SuppressWarnings("unchecked")
public void testNotAllowed() {
  final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
      .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                            UUID));
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
  CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext);
  assertEquals(CommandResult.Type.ERROR,
         result.getType());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
@SuppressWarnings("unchecked")
public void testNotAllowed() {
  final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
      .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                            UUID));
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
  CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext);
  assertEquals(CommandResult.Type.ERROR,
         result.getType());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
@SuppressWarnings("unchecked")
public void testNotAllowed() {
  final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
      .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                            PARENT_UUID));
  when(ruleManager.evaluate(any(RuleSet.class),
               any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
  CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext);
  assertEquals(CommandResult.Type.ERROR,
         result.getType());
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
  @SuppressWarnings("unchecked")
  public void testNotAllowed() {
    final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
        .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                              PARENT_UUID));
    when(ruleManager.evaluate(any(RuleSet.class),
                 any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
    CommandResult<RuleViolation> result = tested.allow(graphCommandExecutionContext);
    assertEquals(CommandResult.Type.ERROR,
           result.getType());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
  @SuppressWarnings("unchecked")
  public void testExecuteCheckFailed() {
    final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
        .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                              PARENT_UUID));
    when(ruleManager.evaluate(any(RuleSet.class),
                 any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
    CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext);
    assertEquals(CommandResult.Type.ERROR,
           result.getType());
    assertTrue(parent.getOutEdges().isEmpty());
    assertTrue(candidate.getInEdges().isEmpty());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
  @SuppressWarnings("unchecked")
  public void testExecuteCheckFailed() {
    final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
        .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                              PARENT_UUID));
    when(ruleManager.evaluate(any(RuleSet.class),
                 any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
    CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext);
    assertEquals(CommandResult.Type.ERROR,
           result.getType());
    assertTrue(parent.getOutEdges().isEmpty());
    assertTrue(candidate.getInEdges().isEmpty());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

private String getFileName() {
    final Path path = getSession().getCanvasHandler().getDiagram().getMetadata().getPath();
    return null != path ? path.getFileName() : getSession().getCanvasHandler().getDiagram().getGraph().getUUID();
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
  @SuppressWarnings("unchecked")
  public void testExecuteCheckFailed() {
    final RuleViolations FAILED_VIOLATIONS = new DefaultRuleViolations()
        .addViolation(new ContainmentRuleViolation(graph.getUUID(),
                              PARENT_UUID));
    when(ruleManager.evaluate(any(RuleSet.class),
                 any(RuleEvaluationContext.class))).thenReturn(FAILED_VIOLATIONS);
    CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext);
    assertEquals(CommandResult.Type.ERROR,
           result.getType());
    assertTrue(parent.getOutEdges().isEmpty());
    assertTrue(candidate.getInEdges().isEmpty());
  }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-core-common

@Test
  public void testBuild() {
    final Graph<DefinitionSet, Node> graph = tested.build(UUID,
                               ID);
    assertNotNull(graph);
    assertEquals(UUID,
           graph.getUUID());
    assertEquals(1,
           graph.getLabels().size());
    assertTrue(graph.getLabels().contains(ID));
  }
}

相关文章