/// <summary>
		/// Creates hyperlink representation of the editable parameters within the condition
		/// </summary>
		/// <returns>An array of RuleObject objects representing the editable parameters</returns>
		protected override RuleObject[] GetHyperlinks()
		{
			try
			{
				IDataElement hiddenDataDataElement = null;

				if (m_condition != null)
				{
					IDataSource dataSource = m_condition.DataLeft.Data as IDataSource;
					hiddenDataDataElement = dataSource.Method.Parameters[3].Value;
				}

				List<ConditionUnitFactory.FileHiddenDataType> enumHiddenTypes = null;
				List<Policy.FileType> types = GetFileTypes();
				if (null != types)
					enumHiddenTypes = FileTypeToHiddenDataMapper.GetHiddenDataForFileType(types);
				m_hiddenDataTypeData = new ConditionDisplayParameterHiddenData(hiddenDataDataElement, this.EditHiddenDataParameter, enumHiddenTypes, m_type);
				RuleObject[] hyperlinks = { m_hiddenDataTypeData };

				return hyperlinks;
			}
			catch (Exception ex)
			{
				Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
					"CONDITION_HIDDENDATA_INVALID",
					"Workshare.PolicyDesigner.Properties.Resources",
					System.Reflection.Assembly.GetExecutingAssembly(), ex.Message);
				Logger.LogError(errorMessage.LogString);
				throw new ArgumentException(errorMessage.DisplayString, ex);
			}
		}
        /// <summary>
        /// Determines whether it is logical to edit the name of an location collection, based on the 
        /// routing table and location collection. 
        /// Note that this is informational only; the user is not prevented from editing the name of the collection.
        /// </summary>
        /// <param name="routingTable">The routing table that contains the location collection</param>
        /// <param name="locationCollection">The location collection</param>
        /// <returns>A boolean indicating whether it is logical to edit the name of the location collection.</returns>
        public static bool AllowNameEdit(IRoutingTable routingTable, IRoutingItemCollection addressCollection)
        {
            if ((null == routingTable) || (null == addressCollection))
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INVALID_STATE_DATA",
                    "Workshare.PolicyDesigner.Properties.Resources",
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new ArgumentException(errorMessage.DisplayString);
            }

            // Only InternalExternal routing tables will have this property populated.
            // Therefore, if it is populated then it is an InternalExternal routing table and don't allow an edit.
            if (RoutingHelper.IsInternalExternalRoutingTable(routingTable))
            {
                return false;
            }

            if ((Workshare.Policy.ChannelType.SMTP == routingTable.Type) || (Workshare.Policy.ChannelType.RemoveableDevice == routingTable.Type))
            {
                if (AddressCollectionHelper.IsDefaultAddressCollection(addressCollection))
                {
                    return false;
                }
            }

            if (Workshare.Policy.ChannelType.Mta == routingTable.Type)
            {
                return false;
            }

            return true;
        }
