/// <summary cref="NodeSource.CreateNode" /> protected override void CreateNode(NodeId parentId, NodeId referenceTypeId) { CheckNodeManagerState(); ObjectTypeAttributes attributes = new ObjectTypeAttributes(); attributes.SpecifiedAttributes = (uint)NodeAttributesMask.DisplayName; attributes.DisplayName = DisplayName; NodeManager.CreateObjectType( parentId, NodeId, BrowseName, attributes); }
public NodeId CreateObjectType( NodeId parentId, NodeId nodeId, QualifiedName browseName, ObjectTypeAttributes attributes) { return null; }
/// <summary> /// Creates an ObjectType node in the address space. /// </summary> public NodeId CreateObjectType( NodeId parentId, NodeId nodeId, QualifiedName browseName, ObjectTypeAttributes attributes) { try { m_lock.Enter(); // validate browse name. if (QualifiedName.IsNull(browseName)) { throw ServiceResultException.Create(StatusCodes.BadBrowseNameInvalid, "BrowseName must not be empty."); } // check for null node id. if (NodeId.IsNull(nodeId)) { nodeId = CreateUniqueNodeId(); } // check if node id exists. if (m_nodes.Exists(nodeId)) { throw ServiceResultException.Create(StatusCodes.BadNodeIdExists, "NodeId '{0}' already exists.", nodeId); } // set the BaseObjectType as the default. if (parentId == null) { parentId = ObjectTypes.BaseObjectType; } // find parent. IObjectType parent = GetManagerHandle(parentId) as IObjectType; if (parent == null) { throw ServiceResultException.Create(StatusCodes.BadParentNodeIdInvalid, "Parent node '{0}' does not exist or is not an ObjectType.", parentId); } // validate reference. ValidateReference(parent, ReferenceTypeIds.HasSubtype, false, NodeClass.ObjectType); // create node. ObjectTypeNode node = new ObjectTypeNode(); node.NodeId = nodeId; node.NodeClass = NodeClass.ObjectType; node.BrowseName = browseName; UpdateAttributes(node, attributes); // IsAbstract if (attributes != null && (attributes.SpecifiedAttributes & (uint)NodeAttributesMask.IsAbstract) != 0) { node.IsAbstract = attributes.IsAbstract; } else { node.IsAbstract = false; } // add reference from parent. AddReference(parent, ReferenceTypeIds.HasSubtype, false, node, true); // add the node. AddNode(node); // return the new node id. return node.NodeId; } finally { m_lock.Exit(); } }