Class MermaidGraphBuilderBase

java.lang.Object
org.odpi.openmetadata.commonservices.mermaid.MermaidGraphBuilderBase
Direct Known Subclasses:
AssetGraphMermaidGraphBuilder, AssetLineageEdgeGraphMermaidGraphBuilder, AssetLineageGraphMermaidGraphBuilder, GovernanceActionProcessMermaidGraphBuilder, GovernanceDefinitionMermaidGraphBuilder, HierarchyMermaidGraphBuilder, InformationSupplyChainMermaidGraphBuilder, OpenMetadataMermaidGraphBuilder, ProjectMermaidGraphBuilder, SolutionBlueprintMermaidGraphBuilder, SolutionComponentMermaidGraphBuilder, SolutionRoleMermaidGraphBuilder, SpecificationMermaidGraphBuilder

public class MermaidGraphBuilderBase extends Object
Provides the basic functions for building flowchart based graph visualizations.
  • Field Details

  • Constructor Details

    • MermaidGraphBuilderBase

      public MermaidGraphBuilderBase()
  • Method Details

    • extractAnchorInfo

      protected void extractAnchorInfo(ElementHeader elementHeader)
      Extract any anchor information to allow the graph to include linkages to anchors. This can help join up lineage graphs.
      Parameters:
      elementHeader - header of extracted element
    • addAnchorLinks

      protected void addAnchorLinks(boolean allAnchors)
      Add links to anchors to the graph.
      Parameters:
      allAnchors - should all anchors be added - or just those to known nodes?
    • getVisualStyleForSolutionComponent

      protected VisualStyle getVisualStyleForSolutionComponent(String solutionComponentType)
      Map the solution component type to an appropriate visual style.
      Parameters:
      solutionComponentType - type of component
      Returns:
      visual style enum
    • addSpacesToTypeName

      protected String addSpacesToTypeName(String typeName)
      Convert a type name into a spaced string to allow the names to wrap nicely in a mermaid box.
      Parameters:
      typeName - type name
      Returns:
      spaced type name
    • getListLabel

      public String getListLabel(List<String> labelValues)
      Convert an array into a comma separated string.
      Parameters:
      labelValues - array of labels
      Returns:
      string value
    • appendMermaidNode

      public void appendMermaidNode(String currentNodeName, String currentDisplayName, String currentType)
      Create a node in the mermaid graph.
      Parameters:
      currentNodeName - unique name/identifier
      currentDisplayName - display name
      currentType - type of element
    • appendNewMermaidNode

      public boolean appendNewMermaidNode(String currentNodeName, String currentDisplayName, String currentType, VisualStyle visualStyle)
      Create a node in the mermaid graph.
      Parameters:
      currentNodeName - unique name/identifier
      currentDisplayName - display name
      currentType - type of element
      visualStyle - mermaid defined shape and colour value
      Returns:
      whether a new node was created or not.
    • appendNewMermaidNode

      public boolean appendNewMermaidNode(String currentNodeName, String currentDisplayName, String currentType, Map<String,String> additionalProperties, VisualStyle visualStyle)
      Create a node in the mermaid graph.
      Parameters:
      currentNodeName - unique name/identifier
      currentDisplayName - display name
      currentType - type of element
      additionalProperties - additional properties to add to the node
      visualStyle - mermaid defined shape and colour value
      Returns:
      whether a new node was created or not.
    • appendMermaidThinLine

      public void appendMermaidThinLine(String lineName, String end1Id, String label, String end2Id)
      Append a new single pixel width line to the graph.
      Parameters:
      lineName - unique identifier of the line - may be null
      end1Id - identifier of the starting end
      label - label for the line
      end2Id - identifier of the ending end
    • appendMermaidDottedLine

      public void appendMermaidDottedLine(String lineName, String end1Id, String label, String end2Id)
      Append a new single pixel width line to the graph.
      Parameters:
      lineName - unique identifier of the line - may be null
      end1Id - identifier of the starting end
      label - label for the line
      end2Id - identifier of the ending end
    • appendMermaidLine

      public void appendMermaidLine(String lineName, String end1Id, String label, String end2Id)
      Append a line to the graph.
      Parameters:
      lineName - unique identifier of the line - may be null
      end1Id - identifier of the starting end
      label - label for the line
      end2Id - identifier of the ending end
    • appendInvisibleMermaidLine

      public void appendInvisibleMermaidLine(String end1Id, String end2Id)
      Append an invisible line to the graph. This is used to line up descriptions etc
      Parameters:
      end1Id - identifier of the starting end
      end2Id - identifier of the ending end
    • addStyles

      protected void addStyles(Map<String,VisualStyle> nodeColours)
      Add styling for nodes as requested. These go at the end of the graph.
    • getNodeDisplayName

      protected String getNodeDisplayName(MetadataElementSummary metadataElementSummary)
    • addSolutionComponentToGraph

      protected void addSolutionComponentToGraph(String parentNodeName, String parentLinkLabel, SolutionComponentElement solutionComponentElement, List<String> solutionLinkingWireGUIDs, boolean fullDisplay)
      Add a solution component to graph.
      Parameters:
      parentNodeName - identifier of the parent node (maybe null)
      parentLinkLabel - add label to parent link - also optional
      solutionComponentElement - element to process
      solutionLinkingWireGUIDs - list of solution wires already defined
      fullDisplay - print all elements
    • getMermaidGraph

      public String getMermaidGraph(boolean allAnchors)
      Add anchors, any style requests and return the built mermaid graph.
      Parameters:
      allAnchors - should all anchors be added - or just those to known nodes?
      Returns:
      string markdown
    • getMermaidGraph

      public String getMermaidGraph()
      Add any style requests and return the built mermaid graph.
      Returns:
      string markdown