Package org.bidib.wizard.utils
Class NodeUtils
- java.lang.Object
-
- org.bidib.wizard.utils.NodeUtils
-
public class NodeUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringIMPORT_ERRORS
-
Constructor Summary
Constructors Constructor Description NodeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddImportError(Map<String,Object> params, String message)static org.bidib.wizard.api.model.NodeInterfaceconfigureFromBiDiB(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.BiDiBconvertToBiDiB(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.NodeInterfacefindNodeByUuid(Iterable<org.bidib.wizard.api.model.NodeInterface> nodes, long uuid)Find a node by its node uuid in the provided list of nodes.static CvDefinitionTreeTableModelgetCvDefinitionTreeTableModel(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<?>>
PgetPort(List<P> ports, int portNumber, boolean sourceIsFlatPortModel, boolean targetIsFlatPortModel)static voidloadDataFromNode(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.MacroloadMacroContentFromNode(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 StringprepareLabel(org.bidib.wizard.api.model.NodeInterface node)Prepare the node label based on the user string with fallback to node.toString().static voidsetCurrentPortType(org.bidib.wizard.model.ports.GenericPort genericPort, org.bidib.jbidibc.messages.enums.LcOutputType portType)
-
-
-
Field Detail
-
IMPORT_ERRORS
public static final String IMPORT_ERRORS
- See Also:
- Constant Field Values
-
-
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 nodesuuid- the uuid of the node to find- Returns:
- the found node or
nullif 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 nodebidib- 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 idnodeService- the node serviceswitchingNodeService- the switching node servicenode- the nodeloadMacroContent- load macro content from nodeloadCvs- 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)
-
-