public static void PopulateRoutingInfo(PolicyResponseObject pro) { if (null == pro) return; IUniversalRequestObject uro = pro.UniversalRequestObject; if (null == uro) return; ResponseRoutingHandler routingHandler = new ResponseRoutingHandler(uro); pro.RoutingInformation = routingHandler.GenerateResponseFromUro(); }
public static PolicyResponseObject GeneratePRO(string[] files, PolicyType policyType, out IContainer container) { PolicyResponseObject pro = new PolicyResponseObject(); pro.RunAt = RunAt.Client; UniversalRequestObject uro = new UniversalRequestObject(); uro.PolicyType = policyType; uro.DataTimeStamp = DateTime.Now; GenerateURORoutingDetails(uro, policyType); GenerateUROProperties(uro, policyType); GenerateUROAttachmentData(uro, files); pro.UniversalRequestObject = uro; ContainerBuilder containerBuilder = new ContainerBuilder(pro); container = containerBuilder.CreateContainerFromUro(); return pro; }
public static void PopulateResolvedActionCollection(PolicyResponseObject upi) { upi.ResolvedActionCollection = new Collection<IResolvedAction>(); List<IPolicyResponseAction> policyResponseActionCollection = ProInquisitor.GetPolicyResponseActions(upi); if (policyResponseActionCollection == null) return; // if the action collection at this point contains a block action that isnt an exception handler // then all other actions will be superseded by it. // rally issue DE539 // Have to iterate in order cause policyResponseActionCollection is ordered! IPolicyResponseAction blockingAction = null; for(int i = 0; i < policyResponseActionCollection.Count;i++) { PolicyResponseAction pra = policyResponseActionCollection[i] as PolicyResponseAction; Collection<IContentItem> contentItemCollection = ProInquisitor.GetContentItems(upi, pra); ResolvedAction resolvedAction = new ResolvedAction(); resolvedAction.ResponseAction = pra; resolvedAction.ContentCollection = contentItemCollection; resolvedAction.PopulateContentItemsActionProperties(); resolvedAction.Sequence = pra.Precedence; //if (pra.Action.Blocking && !pra.IsExceptionAction) //{ // blockingAction = pra; //} upi.ResolvedActionCollection.Add(resolvedAction); } if (blockingAction != null) { foreach (PolicyResponseAction pra in policyResponseActionCollection) { if (pra != blockingAction) { pra.SupersededByAction = blockingAction; } } } }
public void Test_07_CreateContainerFromNetMonChannelAsHTTPType() { string[] attachments = new string[] { Path.Combine(TEST_FOLDER, "TestProfanity.doc"), Path.Combine(TEST_FOLDER, "small.xls"), Path.Combine(TEST_FOLDER, "TestDoc.ppt") }; PolicyResponseObject pro = new PolicyResponseObject(); pro.RunAt = RunAt.Client; UniversalRequestObject uro = new UniversalRequestObject(); uro.PolicyType = PolicyType.NetMon; uro.DataTimeStamp = DateTime.Now; uro.Properties[HttpRequestPropertyKeys.Description] = "stuff"; uro.Properties["tag1"] = "This is a test"; uro.Properties["tag2"] = "This is a test"; ProHelper.GenerateUROAttachmentData(uro, attachments); pro.UniversalRequestObject = uro; ContainerBuilder containerBuilder = new ContainerBuilder(pro); IContainer container = containerBuilder.CreateContainerFromUro(); Assert.IsTrue(container.DisplayName == "HTTP Content"); }
public void Test_06_CreateContainerFromNetMonChannelAsEmailType() { string[] attachments = new string[] { Path.Combine(TEST_FOLDER, "TestProfanity.doc"), Path.Combine(TEST_FOLDER, "small.xls"), Path.Combine(TEST_FOLDER, "TestDoc.ppt") }; PolicyResponseObject pro = new PolicyResponseObject(); pro.RunAt = RunAt.Client; UniversalRequestObject uro = new UniversalRequestObject(); uro.PolicyType = PolicyType.NetMon; uro.DataTimeStamp = DateTime.Now; ProHelper.GenerateUROProperties(uro, PolicyType.NetMon); ProHelper.GenerateUROAttachmentData(uro, attachments); pro.UniversalRequestObject = uro; ContainerBuilder containerBuilder = new ContainerBuilder(pro); IContainer container = containerBuilder.CreateContainerFromUro(); Assert.IsTrue(container.DisplayName == "message subject/body"); }
public ReturnData(PolicyResponseObject pro, IUniversalRequestObject uro, IContainer container) { this.pro = pro; this.uro = uro; this.container = container; }
public void SetupPro() { pro = new PolicyResponseObject(); pro.ContentCollection = new Collection<IContentItem>(); ContentItem ci = new ContentItem(); ci.Name = "ContentItem1"; pro.ContentCollection.Add(ci); PolicySetResponse setA = new PolicySetResponse("setA"); PolicySetResponse setB = new PolicySetResponse("setB"); ((ContentItem)pro.ContentCollection[0]).PolicySetCollection = new Collection<IPolicySetResponse>(); pro.ContentCollection[0].PolicySetCollection.Add(setA); pro.ContentCollection[0].PolicySetCollection.Add(setB); PolicyResponse policyW = new PolicyResponse(); policyW.Triggered = true; PolicyResponse policyX = new PolicyResponse(); policyX.Triggered = true; PolicyResponse policyY = new PolicyResponse(); policyY.Triggered = true; PolicyResponse policyZ = new PolicyResponse(); policyZ.Triggered = true; setA.PolicyReportCollection = new Collection<IPolicyResponse>(); setA.PolicyReportCollection.Add(policyW); setA.PolicyReportCollection.Add(policyX); setB.PolicyReportCollection = new Collection<IPolicyResponse>(); setB.PolicyReportCollection.Add(policyY); setB.PolicyReportCollection.Add(policyZ); policyW.ActionCollection = new Collection<IPolicyResponseAction>(); policyW.ActionCollection.Add(new PolicyResponseAction()); policyX.ActionCollection = new Collection<IPolicyResponseAction>(); policyX.ActionCollection.Add(new PolicyResponseAction()); ((PolicyResponseAction)policyW.ActionCollection[0]).Type = ((PolicyResponseAction)policyX.ActionCollection[0]).Type = "1stTypeOfAction"; policyY.ActionCollection = new Collection<IPolicyResponseAction>(); policyY.ActionCollection.Add(new PolicyResponseAction()); policyZ.ActionCollection = new Collection<IPolicyResponseAction>(); policyZ.ActionCollection.Add(new PolicyResponseAction()); ((PolicyResponseAction)policyY.ActionCollection[0]).Type = ((PolicyResponseAction)policyZ.ActionCollection[0]).Type = "2ndTypeOfAction"; //Wire up the resolved actions... one of each type. ResolvedAction action1 = new ResolvedAction(); action1.ResponseAction = policyW.ActionCollection[0]; ResolvedAction action2 = new ResolvedAction(); action2.ResponseAction = policyY.ActionCollection[0]; pro.ResolvedActionCollection = new Collection<IResolvedAction>(); pro.ResolvedActionCollection.Add(action1); pro.ResolvedActionCollection.Add(action2); //This bit mimics what happens in action resolution - each resolved actions has a list of which content items it will act on. action1.ContentCollection = new Collection<IContentItem>(); action1.ContentCollection.Add(ci); action2.ContentCollection = new Collection<IContentItem>(); action2.ContentCollection.Add(ci); }