Exemplo n.º 1
0
        public RoutingControl(IPolicyChannel channel)
        {
            InitializeComponent();
            if (null != channel)
            {
                this.routingsgb.Visible = false;
                this.routingsgb.Height = 0;
                this.functionsgb.Visible = false;
                this.functionsgb.Height = 0;
                this.headingtxt.Text = channel.Name;
                this.descriptiontxt.Text = channel["Description"];

                MatrixTableControl routingTableControl = new MatrixTableControl(channel);
                routingTableControl.Dock = DockStyle.Fill;
                routingTableControl.Parent = this.routingtablegb;
                routingTableControl.Refresh();
            }
            else
            {
                MatrixTableControl routingTableControl = new MatrixTableControl(null);
                routingTableControl.Dock = DockStyle.Fill;
                routingTableControl.Parent = this.routingtablegb;
                routingTableControl.Refresh();

                this.headingtxt.Text = "Routings";
                this.descriptiontxt.Text = "Allows the user to create, modify, or remove existing routing tables.";
            }

            this.AutoSize = true;
        }
Exemplo n.º 2
0
		public ChannelSummary(IPolicyChannel channel)
		{
			m_channel = channel;

			Dictionary<KeyValuePair<Guid, Guid>, IRoutingMatrixCell>.Enumerator enumerator = m_channel.Routing.GetEnumerator();

			while (enumerator.MoveNext())
			{
				KeyValuePair<KeyValuePair<Guid, Guid>, IRoutingMatrixCell> current = enumerator.Current;

				//string matrixDescription = current.Value.Description.Value;

				IActionMatrixCell action = m_channel.Actions[current.Key.Key, current.Key.Value];
				string routingName = current.Value.Description.Value;

				if (action != null)
				{
					foreach (IActionConditionGroup acg in action.ActionConditionGroups)
					{
						if (acg.ActionGroup.Actions.Count > 0)
						{
							m_routingActions.Add(new ActionSetSummary(acg.ActionGroup, routingName));
						}
					}
				}
			}
		}
Exemplo n.º 3
0
        private SortedList<int, IAction> GetExternalActions(IPolicyChannel channel)
        {
            SortedList<int, IAction> externalActions = new SortedList<int, IAction>();

            IRoutingTable routing = channel.Routing;

            if (routing == null)
                return externalActions;

            Guid unprivDestinationId = routing.DefaultDestination.Identifier;
            Guid unprivSourceId = routing.DefaultSource.Identifier;

            IRoutingMatrixCell routingMatrixCell = routing[unprivSourceId, unprivDestinationId];
            if (routingMatrixCell == null)
                return externalActions;

            IActionMatrixCell actionMatrixCell = channel.Actions[unprivSourceId, unprivDestinationId];

            if (actionMatrixCell == null)
                return externalActions;

            foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups)
            {
                foreach (IAction action in actionCondtionGroup.ActionGroup.Actions)
                {
                    externalActions.Add(action.Precedence, action);
                }
            }
            return externalActions;
        }
Exemplo n.º 4
0
        public override void Enter()
        {            
            if (null == m_channel)
            {
                m_channel = m_policy.Channels[0];
            }

            if (false == m_policy.Channels.Contains(m_channel))
            {
                m_channel = m_policy.Channels[0];
            }

            SetControlLabels();

            List<RoutingHelper.RoutingType> routingTypes = RoutingHelper.SupportedRoutingTypes(m_channel.Type);
            m_actionPanel.RoutingTypes = routingTypes;
            m_actionPanel.ShowRoutingTypeSelection = (routingTypes.Count > 1) ? true : false;
            m_actionPanel.RoutingType = RoutingHelper.GetRoutingType(m_channel.Routing);
            m_actionPanel.Policy = m_policy;
            m_actionPanel.Channel = m_channel;
			m_actionPanel.PublishPolicySetEnabled = PolicyDesigner.CheckLicense();

            m_actionPanel.Display();

            StateMachine.ChildForm.TreeViewController.SelectNode(m_channel, true);
        }