Example #3
0
        internal static string GetXmlFromResource(System.Type resourceType, string resource)
		{
			string xml;
            using (System.IO.Stream stream = GetXmlSchemaFromResource(resourceType, resource))   
			{
				try      
				{ 
					using (System.IO.StreamReader reader = new System.IO.StreamReader(stream))         
					{
						xml = reader.ReadToEnd();         
					}
				}     
				catch (System.Exception e)      
				{
                    Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "ERROR_RETREIVING_POLICY_SCHEMA",
                            "Workshare.Policy.Store.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly());
					Logger.LogError(errorMessage.LogString);
					throw new Workshare.Policy.Exceptions.PolicySchemaException(errorMessage.DisplayString + e.Message);
				}
			}	
	
			return xml;
		}
        public override Stream Execute(IActionData3 input, ActionPropertySet properties)
        {
            Dictionary<string, string> streamProperties = input.Properties;
            BinaryCleanActionPropertySet cleanProperties = new BinaryCleanActionPropertySet(properties);

            CleanPropertiesDisplayTranslator strings = CleanPropertiesDisplayTranslator.Instance;
            if (!streamProperties.ContainsKey(strings.StrmProp_DisplayName))
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage("UNABLE_TO_GET_FILE_IN_STREAM", "Workshare.Policy.Actions.Properties.LanguageResources", Assembly.GetExecutingAssembly());
                Logger.LogError(errorMessage.LogString);
				throw new CleanUserActionException(errorMessage.DisplayString);
            }

            if (properties.SystemProperties.ContainsKey(strings.SysProp_FileType))
            {
                if (!m_supportedFiles.Supports(properties.SystemProperties[strings.SysProp_FileType].Value as string))
                {
					Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage("UNABLE_TO_CLEAN_NON_SUPPORTED_FILETYPE", "Workshare.Policy.Actions.Properties.LanguageResources", Assembly.GetExecutingAssembly());
					Logger.LogError(errorMessage.LogString);
                    return null;
                }
            }

            return CallCleanThread(cleanProperties, input.Content, ref streamProperties, strings);
        }
		/// <summary>
		/// Creates a visual representation of a condition
		/// </summary>
		/// <returns>A ConditionMethodDisplay object</returns>
		public static ConditionDisplayBase CreateConditionDisplay(ICondition condition, Workshare.Policy.PolicyType type)
		{
			ConditionUnitFactory.PreDefinedConditionType conditionType = ConditionUnitFactory.PreDefinedConditionType.Undefined;

			try
			{
				conditionType = CustomAttributes.GetPreDefinedConditionType(condition);
			}
			catch (ArgumentException ex)
			{
				Logger.LogError("Condition is not one of our predefined types.");
				Logger.LogError(ex);
				return null;
			}

			switch (conditionType)
			{
			case ConditionUnitFactory.PreDefinedConditionType.ContentInFileContext:
				return new ConditionDisplayContentInFileContext(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.RegexInFileContext:
				return new ConditionDisplayRegexInFileContext(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.ContentInFileName:
				return new ConditionDisplayContentInFileName(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.RegexInFileName:
				return new ConditionDisplayRegexInFileName(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileSize:
				return new ConditionDisplayFileSize(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileType:
				return new ConditionDisplayFileType(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInFile:
				return new ConditionDisplayHiddenDataInFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.CustomProperty:
				return new ConditionDisplayCustomProperty(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.PasswordProtectedFile:
				return new ConditionDisplayPasswordProtectedFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.DocumentRestrictions:
				return new ConditionDisplayDocumentRestrictions(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.PiiInFile:
				return new ConditionDisplayPiiInFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileProperty:
				return new ConditionDisplayFileProperty(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.EmbeddedEmail:
				return new ConditionDisplayEmbeddedEmail(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.EmailAdresses:
				return new ConditionDisplayEmailAddresses(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInPDF:
				return new ConditionDisplayHiddenDataInPDF(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.TotalAttachmentSize:
				return new ConditionDisplayTotalAttachmentSize(condition, type);
			default:
				{
					Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
						"CONDITION_INVALID_PREDEFINED",
						"Workshare.PolicyDesigner.Properties.Resources",
						System.Reflection.Assembly.GetExecutingAssembly());
					Logger.LogError(errorMessage.LogString);
					throw new ArgumentException(errorMessage.DisplayString);
				}
			}
		}
Example #6
0
        public void InsertItemAtIndex(int index, ExtendedComboBoxItem item)
        {
            if (index > this.Items.Count - 1)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INVALID_INDEX",
                    "Workshare.PolicyDesigner.Properties.Resources",
                    System.Reflection.Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new ArgumentException(errorMessage.DisplayString);
            }

            this.Items.Insert(index, item);
        }
Example #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="policyObject"></param>
        /// <param name="preDefinedConditionType"></param>
        public static void SetPreDefinedConditionType(IPolicyObject policyObject, ConditionUnitFactory.PreDefinedConditionType preDefinedConditionType)
        {
            if (preDefinedConditionType == ConditionUnitFactory.PreDefinedConditionType.Undefined)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "CONDITION_INVALID_PREDEFINED",
                    "Workshare.PolicyDesigner.Properties.Resources",
                    System.Reflection.Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new ArgumentException(errorMessage.DisplayString);

            }
            policyObject[PreDefinedConditionTypeAttribute].Value = Enum.GetName(typeof(ConditionUnitFactory.PreDefinedConditionType), preDefinedConditionType);
        }
Example #8
0
        public CataloguePolicy(CataloguePolicy rhs, bool readOnly, bool createNewId)
            : base(rhs, readOnly, createNewId)
        {
            if (null == rhs)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_POLICY_NULL",
                    "Workshare.Policy.Properties.Resources",
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
                throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }

            m_status = rhs.Status;
        }
Example #9
0
        protected PolicyObject(PolicyObject rhs)
        {
            if (null == rhs)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "INPUT_POLICY_NULL",
                            "Workshare.Policy.Properties.Resources",
                            Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }

            CopyPolicyObject(rhs, false);
            m_readOnly = rhs.ReadOnly;
        }
Example #10
0
        public ActionFiletype(ActionFiletype rhs, bool readOnly, bool createNewId) 
            : base(rhs, readOnly, createNewId)
        {
            if (rhs == null)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_FILETYPE_NULL",
                    "Workshare.Policy.Properties.Resources", 
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }
            m_fileType  = rhs.m_fileType;
            m_apply = rhs.m_apply;
        }
        public LightSpeedCleanUIController(LightSpeedCleanUserControl control, CleanActionPropertySet properties, string fileType)
		{
            if (!FileTypeValid(fileType))
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage("NOT_VALID_OFFICE_DOC", "Workshare.Policy.Actions.Properties.LanguageResources", Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new CleanUserActionException(errorMessage.DisplayString);
            }
            m_control = control;
            m_fileType = fileType;
			m_properties = properties;
            m_lowSurface = m_control.lowRiskTableLayoutPanel;
            m_medSurface = m_control.mediumRiskTableLayoutPanel;
            m_highSurface = m_control.highRiskTableLayoutPanel;
            m_internalController.ApplyToAll += new EventHandler(m_internalController_ApplyToAll);
        }
Example #12
0
        public DataElement(DataElement rhs, object data)
            : base(rhs)
        {
            if (null == rhs)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_DATAELEMENT_NULL",
                    "Workshare.Policy.Properties.Resources",
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
                throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }

            DataType dataType = rhs.Type;
            SetDefaults(dataType, DataItem.CreateDataItem(rhs.Name, dataType, data), rhs.DisplayName, false);
        }
Example #13
0
        static void OnException(object sender, System.Exception e)
        {
            if (e == null)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                "UNKNOWN_EXCEPTION",
                "Workshare.Policy.Engine.Properties.Resources",
                Assembly.GetExecutingAssembly());
                Logger.LogError(errorMessage.LogString);
                throw new PolicyException(errorMessage.DisplayString);
            }

            if (e.InnerException == null)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                "POLICY_EXCEPTION",
                "Workshare.Policy.Engine.Properties.Resources",
                Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new PolicyEngineException(errorMessage.DisplayString + " " + e.Message);
            }

            // I don't want to throw nxbre exceptions or targetinvocation exceptions... 
            // So I find the first inner exception that is not one of those, and throw that. 

            System.Exception innerException = e.InnerException;
            while (innerException != null)
            {
                if ((innerException.GetType() == typeof(org.nxbre.BREException)) || (innerException.GetType() == typeof(TargetInvocationException)))
                {
                    innerException = innerException.InnerException;
                    continue;
                }

                throw innerException;
            }

            // if we got here then the only exceptions we had were nxbre and targetinvocation exceptions
            // In this scenario we revert back to the default behaviour.
			Utilities.ErrorMessage errorMessage1 = new Utilities.ErrorMessage(
                "POLICY_EXCEPTION",
                "Workshare.Policy.Engine.Properties.Resources",
                Assembly.GetExecutingAssembly());
			Logger.LogError(errorMessage1.LogString);
			throw new PolicyEngineException(errorMessage1.DisplayString + " " + e.Message);
        }
Example #14
0
        private static void ValidateXmlDocument(Type resourceType, XmlDocument xmlDocument, string xpath, string schemaResourceName)
        {
            using (System.IO.Stream schemaStream = PolicyUtilities.GetXmlSchemaFromResource(resourceType, schemaResourceName))
            {
                if (schemaStream == null)
                {
                    Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "FAIL_READ_SCHEMA",
                            "Workshare.Policy.Store.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly(), schemaResourceName);
					Logger.LogError(errorMessage.LogString);
					throw new Workshare.Policy.Exceptions.PolicyException(errorMessage.DisplayString);
                }

                Workshare.Utilities.XmlValidator.Validate(xmlDocument, schemaStream, xpath, ValidationHandler);
            }
        }
Example #15
0
        private XmlNodeList FindParametersChildNodes()
        {
            // iterate through child nodes for the parameters node and skip comment nodes.
            foreach (XmlNode node in m_dataMethodNode.ChildNodes)
            {
                if (node.Name == "Parameters")
                {
                    return node.ChildNodes;
                }
            }

            Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                "WRONG_NUMBER_PARAMS",
                "Workshare.Policy.Store.Properties.Resources",
                System.Reflection.Assembly.GetExecutingAssembly());
			Logger.LogError(errorMessage.LogString);
			throw new Workshare.Policy.Exceptions.PolicyException(errorMessage.DisplayString);
        }
        public static CustomPropertyType StringToCustomPropertyType(string displayName)
        {
            if (0 == String.Compare(Properties.Resources.CUSTOMPROPERTYTYPE_TEXT, displayName))
                return CustomPropertyType.Text;
            //if (0 == String.Compare(Properties.Resources.CUSTOMPROPERTYTYPE_DATE, displayName))
            //    return CustomPropertyType.Date;
            if (0 == String.Compare(Properties.Resources.CUSTOMPROPERTYTYPE_NUMBER, displayName))
                return CustomPropertyType.Number;
            if (0 == String.Compare(Properties.Resources.CUSTOMPROPERTYTYPE_YESNO, displayName))
                return CustomPropertyType.YesNo;

            Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                "TYPE_UNSUPPORTED",
                "Workshare.PolicyDesigner.Properties.Resources",
                System.Reflection.Assembly.GetExecutingAssembly());
			Logger.LogError(errorMessage.LogString);
			throw new ArgumentException(errorMessage.DisplayString);
        }
        private void ReadAction(XmlNode actionNode)
        {
            if (actionNode.Name != "Action")
                return;

            IActionGroup parentActionGroup = m_parent as IActionGroup;
            if (parentActionGroup == null)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "EXPECTED_OBJECT_OF_TYPE",
                            "Workshare.Policy.Store.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly(), " IActionGroup");
				Logger.LogError(errorMessage.LogString);
				throw new Workshare.Policy.Exceptions.ArgumentNullException("m_parent", errorMessage.DisplayString);
            }

            XmlActionReaderFactory.CreateReader(actionNode, m_reader, parentActionGroup, m_xpath).Read();
        }
