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; }
public static IContentItem GetIContentItem(Workshare.PolicyContent.ContentItem item, Attachment origAttachment) { if (null == item) throw new ArgumentException("item"); if (null == origAttachment) throw new ArgumentException("origAttachment"); IFile engineFile = FileAdaptor.GetIFile(origAttachment); Workshare.Policy.Engine.ContentItem ci = new Workshare.Policy.Engine.ContentItem(engineFile); ci.DisplayName = item.Name; ci.Encrypted = item.Encrypted; ci.Type = item.ContentType; ci.Size = item.Size; if ( item.Properties != null) { foreach (CustomProperty property in item.Properties) { ci.Properties[property.Name] = property.Value; } } if ( item.PolicySets != null) { foreach (PolicySet policySet in item.PolicySets) { ci.PolicySetCollection.Add( PolicySetAdaptor.GetIPolicySetResponse(policySet) ); } } return ci; }
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; } }
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); } }
private static void CopyProperties(ContentItem fileItem) { foreach (KeyValuePair<string, string> kvp in fileItem.File.Properties) { //Only adding entries from fileItem.File.Properties if they are not already in fileItem.Properties if (!fileItem.Properties.ContainsKey(kvp.Key)) { fileItem.Properties[kvp.Key] = kvp.Value; } } }
public void ProcessFileInfo(IContentItem file) { if (m_NxBre == null) throw new PolicyEngineException("NxBre is not properly initialised"); m_CurrentFileInfo = file as ContentItem; FileType = FileTypeBridge.GetFileType((FileType) Enum.Parse(typeof(FileType), m_CurrentFileInfo.Type)); OnPolicyProgressEvent(new PolicyProgressEventArgs(m_CurrentFileInfo.File, EventType.process, "Policies")); m_NxBre.Process("Policies"); CopyProperties(m_CurrentFileInfo); }
public void TearDown() { Source = null; Destination = null; RecipientList = null; m_CurrentFileInfo = null; }