Exemplo n.º 5
0
 public ActionMatrixEventArgs(IPolicy policy, IPolicyChannel channel, IRoutingItemCollection senderCollection,
     IRoutingItemCollection recipientCollection, Workshare.Policy.ObjectModel.IAction action)
 {
     m_policy = policy;
     m_channel = channel;
     m_senderCollection = senderCollection;
     m_recipientCollection = recipientCollection;
     m_action = action;
 }
Exemplo n.º 6
0
 public NxOfflineRoutingSet(IPolicyChannel channel, NxObjectWriter objectWriter, IResourceManager resourceManager, Guid offlineRoutingId)
     : base(offlineRoutingId.ToString())
 {
     m_Pow = objectWriter;
     m_PolicyChannel = channel;
     m_OfflineRoutingId = offlineRoutingId;
     m_resourceManager = resourceManager;
     CreateOfflineRoutingSet();
 }
Exemplo n.º 7
0
 public NxRoutingSet(IPolicyChannel channel, NxObjectWriter objectWriter, IResourceManager resourceManager)
 {
     m_objectWriter = objectWriter;
     m_policyChannel = channel;
     m_routingId = channel.Routing.Identifier.ToString();
     m_routingSet = new NxSet(m_routingId);
     m_routingSet.Append(new NxComment("Online routing"));
     m_resourceManager = resourceManager;
     InitialiseObjectLookups();
 }
Exemplo n.º 8
0
        public NxPreRoutingSet(IPolicyChannel channel, IPolicyObject parent, Guid preRoutingId, Guid offlineRoutingId)
            : base(preRoutingId.ToString())
        {
            m_channel = channel;
            m_parent = parent;
            m_ChannelRoutingId = channel.Identifier;
            m_OfflineRoutingId = offlineRoutingId;


            CreatePreRoutingSet();
        }
Exemplo n.º 9
0
        public void SetChannel(IPolicyChannel channel)
        {
            Clear();
            this.descriptionText.Text = channel["Description"];
            //TODO: PW check why there are multiple routing tables here
            foreach (IRoutingTable table in channel.Routing)
            {
                this.matrixTableControl.Refresh(table);
            }
            this.Refresh();

        }
Exemplo n.º 10
0
        private void WriteRouting(XmlNode parentNode, IPolicyChannel channel)
        {
            IRoutingTable routingTable = channel.Routing;
            if (null == routingTable)
                return;

            XmlNode xmlRoutingTableNode = m_xmlDocument.CreateElement("RoutingTable");
            parentNode.AppendChild(xmlRoutingTableNode);

            XmlHelpers.AddIdAttribute(xmlRoutingTableNode, routingTable);
            XmlHelpers.AddReadOnlyAttribute(xmlRoutingTableNode, routingTable.ReadOnly);
            XmlHelpers.AddCustomAttributes(xmlRoutingTableNode, routingTable);
        }
Exemplo n.º 11
0
        public void Initialise(IPolicy policy, IPolicyChannel channel, IActionGroup group)
        {
            //if the action group has changed, don't bother trying to select the
            //same action that was selected prior to this call
            if (group != m_actionGroup)
            {
                m_selectedActionIndex = -1;
            }

            m_policy = policy;
            m_channel = channel;
            m_actionGroup = group;

            FillCatalogActions();
            FillAssignedActions();

            this.actiongroupNameTextBox.Focus();
        }