Example #18
0
        public Condition(Condition condition, bool readOnly, bool createNewId)
            : base(condition, readOnly, createNewId)
        {
            if (null == condition)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_CONDITION_NULL",
                    "Workshare.Policy.Properties.Resources",
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
                throw new Workshare.Policy.Exceptions.ArgumentNullException("condition", errorMessage.DisplayString);
            }

            m_parent = condition.m_parent;
            m_policySetObserver = condition.m_policySetObserver;
            m_isNegated = condition.m_isNegated;
            SetDefaults(condition.Class, condition.Operator, condition.m_dataLeft, createNewId);
        }
Example #19
0
        public static RoutingType ConvertRoutingType(string routingType)
        {
            if (0 == string.Compare(routingType, Properties.Resources.ROUTINGTYPE_LDAP))
            {
                return RoutingType.Ldap;
            }
            else if (0 == string.Compare(routingType, Properties.Resources.ROUTINGTYPE_INTEXT))
            {
                return RoutingType.InternalExternal;
            }

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

        }
        public static PolicyObjectReader CreateReader(XmlNode parentNode, XmlPolicyReader reader, object parent, string xPath)
		{
			switch(parentNode.Name)
			{
                case "Action":
                    return CreateXmlActionReader(parentNode, reader, parent, xPath);
                case "ActionGroup":
                    return CreateXmlActionGroupReader(parentNode, reader, parent, xPath);
                default:
                    {
                        Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "UNKNOWN_READER",
                            "Workshare.Policy.Store.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly());
						Logger.LogError(errorMessage.LogString);
						throw new Workshare.Policy.Exceptions.PolicyException(errorMessage.DisplayString);
                    }
			}
		}
