Example #1
0
		private Set<int> GetDescendents(int hvoCommonAncestor, int relativesFlid)
		{
			string listPropertyName = Cache.MetaDataCacheAccessor.GetFieldName((uint)relativesFlid);
			string parentObjName = Cache.MetaDataCacheAccessor.GetClassName((uint)m_cache.GetClassOfObject(hvoCommonAncestor));
			string xpathToPart = "./part[@id='" + parentObjName + "-Jt-" + listPropertyName + "']";
			XmlNode pathSpec = m_parentToChildrenSpecs.SelectSingleNode(xpathToPart);
			if (pathSpec == null)
				throw new ArgumentException("Expected to find part ({0}) in ParentClassPathsToChildren", xpathToPart);
			// get the part spec that gives us the path from obsolete current (parent) list item object
			// to the new one.
			using (XmlBrowseViewBaseVc vc = new XmlBrowseViewBaseVc(m_cache, null))
			{
				ManyOnePathSortItem parentItem = new ManyOnePathSortItem(hvoCommonAncestor, null, null);
				XmlBrowseViewBaseVc.ItemsCollectorEnv collector =
					new XmlBrowseViewBaseVc.ItemsCollectorEnv(null, m_cache, hvoCommonAncestor);
				vc.DisplayCell(parentItem, pathSpec, hvoCommonAncestor, collector);
				if (collector.HvosCollectedInCell != null && collector.HvosCollectedInCell.Count > 0)
				{
				   return collector.HvosCollectedInCell;
				}
			}
			return new Set<int>();
		}
Example #2
0
		/// <summary>
		/// return all the hvos for this column in the row identified by the sort item.
		/// </summary>
		/// <param name="rowItem"></param>
		/// <returns></returns>
		protected override int[] GetItems(ManyOnePathSortItem rowItem)
		{
			int hvoRootObj = rowItem.RootObject.Hvo;
			XmlBrowseViewBaseVc.ItemsCollectorEnv collector =
				new XmlBrowseViewBaseVc.ItemsCollectorEnv(null, m_cache, hvoRootObj);
			if (Vc != null && m_colSpec != null)
				this.Vc.DisplayCell(rowItem, m_colSpec, hvoRootObj, collector);
			return collector.HvosCollectedInCell.ToArray();
		}
Example #3
0
		private Set<int> GetDescendents(int hvoCommonAncestor, int relativesFlid)
		{
			string listPropertyName = Cache.MetaDataCacheAccessor.GetFieldName(relativesFlid);
			string parentObjName = Cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(hvoCommonAncestor).ClassName;
			string xpathToPart = "./part[@id='" + parentObjName + "-Jt-" + listPropertyName + "']";
			XmlNode pathSpec = m_parentToChildrenSpecs.SelectSingleNode(xpathToPart);
			Debug.Assert(pathSpec != null,
				String.Format("You are experiencing a rare and difficult-to-reproduce error (LT- 11443 and linked issues). If you can add any information to the issue or fix it please do. If JohnT is available please call him over. Expected to find part ({0}) in ParentClassPathsToChildren", xpathToPart));
			if (pathSpec == null)
				return new Set<int>(); // This just means we don't find a related object. Better than crashing, but not what we intend.
			// get the part spec that gives us the path from obsolete current (parent) list item object
			// to the new one.
			var vc = new XmlBrowseViewBaseVc(m_cache, null);
			var parentItem = new ManyOnePathSortItem(hvoCommonAncestor, null, null);
			var collector = new XmlBrowseViewBaseVc.ItemsCollectorEnv(null, m_cache, hvoCommonAncestor);
			vc.DisplayCell(parentItem, pathSpec, hvoCommonAncestor, collector);
			if (collector.HvosCollectedInCell != null && collector.HvosCollectedInCell.Count > 0)
			{
				return collector.HvosCollectedInCell;
			}
			return new Set<int>();
		}