Exemplo n.º 12
0
        private void ValidateChannel1(IPolicyChannel channel)
        {
            Assert.IsNotNull(channel, "Expected a valid channel");
            Assert.AreEqual(new Guid("{EB97BB54-CB76-46EE-B024-3F747ED4424F}"), channel.Identifier);
            Assert.AreEqual("Email PolicySets", channel.Name.Value);
            IRoutingTable smtpRouting = channel.Routing;
            Assert.IsNotNull(smtpRouting, "Expected the routing table type to be SMTP");
            Assert.AreEqual(new Guid("{AF6E5D89-0C6F-4B10-9A6C-658D13CD3EA8}"), smtpRouting.Identifier);
            Assert.AreEqual("Internal financial users", smtpRouting.Name.Value);
            Assert.IsNotNull(smtpRouting.Sources, "Expected a valid sources collection");
            IRoutingItemCollections senders = smtpRouting.Sources;
            Assert.IsNotNull(senders);
            Assert.AreEqual(3, senders.Count);
            IRoutingItemCollection sender = senders[0];
            Assert.IsNotNull(sender);
            Assert.AreEqual(new Guid("{A81631A6-6AA3-45f7-AADD-4853447E5BD6}"), sender.Identifier);
            Assert.AreEqual("Financial Users", sender.Name.Value);

            Assert.AreEqual(4, sender.Count);

            Assert.AreEqual("James", sender[0].Name.Value);
            Assert.AreEqual("[email protected]", sender[0].Content);

            Assert.AreEqual("Jane", sender[1].Name.Value);
            Assert.AreEqual("[email protected]", sender[1].Content);

            Assert.AreEqual("Ann", sender[2].Name.Value);
            Assert.AreEqual("[email protected]", sender[2].Content);

            Assert.AreEqual("Sally", sender[3].Name.Value);
            Assert.AreEqual("[email protected]", sender[3].Content);

            IRoutingItemCollections recipients = smtpRouting.Destinations;
            Assert.IsNotNull(recipients);

            Assert.AreEqual(2, recipients.Count);
            IRoutingItemCollection recipient = recipients[0];

            Assert.IsNotNull(recipient);
            Assert.AreEqual("Sales and Finance", recipient.Name.Value);

            recipient = recipients[1];
            Assert.AreEqual("Training", recipient.Name.Value);
        }
Exemplo n.º 13
0
        private void ShowPanelForChannel(IPolicyChannel channel)
        {
            this.descriptiontxt.Text = channel["Description"];
            RoutingTableManager manager = new RoutingTableManager(channel);
            manager.DisplayControl += new DisplayControlDelegate(manager_DisplayControl);

            Control ctrl = manager.GetRoutingTableControl();
            this.controlpnl1.Height = ctrl.Height;
            ctrl.Dock = DockStyle.Fill;
            ctrl.Parent = this.controlpnl1;

            this.controlpnl2.Height = 0;

            //For the conditions on the actions, the condition control will be displayed in the 2nd panel
            /*ConditionControl conditioncontrol = new ConditionControl(null);
            this.controlpnl2.Height = conditioncontrol.Height;
            conditioncontrol.Dock = DockStyle.Fill;
            conditioncontrol.Parent = this.controlpnl2;*/
        }
Exemplo n.º 14
0
		public void RemoveAction(IPolicyChannel channel, Routing routing, IAction action)
		{
			switch (routing)
			{
			case Routing.Internal:
				RemoveInternalAction(channel, action);
				break;
			case Routing.External:
				RemoveExternalAction(channel, action);
				break;
			default:
				throw new System.Exception(Properties.Resources.ERROR_UNKNOWN_ROUTING_TYPE);
			}
		}
Exemplo n.º 15
0
 private void ValidateChannel2(IPolicyChannel channel)
 {
     Assert.IsNotNull(channel);
     Assert.AreEqual(new Guid("{B28CD900-603B-4FE7-9994-EE2B7BCAD2F8}"), channel.Identifier);
     Assert.AreEqual("File Transfer PolicySets", channel.Name.Value);
     IRoutingTable smtpRouting = channel.Routing;
     Assert.IsNotNull(smtpRouting, "Expected the routing table type to be SMTP");
     Assert.AreEqual(new Guid("{533515D4-A339-419D-A4AC-8642BBFF4C82}"), smtpRouting.Identifier);
     Assert.AreEqual("Internal legal users", smtpRouting.Name.Value);
     Assert.IsNotNull(smtpRouting.Sources, "Expected a valid sources collection");
     Assert.AreEqual(3, smtpRouting.Sources.Count);
     Assert.IsNotNull(smtpRouting.Destinations, "Expected a valid destinations collection");
     Assert.AreEqual(2, smtpRouting.Destinations.Count);
 }
