コード例 #1
0
		internal static IResolvedAction GetIResolvedAction(PolicyResponseObject pro, Workshare.PolicyContent.ResolvedAction raIn)
		{
			Workshare.Policy.Engine.ResolvedAction raOut = new Workshare.Policy.Engine.ResolvedAction();

			raOut.Sequence = raIn.Sequence;

			raOut.ContentCollection = new Collection<IContentItem>();
			if (raIn.Contents != null)
			{
				foreach (Workshare.PolicyContent.ContentItem item in raIn.Contents)
				{
					Workshare.Policy.Engine.ContentItem proItem = null;
					foreach (Workshare.Policy.Engine.ContentItem ci in pro.ContentCollection)
					{
						if (ci.File.ContentId == item.Id)
							proItem = ci;
					}
					if (proItem != null)
						raOut.ContentCollection.Add(proItem);
				}
			}

			raOut.ResponseAction = ActionAdaptor.GetIPolicyResponseAction(raIn.Action);

			return raOut;
		}
コード例 #2
0
ファイル: ActionExecuter.cs プロジェクト: killbug2004/WSProf
		/// <summary>
		/// This method searches for an Action corresponding to
		///     a) the required ResolvedAction <paramref name="resAction"/>
		///     b) the required ContentItem within <paramref name="item"/>
		/// 
		/// When given a flat list of ResolvedAction items, we need to find the corresponding action in the heirarchy beneath the 
		/// ContentItems, in order to use the properties that are specific to that Content.
		/// </summary>
		/// <param name="pro"> </param>
		/// <param name="item"></param>
		/// <param name="resAction"></param>
		/// <param name="folderAction"> </param>
		/// <returns></returns>
		private static PolicyResponseAction FindContentAction(PolicyResponseObject pro, ActionData item, ResolvedAction resAction, bool folderAction)
		{
			List<IContentItem> contents = new List<IContentItem>(resAction.ContentCollection);
			IContentItem content;
			if (!folderAction)
			{
				content = contents.Find(delegate(IContentItem temp)
				{
					return ((ContentItem) (temp)).File.ContentId == item.Underworld.ContentId;
				});
			}
			else
			{
				content = contents[0];
			}

			PolicyResponseAction pra = null;
			pra = GetActionOfTypeFromContentItem(pro, content, resAction.ResponseAction.Type);

			if (pra == null)
				Debug.Assert(false, "Should not get here - unless the ResolvedAction and the ActionData params were not related in the first place");

			return pra;
		}