org.kie.workbench.common.stunner.core.diagram.Diagram.getMetadata()方法的使用及代码示例

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

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

Diagram.getMetadata介绍

暂无

代码示例

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

public JBPMBpmn2ResourceImpl marshallToBpmn2Resource(final Diagram<Graph, Metadata> diagram) throws IOException {
  final Bpmn2Marshaller marshaller = new Bpmn2Marshaller(definitionManager,
                              oryxManager);
  return marshaller.marshallToBpmn2Resource(diagram,
                       getPreProcessingData(diagram.getMetadata()));
}

代码示例来源: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-client-common

private CanvasCommand<AbstractCanvasHandler> addEdge(final CanvasHandler canvasHandler,
                           final Node<View<?>, Edge> sourceNode,
                           final Node<View<?>, Edge> targetNode,
                           final Edge<? extends ViewConnector<?>, Node> connector) {
  return canvasCommandFactory.addConnector(sourceNode,
                       connector,
                       MagnetConnection.Builder.forElement(sourceNode, targetNode),
                       canvasHandler.getDiagram().getMetadata().getShapeSetId());
}

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

public StunnerDiagramEditorPreferences getPreferences(final D diagram) {
  final String definitionSetId = diagram.getMetadata().getDefinitionSetId();
  final StunnerPreferences preferences = getPreferencesRegistry().get(definitionSetId, StunnerPreferences.class);
  return preferences.getDiagramEditorPreferences();
}

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

@Override
public Collection<FormElementFilter> provideFilters(String elementUUID, Object definition) {
  final BPMNDiagram diagram = (BPMNDiagram) definition;
  final Boolean isAdHoc = diagram.getDiagramSet().getAdHoc().getValue();
  final Metadata metadata = sessionManager.getCurrentSession().getCanvasHandler().getDiagram().getMetadata();
  final ProjectType currentProjectType = diagramTypeService.getProjectType(metadata);
  final Predicate predicate = t -> isAdHoc && Objects.equals(currentProjectType, ProjectType.CASE);
  final FormElementFilter filter = new FormElementFilter(BPMNDiagramImpl.CASE_MANAGEMENT_SET, predicate);
  return Arrays.asList(filter);
}

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

@Before
public void init() {
  when(diagram.getMetadata()).thenReturn(metadata);
  when(metadata.getDefinitionSetId()).thenReturn(ID);
  when(definitionUtils.getDefinitionSetId(eq(BPMNDefinitionSet.class))).thenReturn(ID);
  tested = new BPMNFormGenerationModelProvider(bpmnBackendService,
                         definitionUtils);
  tested.init();
  verify(definitionUtils).getDefinitionSetId(eq(BPMNDefinitionSet.class));
}

代码示例来源: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-backend

private String getNewFileName(final Diagram diagram) {
  final String defSetId = diagram.getMetadata().getDefinitionSetId();
  final DefinitionSetService defSetService = getServiceById(defSetId);
  return UUID.uuid(8) + "." + defSetService.getResourceType().getSuffix();
}

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

@Override
public DragProxy<AbstractCanvasHandler, Item, DragProxyCallback> proxyFor(final AbstractCanvasHandler context) {
  this.canvasHandler = context;
  this.shapeViewDragProxyFactory.proxyFor(context.getAbstractCanvas());
  this.graphBoundsIndexer.setRootUUID(context.getDiagram().getMetadata().getCanvasRootUUID());
  return this;
}

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

@Before
public void setup() throws Exception {
  this.graphTestHandler = new TestingGraphMockHandler();
  when(diagram.getName()).thenReturn("Test diagram");
  when(diagram.getMetadata()).thenReturn(metadata);
  this.tested = new TestDiagramValidator();
}

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

protected void updateClientMetadata(final D diagram) {
  if (null != diagram) {
    final Metadata metadata = diagram.getMetadata();
    if (null != metadata && isEmpty(metadata.getShapeSetId())) {
      final String sId = shapeManager.getDefaultShapeSet(metadata.getDefinitionSetId()).getId();
      metadata.setShapeSetId(sId);
    }
  }
}

代码示例来源: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-widgets

@SuppressWarnings("unchecked")
private Notification translateCommand(final AbstractCanvasCommandEvent<? extends CanvasHandler> commandExecutedEvent) {
  final CanvasHandler canvasHandler = commandExecutedEvent.getCanvasHandler();
  final NotificationContext context = NotificationContext.Builder.build(canvasHandler.toString(),
                                     canvasHandler.getDiagram().getName(),
                                     canvasHandler.getDiagram().getMetadata().getTitle());
  return notificationBuilder.createCommandNotification(context,
                             commandExecutedEvent.getCommand(),
                             commandExecutedEvent.getResult());
}

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

@SuppressWarnings("unchecked")
public Node<View<?>, Edge> getParent(final double _x,
                   final double _y) {
  if (_x > -1 && _y > -1) {
    final String rootUUID = canvasHandler.getDiagram().getMetadata().getCanvasRootUUID();
    graphBoundsIndexer.setRootUUID(rootUUID).build(canvasHandler.getDiagram().getGraph());
    final Node<View<?>, Edge> r = graphBoundsIndexer.getAt(_x,
                                _y);
    return r;
  }
  return null;
}

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

private Element<?> getParentOfParent(AbstractCanvasHandler context, Node parent) {
  final Element parentOfParent = GraphUtils.getParent(parent);
  return (GraphUtils.isRootNode((Element<? extends View<?>>) parentOfParent, context.getGraphIndex().getGraph()) ?
      context.getGraphIndex().getNode(context.getDiagram().getMetadata().getCanvasRootUUID()) :
      parentOfParent);
}

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

private PaletteDefinitionBuilder<H, DefaultPaletteDefinition> getPaletteDefinitionBuilder(final H canvasHandler) {
  final String definitionSetId = canvasHandler.getDiagram().getMetadata().getDefinitionSetId();
  final Annotation qualifier = definitionUtils.getQualifier(definitionSetId);
  final ManagedInstance<PaletteDefinitionBuilder<H, DefaultPaletteDefinition>> custom =
      paletteDefinitionBuilders.select(qualifier);
  if (custom.isUnsatisfied()) {
    return paletteDefinitionBuilders.select(DefinitionManager.DEFAULT_QUALIFIER).get();
  }
  return custom.get();
}

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

@Override
protected FormGroup getFormGroup(RenderMode renderMode) {
  DefaultFormGroup formGroup = formGroupsInstance.get();
  view.init(this);
  final Diagram diagram = sessionManager.getCurrentSession().getCanvasHandler().getDiagram();
  path = diagram.getMetadata().getPath();
  graph = diagram.getGraph();
  formGroup.render(view.asWidget(), field);
  return formGroup;
}

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

protected void loadRuleSet(final Command callback) {
  final String id = getDiagram().getMetadata().getDefinitionSetId();
  final Object defSet = getDefinitionManager().definitionSets().getDefinitionSetById(id);
  this.ruleSet = definitionManager.adapters().forRules().getRuleSet(defSet);
  callback.execute();
}

代码示例来源: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-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);
}

相关文章