Exemplo n.º 16
0
        private SortedList<int, IAction> GetInternalActions(IPolicyChannel channel)
        {

            SortedList<int, IAction> internalActions = new SortedList<int, IAction>();

            IRoutingTable routing = channel.Routing;
            if (null == routing)
                return internalActions;

            Guid trustedSourceId = routing.DefaultSource.Identifier;
            Guid trustedDestinationId = Guid.Empty;

            foreach (IRoutingItemCollection destination in routing.Destinations)
            {
                if ("true" == destination["DefaultGroup"].Value.ToLower(System.Globalization.CultureInfo.InvariantCulture))
                    continue;

                trustedDestinationId = destination.Identifier;
            }

            IRoutingMatrixCell routingMatrixCell = routing[trustedSourceId, trustedDestinationId];
            if (routingMatrixCell == null)
                return internalActions;

            IActionMatrixCell actionMatrixCell = channel.Actions[trustedSourceId, trustedDestinationId];

            if (actionMatrixCell == null)
                return internalActions;

            foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups)
            {
                foreach (IAction action in actionCondtionGroup.ActionGroup.Actions)
                {
                    internalActions.Add(action.Precedence, action);
                }
            }
            return internalActions;
        }
Exemplo n.º 17
0
        private static bool ValidateRoutingItemCollections(string policyName, IPolicyChannel channel, PolicySetValidator.AddViolationMessageHandler AddMessage)
        {
            bool valid = true;

            if (channel.Type == ChannelType.SMTP || channel.Type == ChannelType.RemoveableDevice)
            {
                IRoutingTable routingTable = channel.Routing;
                IRoutingItemCollection defaultSource = null;
                if (routingTable.HasDefaultSources)
                {
                    defaultSource = routingTable.DefaultSource;
                }
                foreach (IRoutingItemCollection routingItemCollection in routingTable.Sources)
                {
                    if (routingItemCollection != defaultSource)
                    {
                        if (routingItemCollection.Count == 0)
                        {
                            string msg = string.Format(CultureInfo.InvariantCulture,
                                Properties.Resources.VALIDATION_INTRAPOLICY_ROUTING_NOSENDERS,
                                routingItemCollection.Name.Value,
                                Workshare.Policy.UI.DisplayTranslations.ChannelTypeDisplayTranslator.Instance.GetDisplayType(routingTable.Type));
                            if (null != AddMessage)
                                AddMessage(policyName, msg, true);
                            valid = false;
                        }
                    }
                }

                IRoutingItemCollection defaultDestination = null;
                if (routingTable.HasDefaultDestinations)
                {
                    defaultDestination = routingTable.DefaultDestination;
                }
                foreach (IRoutingItemCollection routingItemCollection in routingTable.Destinations)
                {
                    if (routingItemCollection != defaultDestination)
                    {
                        if (routingItemCollection.Count == 0)
                        {
                            string msg = string.Format(CultureInfo.InvariantCulture, 
                                Properties.Resources.VALIDATION_INTRAPOLICY_ROUTING_NORECIPIENTS, 
                                routingItemCollection.Name.Value,
                                Workshare.Policy.UI.DisplayTranslations.ChannelTypeDisplayTranslator.Instance.GetDisplayType(routingTable.Type));
                            if (null != AddMessage)
                                AddMessage(policyName, msg, true);
                            valid = false;
                        }
                    }
                }
            }
            return valid;
        }
Exemplo n.º 18
0
 public int GetCountInternalActions(IPolicyChannel channel)
 {
     return GetInternalActions(channel).Count;
 }
