IsRequired() публичный Метод

Returns true if the reference type is required.
public IsRequired ( Opc.Ua.NodeId referenceType, bool isInverse ) : bool
referenceType Opc.Ua.NodeId
isInverse bool
Результат bool
Пример #1
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            if (!NodeId.IsNull(m_typeDefinitionId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasTypeDefinition, false))
                {
                    browser.Add(ReferenceTypeIds.HasTypeDefinition, false, m_typeDefinitionId);
                }
            }

            if (!NodeId.IsNull(m_modellingRuleId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasModellingRule, false))
                {
                    browser.Add(ReferenceTypeIds.HasModellingRule, false, m_modellingRuleId);
                }
            }

            if (m_parent != null)
            {
                if (!NodeId.IsNull(m_referenceTypeId))
                {
                    if (browser.IsRequired(m_referenceTypeId, true))
                    {
                        browser.Add(m_referenceTypeId, true, m_parent);
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the current operation.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            if (!NodeId.IsNull(m_superTypeId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasSubtype, true))
                {
                    browser.Add(ReferenceTypeIds.HasSubtype, true, m_superTypeId);
                }
            }

            // use the type table to find the subtypes.
            if (context.TypeTable != null && this.NodeId != null)
            {
                if (browser.IsRequired(ReferenceTypeIds.HasSubtype, false))
                {
                    IList <NodeId> subtypeIds = context.TypeTable.FindSubTypes(this.NodeId);

                    for (int ii = 0; ii < subtypeIds.Count; ii++)
                    {
                        browser.Add(ReferenceTypeIds.HasSubtype, false, subtypeIds[ii]);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            if (!NodeId.IsNull(m_typeDefinitionId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasTypeDefinition, false))
                {
                    browser.Add(ReferenceTypeIds.HasTypeDefinition, false, m_typeDefinitionId);
                }
            }

            if (!NodeId.IsNull(m_modellingRuleId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasModellingRule, false))
                {
                    browser.Add(ReferenceTypeIds.HasModellingRule, false, m_modellingRuleId);
                }
            }

            if (m_parent != null)
            {
                if (!NodeId.IsNull(m_referenceTypeId))
                {
                    if (browser.IsRequired(m_referenceTypeId, true))
                    {
                        browser.Add(m_referenceTypeId, true, m_parent);
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            // check if the parent segments need to be returned.
            if (browser.IsRequired(ReferenceTypeIds.Organizes, true))
            {
                UnderlyingSystem system = context.SystemHandle as UnderlyingSystem;

                if (system == null)
                {
                    return;
                }

                // add reference for each segment.
                IList<UnderlyingSystemSegment> segments = system.FindSegmentsForBlock(m_blockId);

                for (int ii = 0; ii < segments.Count; ii++)
                {
                    browser.Add(ReferenceTypeIds.Organizes, true, ModelUtils.ConstructIdForSegment(segments[ii].Id, this.NodeId.NamespaceIndex));
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the system being accessed.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            // check if the parent segments need to be returned.
            if (browser.IsRequired(ReferenceTypeIds.Organizes, true))
            {
                UnderlyingSystem system = context.SystemHandle as UnderlyingSystem;

                if (system == null)
                {
                    return;
                }

                // add reference for parent segment.
                UnderlyingSystemSegment segment = system.FindParentForSegment(m_segmentPath);

                if (segment != null)
                {
                    browser.Add(ReferenceTypeIds.Organizes, true, ModelUtils.ConstructIdForSegment(segment.Id, this.NodeId.NamespaceIndex));
                }
            }
        }
Пример #6
0
        /// <summary>
        /// Populates the browser with references that meet the criteria.
        /// </summary>
        /// <param name="context">The context for the current operation.</param>
        /// <param name="browser">The browser to populate.</param>
        protected override void PopulateBrowser(ISystemContext context, NodeBrowser browser)
        {
            base.PopulateBrowser(context, browser);

            if (!NodeId.IsNull(m_superTypeId))
            {
                if (browser.IsRequired(ReferenceTypeIds.HasSubtype, true))
                {
                    browser.Add(ReferenceTypeIds.HasSubtype, true, m_superTypeId);
                }
            }

            // use the type table to find the subtypes.
            if (context.TypeTable != null && this.NodeId != null)
            {
                if (browser.IsRequired(ReferenceTypeIds.HasSubtype, false))
                {
                    IList<NodeId> subtypeIds = context.TypeTable.FindSubTypes(this.NodeId);

                    for (int ii = 0; ii < subtypeIds.Count; ii++)
                    {
                        browser.Add(ReferenceTypeIds.HasSubtype, false, subtypeIds[ii]);
                    }
                }
            }
        }
Пример #7
0
        /// <summary>
        /// Used to receive notifications when a node is browsed.
        /// </summary>
        public void OnPopulateBrowser(
            ISystemContext context,
            NodeState node,
            NodeBrowser browser)
        {
            ParsedNodeId nodeId = ParsedNodeId.Parse(node.NodeId);
            DirectoryInfo info = new DirectoryInfo(nodeId.RootId);

            if (!info.Exists)
            {
                return;
            }

            if (browser.IsRequired(ReferenceTypeIds.Organizes, false))
            {
                foreach (DirectoryInfo child in info.GetDirectories())
                {
                    ParsedNodeId childId = new ParsedNodeId();
                    childId.RootType = 0;
                    childId.RootId = child.FullName;
                    childId.NamespaceIndex = NamespaceIndex;

                    browser.Add(new NodeStateReference(ReferenceTypeIds.Organizes, false, childId.Construct()));
                }
            }

            if (browser.IsRequired(ReferenceTypeIds.Organizes, true))
            {
                ParsedNodeId parentId = new ParsedNodeId();
                parentId.RootType = 0;
                parentId.RootId = info.Parent.FullName;
                parentId.NamespaceIndex = NamespaceIndex;

                browser.Add(new NodeStateReference(ReferenceTypeIds.Organizes, true, parentId.Construct()));
            }
        }