Class NodeUtils


  • public class NodeUtils
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addImportError​(Map<String,​Object> params, String message)  
      static org.bidib.wizard.api.model.NodeInterface configureFromBiDiB​(String connectionId, NodeService nodeService, org.bidib.wizard.api.service.node.SwitchingNodeService switchingNodeService, CvDefinitionTreeModelRegistry cvDefinitionTreeModelRegistry, org.bidib.wizard.api.model.NodeInterface node, Map<String,​Object> importParams, org.bidib.jbidibc.core.schema.bidib2.BiDiB bidib, org.bidib.wizard.common.labels.WizardLabelWrapper wizardLabelWrapper, boolean restoreCVs, boolean restoreFeatures, boolean restoreNodeString, boolean restoreMacroContent, boolean restoreAccessoryContent)
      Configure the node from the provided BiDiB data.
      static org.bidib.jbidibc.core.schema.bidib2.BiDiB convertToBiDiB​(org.bidib.wizard.api.model.NodeInterface node, Map<String,​CvNode> cvNumberToNodeMap, String lang, boolean skipCvValues, org.bidib.wizard.common.labels.WizardLabelWrapper wizardLabelWrapper)
      Convert the node to BiDiB data.
      static org.bidib.wizard.api.model.NodeInterface findNodeByUuid​(Iterable<org.bidib.wizard.api.model.NodeInterface> nodes, long uuid)
      Find a node by its node uuid in the provided list of nodes.
      static CvDefinitionTreeTableModel getCvDefinitionTreeTableModel​(org.bidib.wizard.api.model.NodeInterface node, org.bidib.wizard.api.context.ApplicationContext context)  
      static Map<String,​CvNode> getCvNumberToNodeMap​(org.bidib.wizard.api.model.NodeInterface node, org.bidib.wizard.api.context.ApplicationContext context)  
      static <P extends org.bidib.wizard.model.ports.Port<?>>
      P
      getPort​(List<P> ports, int portNumber, boolean sourceIsFlatPortModel, boolean targetIsFlatPortModel)  
      static void loadDataFromNode​(String connectionId, NodeService nodeService, org.bidib.wizard.api.service.node.SwitchingNodeService switchingNodeService, org.bidib.wizard.api.model.NodeInterface node, boolean loadMacroContent, boolean loadCvs)
      Load data from node.
      static org.bidib.wizard.api.model.Macro loadMacroContentFromNode​(String connectionId, NodeService nodeService, org.bidib.wizard.api.service.node.SwitchingNodeService switchingNodeService, org.bidib.wizard.api.model.NodeInterface node, org.bidib.wizard.api.model.Macro macro)  
      static String prepareLabel​(org.bidib.wizard.api.model.NodeInterface node)
      Prepare the node label based on the user string with fallback to node.toString().
      static void setCurrentPortType​(org.bidib.wizard.model.ports.GenericPort genericPort, org.bidib.jbidibc.messages.enums.LcOutputType portType)  
    • Constructor Detail

      • NodeUtils

        public NodeUtils()
    • Method Detail

      • findNodeByUuid

        public static org.bidib.wizard.api.model.NodeInterface findNodeByUuid​(Iterable<org.bidib.wizard.api.model.NodeInterface> nodes,
                                                                              long uuid)
        Find a node by its node uuid in the provided list of nodes.
        Parameters:
        nodes - the list of nodes
        uuid - the uuid of the node to find
        Returns:
        the found node or null if no node was found with the provided node uuid
      • prepareLabel

        public static String prepareLabel​(org.bidib.wizard.api.model.NodeInterface node)
        Prepare the node label based on the user string with fallback to node.toString().
        Parameters:
        node - the node
        Returns:
        the node label
      • configureFromBiDiB

        public static org.bidib.wizard.api.model.NodeInterface configureFromBiDiB​(String connectionId,
                                                                                  NodeService nodeService,
                                                                                  org.bidib.wizard.api.service.node.SwitchingNodeService switchingNodeService,
                                                                                  CvDefinitionTreeModelRegistry cvDefinitionTreeModelRegistry,
                                                                                  org.bidib.wizard.api.model.NodeInterface node,
                                                                                  Map<String,​Object> importParams,
                                                                                  org.bidib.jbidibc.core.schema.bidib2.BiDiB bidib,
                                                                                  org.bidib.wizard.common.labels.WizardLabelWrapper wizardLabelWrapper,
                                                                                  boolean restoreCVs,
                                                                                  boolean restoreFeatures,
                                                                                  boolean restoreNodeString,
                                                                                  boolean restoreMacroContent,
                                                                                  boolean restoreAccessoryContent)
        Configure the node from the provided BiDiB data.
        Parameters:
        node - the node
        bidib - the BiDiB data
        Returns:
        the configured node
      • setCurrentPortType

        public static void setCurrentPortType​(org.bidib.wizard.model.ports.GenericPort genericPort,
                                              org.bidib.jbidibc.messages.enums.LcOutputType portType)
      • convertToBiDiB

        public static org.bidib.jbidibc.core.schema.bidib2.BiDiB convertToBiDiB​(org.bidib.wizard.api.model.NodeInterface node,
                                                                                Map<String,​CvNode> cvNumberToNodeMap,
                                                                                String lang,
                                                                                boolean skipCvValues,
                                                                                org.bidib.wizard.common.labels.WizardLabelWrapper wizardLabelWrapper)
        Convert the node to BiDiB data.
        Parameters:
        node - the node
        Returns:
        the BiDiB data
      • getPort

        public static <P extends org.bidib.wizard.model.ports.Port<?>> P getPort​(List<P> ports,
                                                                                 int portNumber,
                                                                                 boolean sourceIsFlatPortModel,
                                                                                 boolean targetIsFlatPortModel)
      • getCvNumberToNodeMap

        public static Map<String,​CvNode> getCvNumberToNodeMap​(org.bidib.wizard.api.model.NodeInterface node,
                                                                    org.bidib.wizard.api.context.ApplicationContext context)
      • getCvDefinitionTreeTableModel

        public static CvDefinitionTreeTableModel getCvDefinitionTreeTableModel​(org.bidib.wizard.api.model.NodeInterface node,
                                                                               org.bidib.wizard.api.context.ApplicationContext context)
      • loadDataFromNode

        public static void loadDataFromNode​(String connectionId,
                                            NodeService nodeService,
                                            org.bidib.wizard.api.service.node.SwitchingNodeService switchingNodeService,
                                            org.bidib.wizard.api.model.NodeInterface node,
                                            boolean loadMacroContent,
                                            boolean loadCvs)
        Load data from node.
        Parameters:
        connectionId - the connection id
        nodeService - the node service
        switchingNodeService - the switching node service
        node - the node
        loadMacroContent - load macro content from node
        loadCvs - load CVs from node
      • loadMacroContentFromNode

        public static org.bidib.wizard.api.model.Macro loadMacroContentFromNode​(String connectionId,
                                                                                NodeService nodeService,
                                                                                org.bidib.wizard.api.service.node.SwitchingNodeService switchingNodeService,
                                                                                org.bidib.wizard.api.model.NodeInterface node,
                                                                                org.bidib.wizard.api.model.Macro macro)