private RuleObject[] GetHyperlinks() { try { IDataElement fileTypeDataElement = null; IDataElement piiTypeDataElement = null; if (m_condition != null) { // DataLeft of the condition is the main PII detection method call. // Parameters are "file", "fileType", "piiType" IDataSource dataSource = (IDataSource)m_condition.DataLeft.Data; fileTypeDataElement = dataSource.Method.Parameters[1].Value; piiTypeDataElement = dataSource.Method.Parameters[2].Value; } // Working with all file types at the moment...err Not really. 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); } } // Setup pii type list PiiType[] piiTypeArray = (PiiType[])Enum.GetValues(typeof(PiiType)); PiiTypeList piiTypes = new PiiTypeList(piiTypeArray); // Setup parameters m_fileTypeData = new ConditionDisplayParameterFileType(fileTypeDataElement, this.EditFileTypeParameter, availableFileTypes, m_type); m_piiType = new ConditionDisplayParameterPiiType(piiTypeDataElement, this.EditPiiTypeParameter, piiTypes, m_type); RuleObject[] hyperlinks = { m_fileTypeData, m_piiType }; return hyperlinks; } catch (Exception ex) { string msg = "Not a valid PiiInFile condition"; Logger.LogError(msg); Logger.LogError(ex); throw new ArgumentException(msg, ex); } }
/// <summary> /// Creates hyperlink representation of the editable parameters within the condition /// </summary> /// <returns>An array of RuleObject objects representing the editable parameters</returns> protected virtual RuleObject[] GetHyperlinks() { try { IDataElement fileTypeDataElement = null; IDataElement hiddenDataDataElement = null; if (m_condition != null) { IDataSource dataSource = m_condition.DataLeft.Data as IDataSource; fileTypeDataElement = dataSource.Method.Parameters[1].Value; hiddenDataDataElement = dataSource.Method.Parameters[3].Value; //ignore file parameter (dataSource.Method.Parameters[0].Value) as not editable //ignore content parameter (dataSource.Method.Parameters[2].Value) as not editable } //work out what file types have hidden data Array enumTypes = Enum.GetValues(typeof(Policy.FileType)); List<Policy.FileType> availableFileTypes = new List<Policy.FileType>(); foreach (Policy.FileType type in enumTypes) { if (type != Policy.FileType.PDFDocument) // We have a PDF Hidden Data condition { if (FileTypeToHiddenDataMapper.FileTypeHasHiddenData(type)) { availableFileTypes.Add(type); } } } m_fileTypeData = new ConditionDisplayParameterFileType(fileTypeDataElement, this.EditFileTypeParameter, availableFileTypes, m_type); 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_fileTypeData, 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> /// 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 contentDataElement = null; IDataElement contextDataElement = null; IDataElement matchWholeWordDataElement = null; if (m_condition != null) { IDataSource dataSource = (IDataSource)m_condition.DataLeft.Data; fileTypeDataElement = dataSource.Method.Parameters[1].Value as IDataElement; contentDataElement = dataSource.Method.Parameters[2].Value as IDataElement; contextDataElement = dataSource.Method.Parameters[3].Value as IDataElement; matchWholeWordDataElement = dataSource.Method.Parameters[4].Value as IDataElement; } //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_type); m_contentData = new ConditionDisplayParameterContent(contentDataElement, matchWholeWordDataElement, this.EditContentParameter, m_type); List<ConditionUnitFactory.FileContextType> enumContextTypes = null; List<Workshare.Policy.FileType> types = GetCurrentFileTypes(); if (null != types) enumContextTypes = FileTypeToContextMapper.Instance.GetContextsForFileType(types, m_type); m_contextData = new ConditionDisplayParameterContext(contextDataElement, this.EditContextParameter, enumContextTypes, m_type); RuleObject[] hyperlinks = { m_fileTypeData, m_contentData, m_contextData }; return hyperlinks; } catch (Exception ex) { ArgumentException argumentException = new ArgumentException("Not a valid ContentInFileContext condition.", ex); Logger.LogError(argumentException.Message); Logger.LogError(ex); throw argumentException; } }
/// <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 documentRestrictionDataElement = null; if (m_condition != null) { fileTypeDataElement = ((IDataSource)m_condition.DataLeft.Data).Method.Parameters[1].Value as IDataElement; documentRestrictionDataElement = ((IDataSource)m_condition.DataLeft.Data).Method.Parameters[4].Value as IDataElement; } //file types m_fileTypeData = new ConditionDisplayParameterFileType(fileTypeDataElement, this.EditFileTypeParameter, DocumentRestrictionUtils.Instance.SupportedFileTypes(), m_type); //Document restriction m_documentRestrictionData = new ConditionDisplayParameterDocumentRestriction(documentRestrictionDataElement, this.EditDocumentRestrictionParameter, m_type); RuleObject[] hyperlinks = { m_fileTypeData, m_documentRestrictionData }; return hyperlinks; } catch (Exception ex) { ArgumentException argumentException = new ArgumentException("Not a valid DocumentRestriction condition", ex); Logger.LogError(argumentException.Message); Logger.LogError(ex); throw argumentException; } }
/// <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 = ((IDataSource)m_condition.DataLeft.Data).Method.Parameters[1].Value as IDataElement; } //work out what file types have passwords 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 (FileTypeToPasswordMapper.Instance.FileTypeHasPassword(type)) { availableFileTypes.Add(type); } } m_fileTypeData = new ConditionDisplayParameterFileType(dataElement, this.EditFileTypeParameter, availableFileTypes, m_type); RuleObject[] hyperlinks = { m_fileTypeData }; return hyperlinks; } catch (Exception ex) { string msg = "Not a valid FileType condition"; Logger.LogError(msg); Logger.LogError(ex); throw new ArgumentException(msg, ex); } }