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

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

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

Diagram.getName介绍

暂无

代码示例

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

@Override
public boolean equals(final Object o) {
  if (this == o) {
    return true;
  }
  if (!(o instanceof Diagram)) {
    return false;
  }
  Diagram that = (Diagram) o;
  return name != null && name.equals(that.getName());
}

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

@Override
public String getRawContent(D diagram) {
  try {
    return serialize(diagram)[0];
  } catch (java.io.IOException e) {
    LOG.error("Error while getting raw content for diagram with UUID [" + diagram.getName() + "].",
         e);
    throw new RuntimeException(e);
  }
}

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

@Override
protected boolean matches(final String criteria,
             final Diagram<Graph, Metadata> item) {
  final Map<String, String> criteriaMap = AbstractCriteriaLookupManager.parseCriteria(criteria);
  final String name = criteriaMap.get(DiagramLookupRequest.CRITERIA_NAME);
  if (null != name && name.trim().length() > 0) {
    return name.equals(item.getName());
  }
  return true;
}

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

@SuppressWarnings("unchecked")
private M register(final D diagram) {
  try {
    String[] raw = serialize(diagram);
    return doSave(diagram,
           raw[0],
           raw[1]);
  } catch (Exception e) {
    LOG.error("Error while saving diagram with UUID [" + diagram.getName() + "].",
         e);
    throw new RuntimeException(e);
  }
}

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

@Before
public void setup() {
  registry = new DiagramListRegistry();
  when(diagram1.getName()).thenReturn(DIAGRAM_1_UUID);
  when(diagram2.getName()).thenReturn(DIAGRAM_2_UUID);
}

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

private boolean isThisContext(final Notification notification) {
  try {
    final NotificationContext context = (NotificationContext) notification.getContext();
    return null != getDiagram() && getDiagram().getName().equals(context.getDiagramName());
  } catch (final ClassCastException e) {
    return false;
  }
}

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

@Override
public void update(final D diagram) {
  final int index = getWrapped().indexOf(diagram);
  if (index != -1) {
    final boolean isRemoved = remove(diagram);
    if (isRemoved) {
      getWrapped().add(index,
               diagram);
    }
  } else {
    throw new RuntimeException("Diagram with uuid [" + diagram.getName() + "] cannot be updated as it does not exist.");
  }
}

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

@Before
public void setup() {
  when(diagram.getName()).thenReturn(NAME);
  tested = new DiagramLookupServiceImpl(vfsLookupManager,
                     diagramService);
}

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

@SuppressWarnings("unchecked")
private void checkViolations(final H canvasHandler,
               final Collection<DiagramElementViolation<RuleViolation>> elementViolations) {
  final String uuid = canvasHandler.getUuid();
  final Diagram diagram = canvasHandler.getDiagram();
  final String name = diagram.getName();
  final String title = diagram.getMetadata().getTitle();
  final boolean[] valid = {true};
  elementViolations
      .forEach(v -> {
        if (checkViolation(canvasHandler,
                  v)) {
          valid[0] = false;
        }
      });
  if (valid[0]) {
    validationSuccessEvent.fire(new CanvasValidationSuccessEvent(uuid,
                                   name,
                                   title));
  } else {
    validationFailEvent.fire(new CanvasValidationFailEvent(uuid,
                                name,
                                title,
                                elementViolations));
  }
}

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

public void setup() {
  when(canvasHandler.getDiagram()).thenReturn(diagram);
  when(diagram.getName()).thenReturn(NAME);
  when(diagram.getMetadata()).thenReturn(metadata);
  when(metadata.getTitle()).thenReturn(TITLE);

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

@Test
  @SuppressWarnings("unchecked")
  public void testBuild() {
    final Diagram<Graph, Metadata> diagram = tested.build(NAME,
                               metadata,
                               graph);
    assertNotNull(diagram);
    assertEquals(NAME,
           diagram.getName());
    assertEquals(metadata,
           diagram.getMetadata());
    assertEquals(graph,
           diagram.getGraph());
    verify(metadata,
        times(1)).setCanvasRootUUID(eq(DIAGRAM_NODE_UUID));
  }
}

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

@Override
protected Metadata doSave(final Diagram diagram,
             final String raw,
             final String metadata) {
  try {
    getIoService().startBatch(backendFileSystemManager.getFileSystem());
    final Path dPath = diagram.getMetadata().getPath();
    final String name = null != dPath ? dPath.getFileName() : getNewFileName(diagram);
    final org.uberfire.java.nio.file.Path path =
        null != dPath ? Paths.convert(dPath) : getDiagramsPath().resolve(name);
    // Serialize the diagram's raw data.
    LOG.debug("Serializing raw data: {}", raw);
    getIoService().write(path,
               raw);
    final String metadataFileName = getMetadataFileName(name);
    final org.uberfire.java.nio.file.Path metadataPath =
        getDiagramsPath().resolve(metadataFileName);
    LOG.debug("Serializing raw metadadata: {}", metadata);
    getIoService().write(metadataPath,
               metadata);
    diagram.getMetadata().setPath(Paths.convert(path));
  } catch (Exception e) {
    LOG.error("Error serializing diagram with UUID [{}].", diagram.getName(), e);
  } finally {
    getIoService().endBatch();
  }
  return diagram.getMetadata();
}

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

@Test
  public void testBuild() {
    final Diagram<Graph, Metadata> diagram = tested.build(NAME,
                               metadata,
                               graph);
    assertNotNull(diagram);
    assertEquals(NAME,
           diagram.getName());
    assertEquals(metadata,
           diagram.getMetadata());
    assertEquals(graph,
           diagram.getGraph());
  }
}

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

final Diagram diagram = canvasHandler.getDiagram();
if (null != diagram) {
  log("Diagram name = " + diagram.getName());
  log("Graph uuid = " + (null != diagram.getGraph() ? diagram.getGraph().getUUID() : "null"));
  final Metadata metadata = diagram.getMetadata();

相关文章