Exemplo n.º 19
0
        public bool IsLDAPRouting(IPolicyChannel channel)
        {
            //IRoutingTable routing = channel.Routing;
            //if ((routing.Sources.Count != 1) || (routing.Destinations.Count != 2))
            //    return true;
            //else if ((routing.Sources.Count == 1) || (routing.Destinations.Count == 2))
            //{
            //    if ((routing.Sources[0].Name.Value != "Everyone") ||
            //        (routing.Destinations[0].Name.Value != "Internal Recipients") ||
            //        (routing.Destinations[1].Name.Value != "External Recipients"))
            //        return true;
            //}

            return false;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Removes a Channel from a policy set's master catalogue
        /// </summary>
        /// <param name="policySet">The policy set from whose catalogue we will remove the Channel</param>
        /// <param name="channel">The Channel to remove</param>
        private static void RemoveChannel(IPolicySet policySet, IPolicyChannel channel)
        {
            if (null == policySet || null == channel)
            {
                return;
            }

            IRoutingTable routingTable = channel.Routing;
            foreach(IRoutingItemCollection sender in routingTable.Sources)
            {
                foreach (IRoutingItemCollection recipient in routingTable.Destinations)
                {
                    if (channel.Actions.HasCell(sender, recipient))
                    {
                        IActionMatrixCell cell = channel.Actions[sender, recipient];
                        foreach (IActionConditionGroup actionConditionGroup in cell.ActionConditionGroups)
                        {
                            RemoveConditionGroup(policySet, actionConditionGroup);
                        }
                    }
                }
            }

            //remove routing table
            RemoveRoutingTable(policySet, channel.Routing);

            IChannel channelInCatalogue = policySet.MasterCatalogue.Channels[channel.Identifier];
            policySet.MasterCatalogue.Channels.Remove(channelInCatalogue);
        }
Exemplo n.º 21
0
 //public MatrixTableControl()
 public MatrixTableControl(IPolicyChannel policyChannel)
 {
     InitializeComponent();
     m_policyChannel = policyChannel;
 }
Exemplo n.º 22
0
        protected void ChangeRoutingType()
        {
            if (!RoutingHelper.SupportedRoutingTypes(m_channel.Type).Contains(m_requestedRoutingType))
            {
                ArgumentException ex = new ArgumentException("channel does not support routing type selection");
				Logger.LogError(ex.Message);
                throw ex;
            }

            if (DialogResult.Yes == MessageBox.Show(Properties.Resources.ROUTINGTYPE_CHANGE_CONFIRMATION, Properties.Resources.ROUTINGTYPE_CHANGE, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2))
            {
                IPolicyChannel newChannel = ChannelFactory.CreateChannel(m_channel.Name.Value, m_channel.Type, m_requestedRoutingType);

                m_policy.Channels.Remove(m_channel);
                MasterCatalogueUtils.RemovePolicyObjectFromCatalogue(m_policy.PolicySet, m_channel);

                m_channel = newChannel;
                m_policy.Channels.Add(m_channel);

                StateMachine.ChildForm.IsModified = true;
                StateMachine.ChildForm.TreeViewController.Display();
            }
        }
Exemplo n.º 23
0
        public static List<CellActionsCollection> GetActions(IPolicyChannel channel, IPolicySet policyset, bool checkForAllowInterpolicyDuplicates)
		{
            List<CellActionsCollection> returnVal = new List<CellActionsCollection>();
			
			IActionMatrix matrix = channel.Actions;
			IActionMatrixCell cell = null;

			if (matrix.HasOffline)
			{
                CellActionsCollection collection = new CellActionsCollection();
                collection.Actions = ExtractActionsFromActionGroups(matrix.Offline.ActionConditionGroups, policyset, checkForAllowInterpolicyDuplicates);
                collection.ChannelType = channel.Type;
                returnVal.Add(collection);
			}

			switch (ExpressionHelpers.GetRoutingType(channel.Routing))
            {
				case ExpressionHelpers.RoutingType.Undefined:
					return returnVal;

                case ExpressionHelpers.RoutingType.SingleCell:
					IRoutingTable singleCelledRoutingTable = channel.Routing as IRoutingTable;
					cell = channel.Actions[singleCelledRoutingTable.DefaultSource, singleCelledRoutingTable.DefaultDestination];
					if (null == cell)
						return returnVal;

                    CellActionsCollection collection = new CellActionsCollection();
                    collection.Actions = ExtractActionsFromActionGroups(cell.ActionConditionGroups, policyset, checkForAllowInterpolicyDuplicates);
                    collection.ChannelType = channel.Type;
                    returnVal.Add(collection);
                    break;

                default:
                    IRoutingTable multiCelledRoutingTable = channel.Routing;
                    foreach (IRoutingItemCollection sender in multiCelledRoutingTable.Sources)
					{
						foreach (IRoutingItemCollection recipient in multiCelledRoutingTable.Destinations)
						{
							cell = channel.Actions[sender, recipient];
							if (null == cell)
								continue;

                            collection = new CellActionsCollection();
                            collection.Actions = ExtractActionsFromActionGroups(cell.ActionConditionGroups, policyset, checkForAllowInterpolicyDuplicates);
                            collection.ChannelType = channel.Type;
                            returnVal.Add(collection);
						}
					}
                    break;
            }

			return returnVal;
		}
Exemplo n.º 24
0
		private void RemoveExternalAction(IPolicyChannel channel, IAction action)
		{
			IRoutingTable routing = channel.Routing;

			if (routing == null)
				throw new System.Exception("Invalid routing table");

			Guid unprivDestinationId = routing.DefaultDestination.Identifier;
			Guid unprivSourceId = routing.DefaultSource.Identifier;

			IRoutingMatrixCell routingMatrixCell = routing[unprivSourceId, unprivDestinationId];
			if (routingMatrixCell == null)
				return; // No Routing

			IActionMatrixCell actionMatrixCell = channel.Actions[unprivSourceId, unprivDestinationId];

			if (actionMatrixCell == null)
				return; // No Actions

			foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups)
			{
				IPolicyObjectCollection<IAction> actions = actionCondtionGroup.ActionGroup.Actions;
				foreach (IAction act in actions)
				{
					if (action.Assembly == act.Assembly)
					{
						actions.Remove(act);
						return;
					}
				}
			}
		}