Example #21
0
        /// <summary>
        /// Creates a single delimited string from a string array. The delimiting character
        /// is placed between each string in the array but not at the end
        /// </summary>
        /// <remarks>
        /// If the delimiting character already exists in any of the strings then 
        /// an exception is thrown
        /// </remarks>
        /// <param name="stringArray">The string array to be converted</param>
        /// <param name="delimitingCharacter">The character placed between each of the strings in the array</param>
        /// <returns>The delmiited string</returns>
        public static string StringArrayToDelimitedString(string[] stringArray, char delimitingCharacter)
        {
            if (stringArray == null || stringArray.Length == 0)
            {
                return String.Empty;
            }

            int stringLength = 0;
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (stringArray[i] != null)
                {
                    stringLength += stringArray[i].Length;
                }
            }

            StringBuilder sb = new StringBuilder(stringLength + stringArray.Length);
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (stringArray[i] != null)
                {
                    if (stringArray[i].Contains(delimitingCharacter.ToString()))
                    {
                        Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "STRINGARRAY_CONTAINS_DELIM",
                            "Workshare.Policy.Engine.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly());
						Logger.LogError(errorMessage.LogString);
						throw new Workshare.Policy.Exceptions.PolicyEngineException(errorMessage.DisplayString);
                    }
                    sb.Append(stringArray[i] + delimitingCharacter);
                }
            }

            // Remove the final delimiting character, if it exists
            if (sb.Length >= 1)
            {
                return sb.ToString(0, sb.Length - 1);
            }

            return String.Empty;
        }
