org.kie.workbench.common.stunner.core.graph.content.definition.Definition.getDefinition()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.5k)|赞(0)|评价(0)|浏览(132)

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

Definition.getDefinition介绍

暂无

代码示例

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

@SuppressWarnings("unchecked")
String diagramUUID() {
  final Diagram diagram = decisionNavigatorPresenter.getDiagram();
  final Graph<?, Node> graph = diagram.getGraph();
  return StreamSupport.stream(graph.nodes().spliterator(), false)
      .filter(n -> n.getContent() instanceof Definition)
      .filter(n -> ((Definition) n.getContent()).getDefinition() instanceof DMNDiagram)
      .findFirst()
      .map(Node::getUUID)
      .orElse("");
}

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

private Optional<Object> getBean(final Element element) {
    if (!(element.getContent() instanceof DefinitionSet) &&
        element.getContent() instanceof Definition) {
      return Optional.ofNullable(((Definition) element.getContent()).getDefinition());
    }
    return Optional.empty();
  }
}

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

public static Object getElementDefinition(final Element element) {
    if (element != null && element.getContent() instanceof Definition) {
      return ((Definition) element.getContent()).getDefinition();
    } else {
      return null;
    }
  }
}

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

private Optional<String> getCandidateParentId() {
    return candidateParent.isPresent() ?
        Optional.ofNullable(provider.definitionManager.adapters()
                      .forDefinition()
                      .getId(candidateParent.get().getContent().getDefinition())
                      .value()) :
        Optional.empty();
  }
}

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

protected static Optional<String> getId(final DefinitionManager definitionManager,
                      final Edge edge) {
    final Object content = edge.getContent();
    if (content instanceof Definition) {
      final Definition holder = (Definition) content;
      return Optional.of(definitionManager.adapters().forDefinition().getId(holder.getDefinition()).value());
    }
    return Optional.empty();
  }
}

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

private boolean isDecision(final Element<?> element) {
  return null != element.asNode()
      && element.getContent() instanceof Definition
      && ((Definition) element.getContent()).getDefinition() instanceof Decision;
}

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

private boolean isBusinessKnowledgeModel(final Element<?> element) {
    return null != element.asNode()
        && element.getContent() instanceof Definition
        && ((Definition) element.getContent()).getDefinition() instanceof BusinessKnowledgeModel;
  }
}

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

private String getTitle(final Graph graph) {
  final Node<Definition<BPMNDiagram>, ?> diagramNode = getFirstDiagramNode(graph);
  final BPMNDiagram diagramBean = null != diagramNode ? (BPMNDiagram) ((Definition) diagramNode.getContent()).getDefinition() : null;
  if (diagramBean == null) {
    return null;
  }
  return getTitle(diagramBean);
}

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

private Optional<CanvasCommand<AbstractCanvasHandler>> getMoveDividerCommand(final Element<? extends Definition<?>> element,
                                       final double dividerY) {
  final Definition content = element.getContent();
  final Object definition = content.getDefinition();
  final DefinitionAdapter<Object> adapter = canvasHandler.getDefinitionManager().adapters().registry().getDefinitionAdapter(definition.getClass());
  final Optional<?> dividerYProperty = adapter.getProperty(definition, DIVIDER_Y_PROPERTY_ID);
  if (dividerYProperty.isPresent()) {
    final Object dyp = dividerYProperty.get();
    final String id = canvasHandler.getDefinitionManager().adapters().forProperty().getId(dyp);
    return Optional.of(canvasCommandFactory.updatePropertyValue(element, id, dividerY));
  }
  return Optional.empty();
}

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

@SuppressWarnings("unchecked")
T getGatewayNodeById(Diagram<Graph, Metadata> diagram, String id, Class<T> type) {
  Node<? extends Definition, ?> node = diagram.getGraph().getNode(id);
  assertThat(node).isNotNull();
  return type.cast(node.getContent().getDefinition());
}

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

@SuppressWarnings("unchecked")
  private void setupDefinitionManager() {
    when(element.getContent()).thenReturn(content);
    when(content.getDefinition()).thenReturn(definition);
    when(definitionManager.adapters()).thenReturn(adapterManager);
    when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
    when(definitionAdapter.getProperties(eq(content))).thenReturn(new Sets.Builder<String>().add(PROPERTY).build());
    when(definitionAdapter.getProperties(any(DomainObject.class))).thenReturn(new Sets.Builder<String>().add(PROPERTY).build());
    when(adapterManager.forProperty()).thenReturn(propertyAdapter);
    when(propertyAdapter.getId(PROPERTY)).thenReturn(PROPERTY_ID);
  }
}

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

