Exemplo n.º 1
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;
		}
Exemplo n.º 2
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;
			}
		}