Example #22
0
        private Guid GetCsvLanguageId(string csv)
        {
            int startIndex = csv.IndexOf("{");
            if (-1 == startIndex)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage("INVALID_CSV_FILE", "Workshare.PolicyDesigner.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
                throw new CSVException(errorMessage.DisplayString);
            }

            int endIndex = csv.IndexOf("}", startIndex);
            if (-1 == endIndex)
            {
				Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage("INVALID_CSV_FILE", "Workshare.PolicyDesigner.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new CSVException(errorMessage.DisplayString);
            }

            return new Guid(csv.Substring(startIndex, (endIndex - startIndex) + 1));
        }
Example #23
0
        public DataElement(DataElement rhs, bool readOnly, bool createNewId)
            : base(rhs, readOnly, createNewId)
        {
            if (rhs == null)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "INPUT_DATAELEMENT_NULL",
                    "Workshare.Policy.Properties.Resources",
                    Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new Workshare.Policy.Exceptions.ArgumentNullException("rhs", errorMessage.DisplayString);
            }

            object data = CopyDataItem(rhs, createNewId);
            if (data == null)
            {
                data = CopyDataSource(rhs, createNewId);
            }

            SetDefaults(rhs.Type, data, rhs.DisplayName, createNewId);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public string GetDisplayName()
        {
            try
            {
                string displayName = GetDisplayNameFromDataItems();
                ((IDataElement)Object).DisplayName.Value = displayName;
                return displayName;
            }
            catch (PolicyDesignerException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "PARAMETER_INVALID",
                    "Workshare.PolicyDesigner.Properties.Resources",
                    System.Reflection.Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new PolicyDesignerException(errorMessage.DisplayString, ex);
            }
        }
        public static string CustomPropertyTypeToString(CustomPropertyType type)
        {
            switch (type)
            {
                case CustomPropertyType.Text:
                    return Properties.Resources.CUSTOMPROPERTYTYPE_TEXT;
                //case CustomPropertyType.Date:
                //    return Properties.Resources.CUSTOMPROPERTYTYPE_DATE;
                case CustomPropertyType.Number:
                    return Properties.Resources.CUSTOMPROPERTYTYPE_NUMBER;
                case CustomPropertyType.YesNo:
                    return Properties.Resources.CUSTOMPROPERTYTYPE_YESNO;
                default:
                    {
                        Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "TYPE_UNSUPPORTED",
                            "Workshare.PolicyDesigner.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly());
						Logger.LogError(errorMessage.LogString);
						throw new ArgumentException(errorMessage.DisplayString);
                    }
            }
        }
Example #26
0
        /// <summary>
        /// Executes when the state is entered
        /// </summary>
        public override void Enter()
        {
            if (ActionSource.FromCatalogue == m_actionSource)
            {
                AddActionFromCatalogue();
            }
            else if (ActionSource.New == m_actionSource)
            {
                AddNewAction();
            }
            else
            {
                Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                    "ACTION_UNKNOWN_SOURCE", "Workshare.PolicyDesigner.Properties.Resources",
                    System.Reflection.Assembly.GetExecutingAssembly());
				Logger.LogError(errorMessage.LogString);
				throw new ArgumentException(errorMessage.DisplayString);
            }
        }