Exemplo n.º 25
0
 public RoutingMatrixEventArgs(IPolicyChannel channel, IRoutingItemCollections addressGroup, IRoutingItemCollection addressCollection)
 {
     m_channel = channel;
     m_addressGroup = addressGroup;
     m_addressCollection = addressCollection;
 }
Exemplo n.º 26
0
        public static void RemoveCollectionFromAddressGroup(IPolicyChannel channel, IRoutingItemCollections addressGroup, IRoutingItemCollection addressCollection)
        {
            IRoutingTable routingTable = channel.Routing;
            if (null == routingTable)
            {
                return;
            }

            if (AddressCollectionHelper.AllowCollectionDelete(routingTable, addressCollection))
            {
                if (Object.ReferenceEquals(routingTable.Sources, addressGroup))
                {
                    // Removing location collection from sources group
                    routingTable.Sources.Remove(addressCollection);

                    //remove cells from action matrix
                    foreach (IRoutingItemCollection recipient in routingTable.Destinations)
                    {
                        if (channel.Actions.HasCell(addressCollection, recipient))
                        {
                            RemoveCellFromActionMatrix(channel.Actions, addressCollection, recipient);
                        }
                    }

                    if (1 == routingTable.Sources.Count)
                    {
                        IRoutingItemCollection defaultSenders = routingTable.DefaultSource;
                        defaultSenders.Name.Value = Properties.Resources.ROUTING_EVERYONE;
                    }
                }
                else if (Object.ReferenceEquals(routingTable.Destinations, addressGroup))
                {
                    // Removing location collection from destinations group
                    routingTable.Destinations.Remove(addressCollection);

                    //remove cells from action matrix
                    foreach (IRoutingItemCollection recipient in routingTable.Destinations)
                    {
                        if (channel.Actions.HasCell(addressCollection, recipient))
                        {
                            RemoveCellFromActionMatrix(channel.Actions, addressCollection, recipient);
                        }
                    }

                    if (1 == routingTable.Destinations.Count)
                    {
                        IRoutingItemCollection defaultRecipients = routingTable.DefaultDestination;
                        defaultRecipients.Name.Value = Properties.Resources.ROUTING_EVERYONE;
                    }
                }
                else
                {
					// group is neither sources nor destinations

                    Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                        "ADDRESSGROUPTYPE_INVALID",
                        "Workshare.PolicyDesigner.Properties.Resources",
                        System.Reflection.Assembly.GetExecutingAssembly());
					Logger.LogError(errorMessage.LogString);
					throw new ArgumentException(errorMessage.DisplayString);
                }

                RefreshRoutingMatrixTablePrecedences(routingTable);
            }
        }
