/// <summary> /// Creates hyperlink representation of the editable parameters within the condition /// </summary> /// <returns>An array of RuleObject objects representing the editable parameters</returns> private RuleObject[] GetHyperlinks() { try { IDataElement dataElement = null; if (m_condition != null) { dataElement = m_condition.DataRight; } m_regexData = new ConditionDisplayParameterRegex(dataElement, this.EditFileNameParameter, m_type); RuleObject[] hyperlinks = { m_regexData }; return hyperlinks; } catch (Exception ex) { Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage( "REGEX_INVALID", "Workshare.PolicyDesigner.Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly()); Logger.LogError(errorMessage.LogString); throw new ArgumentException(errorMessage.DisplayString, ex); } }
/// <summary> /// Creates hyperlink representation of the editable parameters within the condition /// </summary> /// <returns>An array of RuleObject objects representing the editable parameters</returns> private RuleObject[] GetHyperlinks() { try { IDataElement fileTypeDataElement = null; IDataElement regexDataElement = null; IDataElement contextDataElement = null; if (m_condition != null) { IDataSource dataSource = (IDataSource)m_condition.DataLeft.Data; fileTypeDataElement = (IDataElement)dataSource.Method.Parameters[1].Value; regexDataElement = (IDataElement)dataSource.Method.Parameters[2].Value; contextDataElement = (IDataElement)dataSource.Method.Parameters[3].Value; } //work out what file types have contexts Array enumTypes = Enum.GetValues(typeof(Workshare.Policy.FileType)); List<Workshare.Policy.FileType> availableFileTypes = new List<Workshare.Policy.FileType>(); foreach (Workshare.Policy.FileType type in enumTypes) { if (FileTypeToContextMapper.Instance.FileTypeHasContext(type)) { availableFileTypes.Add(type); } } m_fileTypeData = new ConditionDisplayParameterFileType(fileTypeDataElement, this.EditFileTypeParameter, availableFileTypes); m_regexData = new ConditionDisplayParameterRegex(regexDataElement, this.EditContentParameter); List<ConditionUnitFactory.FileContextType> enumContextTypes = null; List<Workshare.Policy.FileType> types = GetCurrentFileTypes(); if (null != types) enumContextTypes = FileTypeToContextMapper.Instance.GetContextsForFileType(types); m_contextData = new ConditionDisplayParameterContext(contextDataElement, this.EditContextParameter, enumContextTypes); RuleObject[] hyperlinks = { m_fileTypeData, m_regexData, m_contextData }; return hyperlinks; } catch (Exception ex) { string msg = Not a valid RegexInFileContext condition"; Logger.LogError(msg); Logger.LogError(ex); throw new ArgumentException(msg, ex); } }