Example #27
0
        public static void AddCollectionToAddressGroup(IRoutingTable routingTable, IRoutingItemCollections addressGroup, IRoutingItemCollection addressCollection)
        {
            if (null == routingTable)
            {
                Debug.Assert(false);
                return;
            }

            bool isSender = Object.ReferenceEquals(routingTable.Sources, addressGroup);
            bool isDestination = Object.ReferenceEquals(routingTable.Destinations, addressGroup);

            if (!isSender && !isDestination)
            {
				// 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);
            }


            if (!CanEditRoutingItemCollections(routingTable, isSender))
            {
                return;
            }

            if (isSender)
            {
				// Adding location collection to sources group
                routingTable.Sources.Add(addressCollection);

                foreach (IRoutingItemCollection recipients in routingTable.Destinations)
                {
                    IRoutingMatrixCell routingMatrixCell = routingTable[addressCollection.Identifier, recipients.Identifier];
                    routingMatrixCell.Name = new NonTranslateableLanguageItem(addressCollection.Name.Value + Properties.Resources.ROUTING_TO_LOWER + recipients.Name.Value);
                }

                if (2 == routingTable.Sources.Count)
                {
                    IRoutingItemCollection defaultSenders = routingTable.DefaultSource;
                    defaultSenders.Name.Value = Properties.Resources.ROUTING_EVERYONEELSE;
                }
            }
            else
            {
                // Adding location collection to destinations group
                routingTable.Destinations.Add(addressCollection);

                foreach (IRoutingItemCollection senders in routingTable.Sources)
                {
                    IRoutingMatrixCell routingMatrixCell = routingTable[senders.Identifier, addressCollection.Identifier];
                    if (senders == routingTable.DefaultSource)
                    {
                        routingMatrixCell.Name = new NonTranslateableLanguageItem(Properties.Resources.ROUTING_TO + addressCollection.Name.Value);
                    }
                    else
                    {
                        routingMatrixCell.Name = new NonTranslateableLanguageItem(senders.Name.Value + Properties.Resources.ROUTING_TO_LOWER + addressCollection.Name.Value);
                    }
                }

                if (2 == routingTable.Destinations.Count)
                {
                    IRoutingItemCollection defaultRecipients = routingTable.DefaultDestination;
                    defaultRecipients.Name.Value = Properties.Resources.ROUTING_EVERYONEELSE;
                }
            }
                        
            RefreshRoutingMatrixTablePrecedences(routingTable);
        }
Example #28
0
        public static RoutingType GetChannelDefaultRouting(ChannelType channel)
        {
            switch (channel)
            {
                case ChannelType.Default: return RoutingType.SingleCell;
                case ChannelType.SMTP: return RoutingType.InternalExternal;
                case ChannelType.HTTP: return RoutingType.SingleCell;
                case ChannelType.ActiveContent: return RoutingType.SingleCell;
                case ChannelType.RemoveableDevice: return RoutingType.LdapToDevice;
                case ChannelType.Mta: return RoutingType.Mta;
            }
            Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                "CHANNEL_UNSUPPORTED",
                "Workshare.PolicyDesigner.Properties.Resources",
                System.Reflection.Assembly.GetExecutingAssembly());
			Logger.LogError(errorMessage.LogString);
			throw new ArgumentException(errorMessage.DisplayString);
        }
Example #29
0
        public static string ConvertRoutingType(RoutingType routingType)
        {
            switch (routingType)
            {
                case RoutingType.Ldap:
                    return Properties.Resources.ROUTINGTYPE_LDAP;
                case RoutingType.InternalExternal:
                    return Properties.Resources.ROUTINGTYPE_INTEXT;
                case RoutingType.LdapToDevice:
                default:
                    {
                        Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
                            "ROUTINGTYPE_UNSUPPORTED",
                            "Workshare.PolicyDesigner.Properties.Resources",
                            System.Reflection.Assembly.GetExecutingAssembly(), routingType);
						Logger.LogError(errorMessage.LogString);
						throw new ArgumentException(errorMessage.DisplayString);
                    }
            }
        }
Example #30
0
        public static RoutingHelper.RoutingType GetRoutingType(IRoutingTable routingTable)
        {
            // Only InternalExternal routing tables will have this property populated.
            if (IsInternalExternalRoutingTable(routingTable))
            {
                return RoutingHelper.RoutingType.InternalExternal;
            }

            if (ChannelType.Default == routingTable.Type)
            {
                return RoutingHelper.RoutingType.SingleCell;
            }

            if (ChannelType.SMTP == routingTable.Type)
            {
                return RoutingHelper.RoutingType.Ldap;
            }

            if ((ChannelType.HTTP == routingTable.Type) || (ChannelType.ActiveContent == routingTable.Type))
            {
                return RoutingHelper.RoutingType.SingleCell;
            }

            if (ChannelType.RemoveableDevice == routingTable.Type)
            {
                return RoutingHelper.RoutingType.LdapToDevice;
            }

            if (ChannelType.Mta == routingTable.Type)
            {
                return RoutingHelper.RoutingType.Mta;
            }

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