@SuppressWarnings("unchecked")
T getSubProcessNodeById(Diagram<Graph, Metadata> diagram, String id, int incomeEdges, int outcomeEdges) {
  Node<? extends Definition, ?> node = getNodebyId(diagram, id, incomeEdges, outcomeEdges);
  return getSubProcessType().cast(node.getContent().getDefinition());
}

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

private String getDiagramSvgFileName(Diagram diagram) {
  final Object metaProperty = definitionManager.adapters()
      .forDefinition()
      .getMetaProperty(PropertyMetaTypes.ID,
               ((Definition) diagram.getGraph()
                   .getNode(diagram.getMetadata().getCanvasRootUUID())
                   .getContent()).getDefinition());
  final Object diagramFileId = definitionManager.adapters().forProperty().getValue(metaProperty);
  return String.valueOf(diagramFileId).concat(SVG_SUFFIX);
}

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

@SuppressWarnings("unchecked")
T getStartNodeById(Diagram<Graph, Metadata> diagram, String id, Class<T> type) {
  Node<? extends Definition, ?> node = diagram.getGraph().getNode(id);
  assertNotNull(node);
  assertEquals(1, node.getOutEdges().size());
  return type.cast(node.getContent().getDefinition());
}

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

private static String getElementDefinitionId(final DefinitionManager definitionManager,
                       final Element<?> element) {
  String targetId = null;
  if (element.getContent() instanceof Definition) {
    final Object definition = ((Definition) element.getContent()).getDefinition();
    targetId = definitionManager.adapters().forDefinition().getId(definition).value();
  } else if (element.getContent() instanceof DefinitionSet) {
    targetId = ((DefinitionSet) element.getContent()).getDefinition();
  }
  return targetId;
}

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

@SuppressWarnings("unchecked")
T getTaskNodeById(Diagram<Graph, Metadata> diagram, String id, int amountOfIncomeEdges, boolean hasOutcomeEdge) {
  Node<? extends Definition, ?> node = diagram.getGraph().getNode(id);
  assertNotNull(node);
  assertEquals(amountOfIncomeEdges + 1, node.getInEdges().size());
  int outcomeEdges = hasOutcomeEdge ? 1 : 0;
  assertEquals(outcomeEdges, node.getOutEdges().size());
  return getTaskType().cast(node.getContent().getDefinition());
}

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

@SuppressWarnings("unchecked")
T getEndNodeById(Diagram<Graph, Metadata> diagram, String id, boolean hasIncomeEdge) {
  Node<? extends Definition, ?> node = diagram.getGraph().getNode(id);
  assertNotNull(node);
  int incomeEdges = hasIncomeEdge ? 2 : 1;
  assertEquals(incomeEdges, node.getInEdges().size());
  assertEquals(0, node.getOutEdges().size());
  return getEndEventType().cast(node.getContent().getDefinition());
}

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

@SuppressWarnings("unchecked")
T getCatchingIntermediateNodeById(Diagram<Graph, Metadata> diagram, String id, boolean hasIncomeEdge, boolean hasOutgoingEdge) {
  Node<? extends Definition, ?> node = diagram.getGraph().getNode(id);
  assertNotNull(node);
  int incomeEdges = hasIncomeEdge ? getDefaultAmountOfIncomdeEdges() + 1 : getDefaultAmountOfIncomdeEdges();
  assertEquals(incomeEdges, node.getInEdges().size());
  int outgoingEdges = hasOutgoingEdge ? 1 : 0;
  assertEquals(outgoingEdges, node.getOutEdges().size());
  return getCatchingIntermediateEventType().cast(node.getContent().getDefinition());
}

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

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallBasic() throws Exception {
  Diagram<Graph, Metadata> diagram = unmarshall(BPMN_BASIC);
  assertDiagram(diagram,
         4);
  assertEquals("Basic process",
         diagram.getMetadata().getTitle());
  Node<? extends Definition, ?> task1 = diagram.getGraph().getNode("810797AB-7D09-4E1F-8A5B-96C424E4B031");
  assertTrue(task1.getContent().getDefinition() instanceof NoneTask);
}

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

@Test
@SuppressWarnings("unchecked")
public void testUnmarshallBasic() throws Exception {
  Diagram<Graph, Metadata> diagram = unmarshall(BPMN_BASIC);
  assertDiagram(diagram,
         4);
  assertEquals("Basic process",
         diagram.getMetadata().getTitle());
  Node<? extends Definition, ?> task1 = diagram.getGraph().getNode("810797AB-7D09-4E1F-8A5B-96C424E4B031");
  assertTrue(task1.getContent().getDefinition() instanceof NoneTask);
}

相关文章