Exemplo n.º 27
0
		public SortedList<int, IAction> GetChannelActions(IPolicyChannel channel, Routing routing)
		{
			SortedList<int, IAction> actions = new SortedList<int, IAction>();

			switch (routing)
			{
			case Routing.External:
				actions = GetExternalActions(channel);
				break;
			case Routing.Internal:
				actions = GetInternalActions(channel);
				break;
			default:
				throw new System.Exception("Unknown routing.");
			}
			return actions;
		}
Exemplo n.º 28
0
 public RoutingTableManager(IPolicyChannel channel)
 {
     m_Table = channel.Routing;
     m_tablecontrol.OnLinkLabelClicked += new MatrixTableControl.OnLinkLabelClickedHandler(m_tablecontrol_OnLinkLabelClicked);
     m_tablecontrol.OnContentCellClicked += new MatrixTableControl.OnContentCellClickedHandler(m_tablecontrol_OnContentCellClicked);
 }
Exemplo n.º 29
0
        private void AddChannel(IPolicyChannel channel, List<CustomGXNode> channels, List<IPolicyChannel> policychannels)
        {
            foreach (IPolicyChannel duplicate in policychannels)
            {
                if (channel.Name == duplicate.Name)
                    return;
            }

            policychannels.Add(channel);

            CustomGXNode node = new CustomGXNode(channel.Name, channel);
            node.Style = DevComponents.Tree.NodeStyles.PurpleMist;
            //MatrixTableControl routingTableControl = new MatrixTableControl(channel);
            //routingTableControl.Refresh();
            //TreeGxNodeControl control = new TreeGxNodeControl(channel.Name, routingTableControl, Color.FromArgb(198, 186, 206));
            //node.HostedControl = control;

            channels.Add(node);

            /*foreach (IRoutingTable table in channel.Routing)
            {
                DevComponents.Tree.Node senders = new DevComponents.Tree.Node();
                senders.Text = "Senders";
                node.Nodes.Add(senders);

                DevComponents.Tree.Node receivers = new DevComponents.Tree.Node();
                receivers.Text = "Receivers";
                node.Nodes.Add(receivers);

                AddAddresses(senders, table.Senders);
                AddAddresses(receivers, table.Recipients);
            }*/
        }
Exemplo n.º 30
0
		private void RemoveInternalAction(IPolicyChannel channel, IAction action)
		{
			IRoutingTable routing = channel.Routing;

			if (null == routing)
				throw new System.Exception("Invalid routing table");

			Guid trustedSourceId = routing.DefaultSource.Identifier;
			Guid trustedDestinationId = Guid.Empty;

			foreach (IRoutingItemCollection destination in routing.Destinations)
			{
				if ("true" == destination["DefaultGroup"].Value.ToLower(System.Globalization.CultureInfo.InvariantCulture))
					continue;

				trustedDestinationId = destination.Identifier;
			}

			IRoutingMatrixCell routingMatrixCell = routing[trustedSourceId, trustedDestinationId];
			if (routingMatrixCell == null)
				return; // No Routing

			IActionMatrixCell actionMatrixCell = channel.Actions[trustedSourceId, trustedDestinationId];

			if (actionMatrixCell == null)
				return; // No Actions

			foreach (IActionConditionGroup actionCondtionGroup in actionMatrixCell.ActionConditionGroups)
			{
				IPolicyObjectCollection<IAction> actions = actionCondtionGroup.ActionGroup.Actions;
				foreach (IAction act in actions)
				{
					if (action.Assembly == act.Assembly)
					{
						actions.Remove(act);
						return;
					}
				}
			}
		}