public TreeViewLocation(TreeViewLocation parent, WBRecordsManager manager, string mode, string minimumProtectiveZone, WBDocument masterRecord) { _type = LOCATION_TYPE__DOCUMENT; _parent = parent; _manager = manager; _mode = mode; _minimumProtectiveZone = minimumProtectiveZone; _masterRecord = masterRecord; _name = _masterRecord.Name; _guidString = _masterRecord.Item.ID.ToString(); }
public TreeViewLocation(TreeViewLocation parent, WBRecordsManager manager, string mode, string minimumProtectiveZone, SPFolder folder) { _type = LOCATION_TYPE__FOLDER; _parent = parent; _manager = manager; _mode = mode; _minimumProtectiveZone = minimumProtectiveZone; _folder = folder; _name = _folder.Name; _guidString = _folder.Item.ID.ToString(); }
/// <summary> /// Public constructor /// </summary> /// <param name="term">The underlying Term object that is being wrapped</param> public TreeViewLocation(TreeViewLocation parent, WBRecordsManager manager, string mode, string minimumProtectiveZone, WBTerm functionalArea) { _type = LOCATION_TYPE__FUNCTIONAL_AREA; _parent = parent; _manager = manager; _mode = mode; _minimumProtectiveZone = minimumProtectiveZone; _functionalArea = functionalArea; _name = functionalArea.Name; _guidString = functionalArea.Id.ToString(); if (_mode != VIEW_MODE__NEW) { _folder = manager.Libraries.GetMasterFolderByPath(functionalArea.Name); } }
public TreeViewLocation(TreeViewLocation parent, WBRecordsManager manager, string mode, string minimumProtectiveZone, WBTerm functionalArea, WBRecordsType recordsType) { _type = LOCATION_TYPE__RECORDS_TYPE; _parent = parent; _manager = manager; _mode = mode; _minimumProtectiveZone = minimumProtectiveZone; _functionalArea = functionalArea; _recordsType = recordsType; _name = _recordsType.Name; _guidString = _recordsType.Id.ToString(); if (_mode != VIEW_MODE__NEW) { _folder = _parent._folder.WBxGetSubFolder(recordsType.Name); if (_folder == null) { WBLogging.Debug("Did not find folder for: " + recordsType.Name); } } }
public IHierarchicalEnumerable GetChildren() { if (_children == null) { _children = new TreeViewLocationCollection(); switch (_type) { case LOCATION_TYPE__FUNCTIONAL_AREA: { WBLogging.Debug("In GetChildren() for type Functional Area"); WBTaxonomy recordsTypes = _manager.RecordsTypesTaxonomy; TermCollection terms = recordsTypes.TermSet.Terms; foreach (Term childTerm in terms) { WBRecordsType recordsType = new WBRecordsType(recordsTypes, childTerm); bool protectiveZoneOK = true; //if (!String.IsNullOrEmpty(_minimumProtectiveZone)) //{ // protectiveZoneOK = (recordsType.IsZoneAtLeastMinimum(_minimumProtectiveZone)); // } if (recordsType.BranchCanHaveDocuments() && recordsType.IsRelevantToFunctionalArea(_functionalArea) && protectiveZoneOK) { TreeViewLocation newLocation = new TreeViewLocation(this, _manager, _mode, _minimumProtectiveZone, _functionalArea, recordsType); // If we're looking for existing records then we'll only add this location if it has a real folder existing underneath it: if (_mode == VIEW_MODE__NEW || newLocation._folder != null) { _children.Add(newLocation); } } else { WBLogging.Debug("In GetChildren() excluded " + recordsType.Name + " because " + recordsType.BranchCanHaveDocuments() + " && " + protectiveZoneOK); } } break; } case LOCATION_TYPE__RECORDS_TYPE: { WBLogging.Debug("In GetChildren() for type Records Type"); WBTaxonomy recordsTypes = _manager.RecordsTypesTaxonomy; TermCollection terms = _recordsType.Term.Terms; if (terms.Count > 0) { foreach (Term childTerm in terms) { WBRecordsType recordsType = new WBRecordsType(recordsTypes, childTerm); bool protectiveZoneOK = true; if (!String.IsNullOrEmpty(_minimumProtectiveZone)) { protectiveZoneOK = (recordsType.IsZoneAtLeastMinimum(_minimumProtectiveZone)); } if (recordsType.BranchCanHaveDocuments() && recordsType.IsRelevantToFunctionalArea(_functionalArea) && protectiveZoneOK) { TreeViewLocation newLocation = new TreeViewLocation(this, _manager, _mode, _minimumProtectiveZone, _functionalArea, recordsType); // If we're looking for existing records then we'll only add this location if it has a real folder existing underneath it: if (_mode == VIEW_MODE__NEW || newLocation._folder != null) { _children.Add(newLocation); } } } } else { if (_mode != VIEW_MODE__NEW) { // WBLogging.Debug("In view mode replace switching to folders part of tree"); string fullClassPath = WBUtils.NormalisePath(Path); // WBLogging.Debug("Looking for starting folder = " + fullClassPath); SPFolder protectedLibraryRootFolder = _manager.Libraries.ProtectedMasterLibrary.List.RootFolder; // WBLogging.Debug("Got library root folder"); SPFolder recordsTypeFolder = protectedLibraryRootFolder.WBxGetFolderPath(fullClassPath); // WBLogging.Debug("Got records type folder - definitely changed .. " + recordsTypeFolder); if (recordsTypeFolder != null) { foreach (SPFolder child in recordsTypeFolder.SubFolders) { _children.Add(new TreeViewLocation(this, _manager, _mode, _minimumProtectiveZone, child)); } } else { WBLogging.Debug("The master library doesn't have a folder with path: " + fullClassPath); } // WBLogging.Debug("Added children folders"); } } break; } case LOCATION_TYPE__FOLDER: { WBLogging.Debug("In GetChildren() for type Folder"); if (_folder.SubFolders.Count > 0) { foreach (SPFolder child in _folder.SubFolders) { _children.Add(new TreeViewLocation(this, _manager, _mode, _minimumProtectiveZone, child)); } } else { if (_mode == VIEW_MODE__REPLACE) { SPListItemCollection items = GetItemsRecursive(_folder); foreach (SPListItem item in items) { if (ItemCanBePicked(item)) { _children.Add(new TreeViewLocation(this, _manager, _mode, _minimumProtectiveZone, new WBDocument(_manager.Libraries.ProtectedMasterLibrary, item))); } } } } break; } case LOCATION_TYPE__DOCUMENT: { WBLogging.Debug("In GetChildren() for type Document"); break; } } } return(_children); }