コード例 #1
0
		internal static PolicySet GetPolicySet(IPolicySetResponse psr)
		{
			if (null == psr)
				throw new ArgumentNullException("psr");

			PolicySet policySet = new PolicySet();

			policySet.Name = psr.Name;
			policySet.Date = psr.Date;

			policySet.Properties = new CustomProperty[0];
			int index = 0;
			if (psr.Properties != null && psr.Properties.Count > 0)
			{
				policySet.Properties = new CustomProperty[psr.Properties.Count];
				foreach (string key in psr.Properties.Keys)
				{
					policySet.Properties[index++] = new CustomProperty(key, psr.Properties[key]);
				}
			}

			policySet.Policies = new Workshare.PolicyContent.Policy[0];
			if (psr.PolicyReportCollection != null && psr.PolicyReportCollection.Count > 0)
			{
				policySet.Policies = new Workshare.PolicyContent.Policy[psr.PolicyReportCollection.Count];
				index = 0;
				foreach (IPolicyResponse response in psr.PolicyReportCollection)
				{
					policySet.Policies[index++] = PolicyAdaptor.GetPolicy(response);
				}
			}

			return policySet;
		}
コード例 #2
0
		/// <summary>
		/// Asserts the data in the PolicySetResponse object for ComplexPolicySet
		/// </summary>
		/// <param name="policySetResponse">The policy set response object to evaluate</param>
		/// <param name="dateLowerBound">lower bound of Date property</param>
		/// <param name="dateUpperBound">upper bound of Date property</param>
		private void AssertPolicySetResponse_ComplexPolicySet(IPolicySetResponse policySetResponse, DateTime dateLowerBound, DateTime dateUpperBound)
		{
			Assert.AreEqual("Test PRO Policy Set", policySetResponse.Name, "Incorrect name on policy set response");
			Assert.IsTrue((dateLowerBound <= policySetResponse.Date) && (dateUpperBound >= policySetResponse.Date), "incorrect Date on policy set response");
			Assert.AreEqual(0, policySetResponse.Properties.Count, "Incorrect number of properties on policy set response");
			Assert.AreEqual(5, policySetResponse.PolicyReportCollection.Count, "Incorrect number of policies on policy set response");
		}
コード例 #3
0
ファイル: PolicyEngine.cs プロジェクト: killbug2004/WSProf
 /// <summary>
 /// </summary>
 public bool ProcessExceptionAction(IContentItem file, IPolicySetResponse policySetInfo)
 {
     return m_GeneralPolicyProcessor.ProcessExceptionAction(file, policySetInfo);
 }
コード例 #4
0
ファイル: PolicyEngine.cs プロジェクト: killbug2004/WSProf
 /// <summary>
 /// </summary>
 public void ProcessActionInfo(IContentItem file, IPolicySetResponse policySetInfo)
 {
     m_GeneralPolicyProcessor.ProcessAction(file, policySetInfo);
 }
コード例 #5
0
ファイル: PolicyEngine.cs プロジェクト: killbug2004/WSProf
 /// <summary>
 /// </summary>
 public void ProcessRoutingInfo(IContentItem file, IPolicySetResponse policySetInfo)
 {
     m_GeneralPolicyProcessor.ProcessRouting(file, policySetInfo);
 }
コード例 #6
0
		public bool ProcessExceptionAction(IContentItem file, IPolicySetResponse policySet)
		{
			bool bReturn = false;
			m_ExceptionAction = true;
			m_CurrentFileInfo = file as ContentItem;
			FileType = FileTypeBridge.GetFileType((FileType) Enum.Parse(typeof(FileType), m_CurrentFileInfo.Type));

			PolicySetResponse policySetInfo = policySet as PolicySetResponse;

			foreach (PolicyResponse policyInfo in policySetInfo.PolicyReportCollection)
			{
				if (policyInfo.ActionCollection == null || policyInfo.ActionCollection.Count == 0) // only add if 
					continue;

				bReturn = true;
				m_CurrentActions = policyInfo.ActionCollection;

				try
				{
					bool bResult = m_NxBre.Process("ExceptionHandler");

					SortedActionCollection sortedActions = new SortedActionCollection(policyInfo.ActionCollection);
					sortedActions.Sort(new ActionInfoSorter());
					policyInfo.ActionCollection = sortedActions.ActionCollection;
					//policyInfo.ActionCollection.Sort(new ActionInfoSorter());
				}
				catch (Exception) // TODO: check will this come here, or into the PolicyEngine.OnExceptionHandler??
				{
					m_ExceptionAction = false;
					throw;
				}
			}
			m_ExceptionAction = false;
			return bReturn;
		}
コード例 #7
0
		public void ProcessAction(IContentItem file, IPolicySetResponse policySet)
		{
			m_CurrentFileInfo = file as ContentItem;
			FileType = FileTypeBridge.GetFileType((FileType) Enum.Parse(typeof(FileType), m_CurrentFileInfo.Type));

			PolicySetResponse policySetInfo = policySet as PolicySetResponse;

			foreach (PolicyResponse policyResponse in policySetInfo.PolicyReportCollection)
			{
				if (policyResponse.Routing == null)
					continue;

				policyResponse.ActionCollection = new Collection<IPolicyResponseAction>();
				m_CurrentActions = policyResponse.ActionCollection;

				if (m_skipDiscovery)
				{                    
					// Only policies defined in the 'presetActionNames' list will be loaded into 
					// the 'm_presetActionsInfo' collection and will be able to load for execution
					// in the 'LoadPresetActions' function.
					string actionName = string.Empty;
					switch (policyResponse.Name)
					{
					case "Document Conversion Policy":
						actionName = "PDF - Microsoft Office Documents";
						LoadPresetActions(actionName);
                        Logger.LogInfo("Process premature responce actions. Enforce Document Conversion Policy");
						break;
					case "Hidden Data Policy":
						// attempt to load both types of Clean,
						// only the one we need we be in the PresetAction list
						actionName = "Clean Action";
						LoadPresetActions(actionName);
						actionName = "LightSpeed Clean Action";
						LoadPresetActions(actionName);
                        Logger.LogInfo("Process premature responce actions. Enforce Clean Hidden Data (Office)");
						break;
                    case "Hidden PDF Data Policy":
                        actionName = "PDFClean Action";
                        LoadPresetActions(actionName);
                        Logger.LogInfo("Process premature responce actions. Enforce Clean Hidden Data (PDF)");
                        break;
					}
				}
				else
				{
					RoutingResponse routingResponse = policyResponse.Routing as RoutingResponse;

					if (routingResponse != null)
						m_NxBre.Process(routingResponse.ActionSetId);
				}

				SortedActionCollection sortedActions = new SortedActionCollection(policyResponse.ActionCollection);
				sortedActions.Sort(new ActionInfoSorter());
				policyResponse.ActionCollection = sortedActions.ActionCollection;
			}
		}
コード例 #8
0
		public void ProcessRouting(IContentItem file, IPolicySetResponse policySet)
		{
			PolicySetResponse policySetInfo = policySet as PolicySetResponse;
			m_CurrentFileInfo = file as ContentItem;
			foreach (PolicyResponse policyResponse in policySetInfo.PolicyReportCollection)
			{
				m_CurrentPolicyInfo = policyResponse;
				m_NxBre.Process(policyResponse.RoutingId);
			}
		}