/// <summary> /// Creates a new browser object with a set of filters. /// </summary> /// <param name="context">The system context to use.</param> /// <param name="view">The view which may restrict the set of references/nodes found.</param> /// <param name="referenceType">The type of references being followed.</param> /// <param name="includeSubtypes">Whether subtypes of the reference type are followed.</param> /// <param name="browseDirection">Which way the references are being followed.</param> /// <param name="browseName">The browse name of a specific target (used when translating browse paths).</param> /// <param name="additionalReferences">Any additional references that should be included.</param> /// <param name="internalOnly">If true the browser should not making blocking calls to external systems.</param> /// <param name="source">The segment being accessed.</param> public ArchiveFolderBrowser( ISystemContext context, ViewDescription view, NodeId referenceType, bool includeSubtypes, BrowseDirection browseDirection, QualifiedName browseName, IEnumerable <IReference> additionalReferences, bool internalOnly, ArchiveFolderState source) : base( context, view, referenceType, includeSubtypes, browseDirection, browseName, additionalReferences, internalOnly) { m_source = source; m_stage = Stage.Begin; }
/// <summary> /// Creates a new browser object with a set of filters. /// </summary> /// <param name="context">The system context to use.</param> /// <param name="view">The view which may restrict the set of references/nodes found.</param> /// <param name="referenceType">The type of references being followed.</param> /// <param name="includeSubtypes">Whether subtypes of the reference type are followed.</param> /// <param name="browseDirection">Which way the references are being followed.</param> /// <param name="browseName">The browse name of a specific target (used when translating browse paths).</param> /// <param name="additionalReferences">Any additional references that should be included.</param> /// <param name="internalOnly">If true the browser should not making blocking calls to external systems.</param> /// <param name="source">The segment being accessed.</param> public ArchiveFolderBrowser( ISystemContext context, ViewDescription view, NodeId referenceType, bool includeSubtypes, BrowseDirection browseDirection, QualifiedName browseName, IEnumerable<IReference> additionalReferences, bool internalOnly, ArchiveFolderState source) : base( context, view, referenceType, includeSubtypes, browseDirection, browseName, additionalReferences, internalOnly) { m_source = source; m_stage = Stage.Begin; }
/// <summary> /// Returns the next child. /// </summary> private IReference NextChild() { UnderlyingSystem system = (UnderlyingSystem)this.SystemContext.SystemHandle; NodeId targetId = null; // check if a specific browse name is requested. if (!QualifiedName.IsNull(base.BrowseName)) { // check if match found previously. if (m_position == Int32.MaxValue) { return(null); } // browse name must be qualified by the correct namespace. if (m_source.BrowseName.NamespaceIndex != base.BrowseName.NamespaceIndex) { return(null); } // look for matching folder. if (m_stage == Stage.Folders && m_folders != null) { for (int ii = 0; ii < m_folders.Length; ii++) { if (base.BrowseName.Name == m_folders[ii].Name) { targetId = ArchiveFolderState.ConstructId(m_folders[ii].UniquePath, m_source.NodeId.NamespaceIndex); break; } } } // look for matching item. else if (m_stage == Stage.Items && m_items != null) { for (int ii = 0; ii < m_items.Length; ii++) { if (base.BrowseName.Name == m_items[ii].Name) { targetId = ArchiveItemState.ConstructId(m_items[ii].UniquePath, m_source.NodeId.NamespaceIndex); break; } } } // look for matching parent. else if (m_stage == Stage.Parents) { ArchiveFolder parent = m_source.ArchiveFolder.GetParentFolder(); if (base.BrowseName.Name == parent.Name) { targetId = ArchiveFolderState.ConstructId(parent.UniquePath, m_source.NodeId.NamespaceIndex); } } m_position = Int32.MaxValue; } // return the child at the next position. else { // look for next folder. if (m_stage == Stage.Folders && m_folders != null) { if (m_position >= m_folders.Length) { return(null); } targetId = ArchiveFolderState.ConstructId(m_folders[m_position++].UniquePath, m_source.NodeId.NamespaceIndex); } // look for next item. else if (m_stage == Stage.Items && m_items != null) { if (m_position >= m_items.Length) { return(null); } targetId = ArchiveItemState.ConstructId(m_items[m_position++].UniquePath, m_source.NodeId.NamespaceIndex); } // look for matching parent. else if (m_stage == Stage.Parents) { ArchiveFolder parent = m_source.ArchiveFolder.GetParentFolder(); if (parent != null) { targetId = ArchiveFolderState.ConstructId(parent.UniquePath, m_source.NodeId.NamespaceIndex); } } } // create reference. if (targetId != null) { return(new NodeStateReference(ReferenceTypeIds.Organizes, false, targetId)); } return(null); }