private IPolicyObjectCollection<IPolicyObject> BuildConditions()
        {
            DataMethod dataMethod = new DataMethod("Test method");
            dataMethod.Parameters.Add(new Parameter("FindSomething", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "missing")));
            dataMethod.Parameters.Add(new Parameter("RunSomething", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "just do it!")));
            DataSource dataSource = new DataSource("Testme.dll", "TestMe", dataMethod);

            ICondition subCondition = new Condition(new Guid("{6B7F6B0C-747A-4BD0-A65D-A1FB9E44FE7C}"), "ITestOne", OperatorType.GreaterThan);
            subCondition.DataLeft = new DataElement(new Guid("{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}"), new TranslateableLanguageItem("Do testing stuff"), new TranslateableLanguageItem(""), DataType.Object, dataSource);
            IDataItem dataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("Test data item"), DataType.Long, "10");
            subCondition.DataRight = new DataElement(new Guid("{EB56B397-954D-45C2-ADBA-263372A8B59F}"), new TranslateableLanguageItem("Test data item stored in data element"), new TranslateableLanguageItem(""), DataType.Long, dataItem);

            IConditionGroup subConditionGroup = new ConditionGroup(new Guid("{661EDD6F-D750-493A-9932-E56C8C22E2CF}"), new TranslateableLanguageItem("Test group two"), ConditionLogic.AND, false);
            subConditionGroup.Conditions.Add(subCondition);
            IConditionGroup conditionGroup = new ConditionGroup(new Guid("{D64056E5-A19D-4B29-8F4A-A70337B42A19}"), new TranslateableLanguageItem("Test group one"), ConditionLogic.OR, true);
            conditionGroup.Conditions.Add(subConditionGroup);

            DataMethod dataMethod2 = new DataMethod("Test method two");
            dataMethod2.Parameters.Add(new Parameter("DoIt", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "You should do this")));
            dataMethod2.Parameters.Add(new Parameter("DontDoIt", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "You should not do this")));
            DataSource dataSource2 = new DataSource("Test2.dll", "JustDoIt", dataMethod2);

            ICondition condition = new Condition(new Guid("{A6F876B6-AD6D-4842-BC0D-4635D1EEE916}"), "ITestTwo", OperatorType.GreaterThanOrEqualTo);
            condition.DataLeft = new DataElement(new Guid("{7CED5561-FD8C-423C-838F-9440EDFE6758}"), new TranslateableLanguageItem("Some data source"), new TranslateableLanguageItem(""), DataType.Object, dataSource2);
            IDataItem dataItem2 = DataItem.CreateDataItem(new TranslateableLanguageItem("Test data item 2"), DataType.Long, "2");
            condition.DataRight = new DataElement(new Guid("{C6E38158-AB8C-496B-B97D-FD413680977D}"), new TranslateableLanguageItem("Test result2"), new TranslateableLanguageItem(""), DataType.Long, dataItem2);

            IPolicyObjectCollection<IPolicyObject> conditions = new PolicyObjectCollection<IPolicyObject>();
            conditions.Add(conditionGroup);
            conditions.Add(condition);

            return conditions;
        }
Example #2
0
 public DataSource(DataSource rhs, bool readOnly, bool createNewId)
     : base(rhs, readOnly, createNewId)
 {
     m_assembly = rhs.m_assembly;
     if (rhs.m_dataMethod != null)
         m_dataMethod = (rhs.m_dataMethod as DataMethod).DeepCopy(readOnly, createNewId);
 }
Example #3
0
 // HACK 
 private void AddLdapLookupHACK()
 {
     Workshare.Policy.ObjectModel.DataMethod dm = null;
     Workshare.Policy.ObjectModel.IDataSource ds = new Workshare.Policy.ObjectModel.DataSource("Workshare.DirectorySearcher.dll",
         "Workshare.DirectorySearcher.DirectoryAnalyzer", dm);
     
     AddCondition(ds, "LDAPAnalyzer");
 }
Example #4
0
        private void AddInternalExternalLookupHACK()
        {
            Workshare.Policy.ObjectModel.DataMethod dm = null;
            Workshare.Policy.ObjectModel.IDataSource ds = new Workshare.Policy.ObjectModel.DataSource("Workshare.InternalExternalResolver.dll",
                "Workshare.InternalExternalResolver", dm);

            AddCondition(ds, "InternalExternalResolver");
        }
        public DataSource Read()
        {
            if (m_dataSourceNode == null)
                throw new Workshare.Policy.Exceptions.ArgumentNullException("m_dataSourceNode", "Data source node is null");

            XmlAttributeCollection attributes = m_dataSourceNode.Attributes;
            if (attributes == null)
                throw new Workshare.Policy.Exceptions.ArgumentNullException("attributes", "Data source node does not have attributes");

            List<string> exclusions = new List<string>();
            exclusions.Add("assembly");
            exclusions.Add("class");
            exclusions.Add("readonly");

            string assemblyName = attributes.GetNamedItem(exclusions[0]).InnerText;
            string className = attributes.GetNamedItem(exclusions[1]).InnerText;
            IDataMethod dataMethod = ReadDataMethod(m_dataSourceNode);
            DataSource dataSource = new DataSource(assemblyName, className, dataMethod);
            new XmlCustomAttributesReader(dataSource, attributes, exclusions).Read();

            return dataSource;
        }
        private ActionGroup BuildActionGroup()
        {
            DataMethod dataMethod = new DataMethod("Test method");
            dataMethod.Parameters.Add(new Parameter("FindSomething", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "missing")));
            dataMethod.Parameters.Add(new Parameter("RunSomething", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "just do it!")));
            DataSource dataSource = new DataSource("Testme.dll", "TestMe", dataMethod);

            ObjectModel.IAction subAction = new ObjectModel.Action(new Guid("{72551FD1-D46D-4AF6-8DA3-76B5BCE01FD8}"), "CustomAction2.dll", "Test.Publish", RunAt.Server, true, 1); //TODO JE
            subAction.DataElements.Add(new DataElement(new Guid("{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}"), new TranslateableLanguageItem("Do testing stuff"), new TranslateableLanguageItem("Do testing stuff"), DataType.Object, dataSource));

            IActionGroup subActionGroup = new ObjectModel.ActionGroup(new Guid("{BBEF6879-6D10-455D-A5D9-86D9B8B725A6}"), new TranslateableLanguageItem("Test sub action group"), 1);
            subActionGroup.Actions.Add(subAction);

            ActionGroup actionGroup = new ObjectModel.ActionGroup(new Guid("{987B7C8B-5ADD-4696-8456-DDE11D95CE0B}"), new TranslateableLanguageItem("Test action group"), 1);
            actionGroup.ActionGroups.Add(subActionGroup);

            IDataItem dataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("Test data item"), DataType.Long, "10");
            ObjectModel.IAction action = new ObjectModel.Action(new Guid("{26BCFA7E-3605-4EE7-ACC6-0AFB4D5EBB71}"), "CustomAction.dll", "Test.Clean", RunAt.Client, false, 1); //TODO JE
            action.DataElements.Add(new DataElement(new Guid("{EB56B397-954D-45C2-ADBA-263372A8B59F}"), new TranslateableLanguageItem("Test data item stored in data element"), new TranslateableLanguageItem("Test data item stored in data element"), DataType.Long, dataItem));
            actionGroup.Actions.Add(action);

            return actionGroup;
        }
		/// <summary>
		/// An expression for selection based on file type containing a WSRestrictionLevel custom property. This
		/// is needed for backwards compatibility with documents worked on by older versions of our software
		/// </summary>
		/// <returns></returns>
		private static ICondition CreateDocumentRestrictionsCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataComparer", new TranslateableLanguageItem(""), OperatorType.Equals);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.DocumentRestrictions);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);
			CustomAttributes.SetConditionSummary(condition, "");

			//dataleft
			IDataMethod method = new DataMethod("RestrictionPropertyMatchInFileType");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//file types parameter
			method.Parameters.Add(CreateFileTypesParameter());

			//custom property type parameter
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("customPropertyType"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(CustomPropertyType), CustomPropertyType.Text)));
			parameter = new Parameter("customPropertyType", dataElement);
			method.Parameters.Add(parameter);

			//custom property name parameter
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("customPropertyName"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, "WSRestrictionLevel"));
			parameter = new Parameter("customPropertyName", dataElement);
			method.Parameters.Add(parameter);

			//custom property value parameter
			IDataItem dataItem = DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Convert.ToString((int) DocumentRestriction.External, System.Globalization.CultureInfo.InvariantCulture));
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("customPropertyValue"), new NonTranslateableLanguageItem(""), DataType.String, dataItem);
			parameter = new Parameter("customPropertyValue", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.RestrictionAnalyzer", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("propertyMatchInFileType"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("numberOfOccurrences"), new NonTranslateableLanguageItem(""), DataType.Boolean, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Boolean, true));
			condition.DataRight = dataElement;

			return condition;
		}
		private static ICondition CreateCustomPropertyCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataComparer", new TranslateableLanguageItem(""), OperatorType.Equals);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.CustomProperty);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);
			CustomAttributes.SetConditionSummary(condition, "");

			//dataleft
			IDataMethod method = new DataMethod("PropertyMatch");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//custom property type parameter
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("customPropertyType"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(CustomPropertyType), CustomPropertyType.Text)));
			parameter = new Parameter("customPropertyType", dataElement);
			method.Parameters.Add(parameter);

			//custom property name parameter
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("customPropertyName"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYNAME_DEFAULT));
			parameter = new Parameter("customPropertyName", dataElement);
			method.Parameters.Add(parameter);

			//custom property value parameter
			IDataItem dataItem = DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Properties.Resources.IDS_EXPRESSION_PARAM_CUSTOMPROPERTYVALUE_DEFAULT);
			//CustomAttributes.SetCustomPropertyType(dataItem, CustomPropertyType.Text);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("customPropertyValue"), new NonTranslateableLanguageItem(""), DataType.String, dataItem);
			parameter = new Parameter("customPropertyValue", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.CustomPropertyAnalyzer", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.Boolean, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Boolean, Boolean.TrueString));
			condition.DataRight = dataElement;

			return condition;
		}
        public void TestWriteReadOnlyDataElement()
        {
            Guid languageGuid = new Guid("{054846D4-6540-4C78-BA7D-141C91EE6A4C}");
            PolicyLanguage language = new PolicyLanguage(languageGuid, "en");
            language[new Guid("{D0FE23B8-B8A0-4DD6-A0F1-A7836DC0417E}")] = "Test catalogue";
            language[new Guid("{A081481C-D500-4AB0-B06F-2121ED997C7B}")] = "F**k";
            language[new Guid("{EBA1218A-86D7-485E-B0DE-B782E06A3853}")] = "Profanity lookup";
            language[new Guid("{82FE95F5-C980-4C88-974C-BDB6D6B64238}")] = "Discrimination lookup";
            language[new Guid("{275B2185-8CA9-408D-A87A-FE78E14AC443}")] = "Test result zero";
            language[new Guid("{F7A2FC86-35C4-4BD8-964D-6D34487332F6}")] = "Test result2";
            language[new Guid("{E0F11C4B-ED1F-4410-8E12-3BED0A13FEF1}")] = "Some text";
            language[new Guid("{EAFA2918-9EC0-4696-B7EC-A0941E18F9AE}")] = "";

            XmlPolicyLanguageStore languageStore = XmlPolicyLanguageStore.Instance;
            languageStore.AddLanguage(language);
            
            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            catalogueStore.Reset();
            IPolicyObjectCollection<IPolicyCatalogue> policyCatalogues = new PolicyObjectCollection<IPolicyCatalogue>();
            policyCatalogues.Add(new PolicyCatalogue(catalogueStore, languageGuid));

            Guid catalogueId = new Guid("{B496E117-29DA-4770-87E9-62573B28BB4F}");
            XmlPolicyCatalogueWriter catalogueWriter = catalogueStore.GetWriter(catalogueId, languageGuid) as XmlPolicyCatalogueWriter;
            Assert.IsNotNull(catalogueWriter, "Expected a valid [IPolicyStoreWriter] writer");

            catalogueWriter.WriteName("{D0FE23B8-B8A0-4DD6-A0F1-A7836DC0417E}");

            DataMethod dataMethod = new DataMethod("TextLookupCount");
            dataMethod.Parameters.Add(new Parameter("content", new DataElement(new TranslateableLanguageItem("content"), new NonTranslateableLanguageItem(""), DataType.String, "{A081481C-D500-4AB0-B06F-2121ED997C7B}")));
            dataMethod.Parameters.Add(new Parameter("context", new DataElement(new TranslateableLanguageItem("context"), new NonTranslateableLanguageItem(""), DataType.String, "Paragraph")));
            DataSource dataSource = new DataSource("Workshare.DocInspector.dll", "ContentAnalyzer", dataMethod);
            string dataElementGuid = "{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}";
            DataElement dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{EBA1218A-86D7-485E-B0DE-B782E06A3853}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);

            catalogueWriter.WriteDataElement(dataElement.DeepCopy(true) as IDataElement);

            dataMethod = new DataMethod("TextLookupCount");
            dataMethod.Parameters.Add(new Parameter("embedded", dataElement));
            dataMethod.Parameters.Add(new Parameter("content", new DataElement(new TranslateableLanguageItem("content"), new NonTranslateableLanguageItem(""), DataType.Long, (long)0)));
            dataMethod.Parameters.Add(new Parameter("context", new DataElement(new TranslateableLanguageItem("context"), new NonTranslateableLanguageItem(""), DataType.String, "Paragraph")));
            dataMethod.Parameters.Add(new Parameter("number", new DataElement(
                new Guid("{4455FD9C-16E5-415b-880A-625FEEB15BB7}"), new TranslateableLanguageItem("{E0F11C4B-ED1F-4410-8E12-3BED0A13FEF1}"), new NonTranslateableLanguageItem(""), DataType.Long, DataItem.CreateDataItem(new TranslateableLanguageItem("{EAFA2918-9EC0-4696-B7EC-A0941E18F9AE}"), DataType.Long, 120))));

            dataSource = new DataSource("Workshare.DocInspector.dll", "ContentAnalyzer", dataMethod);
            dataElementGuid = "{7CED5561-FD8C-423C-838F-9440EDFE6758}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{82FE95F5-C980-4C88-974C-BDB6D6B64238}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
            catalogueWriter.WriteDataElement(dataElement);

            dataElementGuid = "{EB56B397-954D-45C2-ADBA-263372A8B59F}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{275B2185-8CA9-408D-A87A-FE78E14AC443}"), new NonTranslateableLanguageItem(""), DataType.Long, DataItem.CreateDataItem(new TranslateableLanguageItem("{EAFA2918-9EC0-4696-B7EC-A0941E18F9AE}"), DataType.Long, 0));
            catalogueWriter.WriteDataElement(dataElement);

            dataElementGuid = "{C6E38158-AB8C-496B-B97D-FD413680977D}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{F7A2FC86-35C4-4BD8-964D-6D34487332F6}"), new NonTranslateableLanguageItem(""), DataType.Long, DataItem.CreateDataItem(new TranslateableLanguageItem("{EAFA2918-9EC0-4696-B7EC-A0941E18F9AE}"), DataType.Long, 2));
            catalogueWriter.WriteDataElement(dataElement);

            catalogueWriter.Close();

            TestHelpers.CompareXml(m_testPath + "ExpectedWriteReadOnlyDataElement.xml", catalogueStore.GetStoreXML(catalogueId));
        }
		private static ICondition CreateEmbeddedEmailCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataComparer", new TranslateableLanguageItem(""), OperatorType.Equals);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.EmbeddedEmail);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);
			CustomAttributes.SetConditionSummary(condition, "");

			//dataleft
			IDataMethod method = new DataMethod("IsEmail");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//  Data source for method
			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.EmailAnalyzer", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("propertyMatchInFileType"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("numberOfOccurrences"), new NonTranslateableLanguageItem(""), DataType.Boolean, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Boolean, true));
			condition.DataRight = dataElement;

			return condition;
		}
		private static ICondition CreatePiiInFileCondition()
		{
			ICondition condition = new Condition(Guid.NewGuid(), "IDataLengthComparer", new TranslateableLanguageItem(""), OperatorType.GreaterThan);

			// condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.PiiInFile);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);

			// dataleft
			IDataMethod method = new DataMethod("PiiLookupInFile");

			// file parameters
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//file types parameter
			method.Parameters.Add(CreateFileTypesParameter());

			//pii parameter
			IPolicyObjectCollection<IDataItem> collection = new PolicyObjectCollection<IDataItem>();
			collection.Add(DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(PiiType), PiiType.SocialSecurityNumber)));
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("pii"), new NonTranslateableLanguageItem(""), DataType.StringArray, collection);
			parameter = new Parameter("Pii", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Conditions.PiiInspection.dll", "Workshare.Policy.Conditions.PiiInspector", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("piiInFile"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("numberOfOccurrences"), new NonTranslateableLanguageItem(""), DataType.Long, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Long, 0));
			condition.DataRight = dataElement;

			return condition;
		}
Example #12
0
		private DataElement BuildDataLeft(DataMethod dm)
		{
			DataSource ds = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.ContentAnalysis", dm);
			DataElement dl = new DataElement(new TranslateableLanguageItem(""), new TranslateableLanguageItem(""), DataType.Object, ds);
			return dl;
		}
Example #13
0
		private DataElement BuildCurrentFile()
		{
			DataMethod dmCurFile = new DataMethod("CurrentFile");
			DataSource dsCurFile = new DataSource("this", "this", dmCurFile);
			DataElement currentFile = new DataElement(new TranslateableLanguageItem("currentFile"), new TranslateableLanguageItem(""), DataType.Object, dsCurFile);
			return currentFile;
		}
 public void TestObjectType()
 {
     DataSource dataSource = new DataSource("Test.dll", "Test.Framework", new DataMethod("Test method"));
     DataElement dataElement = new DataElement(new TranslateableLanguageItem("Test data element"), new TranslateableLanguageItem(""), DataType.Object, dataSource);
 }
        private bool DoesDataSourceContainFilter(DataSource dataSource)
        {
            if (null == dataSource)
                return false;

            foreach (IParameter parameter in dataSource.Method.Parameters)
            {
                if (DoesDataItemContainFileType(parameter.Value.Data as IDataItem))
                    return true;
                else if (DoesDataItemsContainFileType(parameter.Value.Data as IPolicyObjectCollection<IDataItem>))
                    return true;
            }

            return false;
        }
        public void TestWriteParameterAttributes()
        {
            Guid languageId = new Guid("{CBEB31FA-7FE8-4E27-A01A-1D19AFCA604C}");
            PolicyLanguage language = new PolicyLanguage(languageId, "en");
            language[new Guid("{B067FF7F-2DA0-4AA1-A69F-DEFCD8B4CE90}")] = "Test data element";
            language[new Guid("{EBF8443B-4912-44F2-89BE-A0A055332D1B}")] = "This is my first custom property";
            language[new Guid("{8053E60C-EED7-464D-84EA-ECB51C291237}")] = "This is my second custom property";

            XmlPolicyLanguageStore languageStore = XmlPolicyLanguageStore.Instance;
            languageStore.AddLanguage(language);

            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            catalogueStore.Reset();

            Guid catalogueGuid = new Guid("{8CF1172E-476C-46A5-AECF-A7A8BC5ACE30}");
            PolicyCatalogue policyCatalogue = new PolicyCatalogue(catalogueGuid, languageId, catalogueStore);

            DataMethod dataMethod = new DataMethod("TestMethod");
            DataElement parameterDataElement = new DataElement(new TranslateableLanguageItem("A data item"), new NonTranslateableLanguageItem(""), DataType.String, "Test");
            Parameter parameter = new Parameter("Run", parameterDataElement);
            parameter["custom1"] = new TranslateableLanguageItem("{EBF8443B-4912-44F2-89BE-A0A055332D1B}");
            parameter["custom2"] = new TranslateableLanguageItem("{8053E60C-EED7-464D-84EA-ECB51C291237}");
            dataMethod.Parameters.Add(parameter);

            DataSource dataSource = new DataSource("TestMe.dll", "Test.Me", dataMethod);
            DataElement dataElement = new DataElement(new Guid("{8E915159-5F01-41B3-9FFF-20731544ADFA}"), new TranslateableLanguageItem("{B067FF7F-2DA0-4AA1-A69F-DEFCD8B4CE90}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);

            IPolicyCatalogueWriter policyCatalogueWriter = catalogueStore.GetWriter(catalogueGuid, languageId);
            policyCatalogueWriter.WriteName("Test catalogue");
            policyCatalogueWriter.WriteDataElement(dataElement);
            policyCatalogueWriter.Close();

            TestHelpers.CompareXml(m_testPath + "ExpectedWriteParameterAttributes.xml", catalogueStore.GetXMLRepresentation(catalogueGuid));
        }
        public void TestWriteReadOnlyDataSource()
        {
            Guid languageGuid = new Guid("{054846D4-6540-4C78-BA7D-141C91EE6A4C}");
            PolicyLanguage language = new PolicyLanguage(languageGuid, "en");
            language[new Guid("{D0FE23B8-B8A0-4DD6-A0F1-A7836DC0417E}")] = "Test catalogue";
            language[new Guid("{A081481C-D500-4AB0-B06F-2121ED997C7B}")] = "F**k";
            language[new Guid("{E0037C93-38B4-49B7-87A3-39C86BEFD186}")] = "bastard";
            language[new Guid("{EBA1218A-86D7-485E-B0DE-B782E06A3853}")] = "Profanity lookup";
            language[new Guid("{82FE95F5-C980-4C88-974C-BDB6D6B64238}")] = "Discrimination lookup";
            language[new Guid("{F7A2FC86-35C4-4BD8-964D-6D34487332F6}")] = "Test result2";
            language[new Guid("{D1815E79-44F2-4CBD-B972-116700EEF4C8}")] = "Test data item 10";
            language[new Guid("{2F9CE0C6-2D99-44BB-AA92-5FDF6BF83130}")] = "Test result10";
            language[new Guid("{055DB8B7-3FC8-43AC-830D-EE1379E4B6A9}")] = "Test data item 2";

            XmlPolicyLanguageStore languageStore = XmlPolicyLanguageStore.Instance;
            languageStore.AddLanguage(language);

            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            catalogueStore.Reset();
            IPolicyObjectCollection<IPolicyCatalogue> policyCatalogues = new PolicyObjectCollection<IPolicyCatalogue>();
            policyCatalogues.Add(new PolicyCatalogue(catalogueStore, languageGuid));

            Guid catalogueId = new Guid("{B496E117-29DA-4770-87E9-62573B28BB4F}");
            XmlPolicyCatalogueWriter catalogueWriter = catalogueStore.GetWriter(catalogueId, languageGuid) as XmlPolicyCatalogueWriter;
            Assert.IsNotNull(catalogueWriter, "Expected a valid [IPolicyStoreWriter] writer");

            catalogueWriter.WriteName("{D0FE23B8-B8A0-4DD6-A0F1-A7836DC0417E}");

            DataMethod dataMethod = new DataMethod("TextLookupCount");
            dataMethod.Parameters.Add(new Parameter("content", new DataElement(new TranslateableLanguageItem("content"), new NonTranslateableLanguageItem(""), DataType.String, "{A081481C-D500-4AB0-B06F-2121ED997C7B}")));
            dataMethod.Parameters.Add(new Parameter("context", new DataElement(new TranslateableLanguageItem("context"), new NonTranslateableLanguageItem(""), DataType.String, "Paragraph")));
            DataSource dataSource = new DataSource("Workshare.DocInspector.dll", "ContentAnalyzer", dataMethod);
            string dataElementGuid = "{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}";
            DataElement dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{EBA1218A-86D7-485E-B0DE-B782E06A3853}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource.DeepCopy(true));

            catalogueWriter.WriteDataElement(dataElement);

            dataMethod = new DataMethod("TextLookupCount");
            dataMethod.Parameters.Add(new Parameter("content", new DataElement(new TranslateableLanguageItem("content"), new NonTranslateableLanguageItem(""), DataType.String, "{E0037C93-38B4-49B7-87A3-39C86BEFD186}")));
            dataMethod.Parameters.Add(new Parameter("context", new DataElement(new TranslateableLanguageItem("context"), new NonTranslateableLanguageItem(""), DataType.String, "Paragraph")));
            dataSource = new DataSource("Workshare.DocInspector.dll", "ContentAnalyzer", dataMethod);
            dataElementGuid = "{7CED5561-FD8C-423C-838F-9440EDFE6758}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{82FE95F5-C980-4C88-974C-BDB6D6B64238}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
            catalogueWriter.WriteDataElement(dataElement);

            DataItem dataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("{D1815E79-44F2-4CBD-B972-116700EEF4C8}"), DataType.Long, "10");
            dataElementGuid = "{EB56B397-954D-45C2-ADBA-263372A8B59F}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{2F9CE0C6-2D99-44BB-AA92-5FDF6BF83130}"), new NonTranslateableLanguageItem(""), DataType.Long, dataItem);
            catalogueWriter.WriteDataElement(dataElement);

            dataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("{055DB8B7-3FC8-43AC-830D-EE1379E4B6A9}"), DataType.Long, "2");
            dataElementGuid = "{C6E38158-AB8C-496B-B97D-FD413680977D}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{F7A2FC86-35C4-4BD8-964D-6D34487332F6}"), new NonTranslateableLanguageItem(""), DataType.Long, dataItem);
            catalogueWriter.WriteDataElement(dataElement);

            catalogueWriter.Close();

            TestHelpers.CompareXml(m_testPath + "ExpectedWriteReadOnlyDataSource.xml", catalogueStore.GetStoreXML(catalogueId));
        }
		private static ICondition CreatePasswordProtectedFileCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataComparer", new TranslateableLanguageItem(""), OperatorType.Equals);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.PasswordProtectedFile);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);
			CustomAttributes.SetConditionSummary(condition, "");

			//dataleft
			IDataMethod method = new DataMethod("CannotOpenContentInFileType");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//file types parameter
			method.Parameters.Add(CreateFileTypesParameter());

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.ContentAnalysis", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.Boolean, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Boolean, Boolean.TrueString));
			condition.DataRight = dataElement;

			return condition;
		}
		/// <summary>
		/// Creates a new data element storing a data source
		/// </summary>
		public static IDataElement NewDataSourceElement(string name, string assemblyName, string className, IDataMethod method)
		{
			IDataSource dataSource = new DataSource(assemblyName, className, method);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			return dataElement;
		}
		private static ICondition CreateEmailAddressesCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataComparer", new TranslateableLanguageItem(""), OperatorType.Equals);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.EmailAdresses);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);
			CustomAttributes.SetConditionSummary(condition, "");


			//data left
			IDataMethod method = new DataMethod("AddressMatch");

			//file parameter to allow filtering on types within the condition code, not actually displayed in the designer
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//source and destination
			IDataMethod destinationMethod = new DataMethod("Destination");
			dataSource = new DataSource("this", "this", destinationMethod);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("destination"), new NonTranslateableLanguageItem(""),
				DataType.Object, dataSource);
			parameter = new Parameter("destination", dataElement);
			method.Parameters.Add(parameter);

			IDataMethod sourceMethod = new DataMethod("Source");
			dataSource = new DataSource("this", "this", sourceMethod);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("source"), new NonTranslateableLanguageItem(""),
				DataType.Object, dataSource);
			parameter = new Parameter("source", dataElement);
			method.Parameters.Add(parameter);


			//addressType fields parameter
			IPolicyObjectCollection<IDataItem> collection = new PolicyObjectCollection<IDataItem>();
			collection.Add(DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(AddressTypes),
				AddressTypes.To)));
			collection.Add(DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(AddressTypes),
				AddressTypes.Cc)));
			collection.Add(DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(AddressTypes),
				AddressTypes.Bcc)));

			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("addressTypes"), new NonTranslateableLanguageItem(""), DataType.StringArray, collection);

			parameter = new Parameter("addressTypes", dataElement);
			method.Parameters.Add(parameter);


			//address parameter
			collection = new PolicyObjectCollection<IDataItem>();
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("address"), new NonTranslateableLanguageItem(Properties.Resources.IDS_EXPRESSION_CONTENTPARAM_DEFAULT), DataType.StringArray, collection);
			parameter = new Parameter("address", dataElement);
			method.Parameters.Add(parameter);



			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.EmailAnalyzer", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("emailAddresses"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("addressMatch"), new NonTranslateableLanguageItem(""), DataType.Boolean, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Boolean, Boolean.TrueString));
			condition.DataRight = dataElement;

			return condition;
		}
		private static ICondition CreateHiddenDataInFileTypeCondition()
		{
			//hidden data in file type condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataLengthComparer", new TranslateableLanguageItem(""), OperatorType.GreaterThan);

			//condition attributes            
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.HiddenDataInFile);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);

			//dataleft
			IDataMethod method = new DataMethod("RegExLookupInFileType");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//file types parameter
			method.Parameters.Add(CreateFileTypesParameter());

			//content parameter - will be empty, and is not editable by the user
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("content"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, ""));
			parameter = new Parameter("", dataElement);
			method.Parameters.Add(parameter);

			//hidden data parameter
			IPolicyObjectCollection<IDataItem> collection = new PolicyObjectCollection<IDataItem>();
			collection.Add(DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(FileHiddenDataType), FileHiddenDataType.TrackChange)));
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("hidden data type"), new NonTranslateableLanguageItem(""), DataType.StringArray, collection);
			parameter = new Parameter("hidden data type", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.ContentAnalysis", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("hiddenDataInFile"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("numberOfOccurrences"), new NonTranslateableLanguageItem(""), DataType.Long, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Long, 0));
			condition.DataRight = dataElement;

			return condition;
		}
Example #22
0
        public void TestActionExceptionHandlerWithOffline()
        {
            string testCatalogue = m_testPath + "TestActionExceptionHandlerWithOffline.Catalogue.xml";
            string testLanguage = m_testPath + "TestActionExceptionHandlerWithOffline.Language.xml";

            Guid languageId = XmlPolicyLanguageStore.Instance.AddLanguage(System.IO.File.ReadAllText(testLanguage));

            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            PolicyCatalogue policyCatalogue = catalogueStore.AddPolicyCatalogue(System.IO.File.ReadAllText(testCatalogue));

            XmlStore store = new XmlStore();

            ObjectModel.PolicySet policySet = new ObjectModel.PolicySet(new Guid("{8FC9EB93-C376-4E96-B22E-71FAA848393D}"), new TranslateableLanguageItem("{D803727B-5C81-44CC-8BFC-9B68797AC6EB}"), store, policyCatalogue, false);
            P5Policy policy = new P5Policy(store, policySet, new Guid("{C0F6D4BB-CBF1-41FC-8A28-616D6FC1DC73}"), new TranslateableLanguageItem("{F0DD86A0-5D21-4784-88AF-C5321B5998F6}"), PolicyStatus.Active);

            IPolicyObjectCollection<IPolicyChannel> channels = new PolicyObjectCollection<IPolicyChannel>();
            PolicyChannel channel = new PolicyChannel(new Guid("{390F589A-24B0-4DF0-B750-D47EDD1FF0BE}"), new TranslateableLanguageItem("{463A0FAF-CE8C-470E-8077-A093B9350719}"), ChannelType.SMTP);

            // Build the ActionException cell for the action matrix.
            IActionMatrix actions = new ObjectModel.ActionMatrix();

            ActionExceptionCell actionExceptionCell = actions.ActionExceptionHandler as ObjectModel.ActionExceptionCell;
            Assert.IsNotNull(actionExceptionCell);

            OfflineActionMatrixCell offlineCell = actions.Offline as OfflineActionMatrixCell;

            ConditionGroup conditionGroup = new ConditionGroup(new Guid("{661EDD6F-D750-493A-9932-E56C8C22E2CF}"), new TranslateableLanguageItem("Test condition group"), ConditionLogic.AND, false);
            ICondition subCondition = new Condition(new Guid("{6B7F6B0C-747A-4BD0-A65D-A1FB9E44FE7C}"), "ITestOne", OperatorType.GreaterThan);

            DataMethod dataMethod = new DataMethod("Test method");
            dataMethod.Parameters.Add(new Parameter("FindSomething", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "missing")));
            dataMethod.Parameters.Add(new Parameter("RunSomething", new DataElement(new TranslateableLanguageItem("string value"), new TranslateableLanguageItem(""), DataType.String, "just do it!")));
            DataSource dataSource = new DataSource("Testme.dll", "TestMe", dataMethod);
            subCondition.DataLeft = new DataElement(new Guid("{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}"), new TranslateableLanguageItem("Do testing stuff"), new TranslateableLanguageItem(""), DataType.Object, dataSource);
            IDataItem dataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("Test data item"), DataType.Long, "10");
            subCondition.DataRight = new DataElement(new Guid("{EB56B397-954D-45C2-ADBA-263372A8B59F}"), new TranslateableLanguageItem("Test data item stored in data element"), new TranslateableLanguageItem(""), DataType.Long, dataItem);
            conditionGroup.Conditions.Add(subCondition);

            policy.Conditions.Add(conditionGroup);
            actionExceptionCell.AddActionCondition(conditionGroup, BuildActionGroup(), false);

            channel.Actions = actions;
            channels.Add(channel);
            policy.Channels = channels;

            Store.IPolicyStoreWriter writer = store.Writer;
            Assert.IsNotNull(writer, "Expected a valid [IPolicyStoreWriter] writer");
            writer.WritePolicySet(policySet);
            writer.WritePolicy(policySet, policy);
            writer.WriteChildCollection(policySet, policy, policy.Name.Value, policy.Conditions);
            writer.WriteChildCollection(policySet, policy, policy.Name.Value, CollectionConverter.Convert<IPolicyChannel, IPolicyObject>(channels));
            writer.Close();

            string expectedPolicySetFile = m_testPath + "TestActionExceptionHandlerWithOffline.PolicySet.xml";
            TestHelpers.CompareXml(expectedPolicySetFile, store.StoreXML);
        }
        public void TestDataSourceCopyConstructors()
        {
            IDataSource dataSource = ReadDataSourceAttributesHelper();
            Assert.AreEqual("This is my first custom property", dataSource["custom1"].Value);
            Assert.AreEqual("This is my second custom property", dataSource["custom2"].Value);

            DataSource dataSourceCopy = new DataSource(dataSource.Assembly, dataSource.Class, dataSource.Method);
            Assert.AreEqual("", dataSourceCopy["custom1"].Value);
            Assert.AreEqual("", dataSourceCopy["custom2"].Value);
        }
        public void TestCreatePolicySetConditionsMasterCatalogue()
        {
            string testCatalogue = m_testPath + "TestCreatePolicySetConditionsMasterCatalogue.xml";
            string languageFilename = m_testPath + "TestCreatePolicySetConditionsMasterCatalogueLanguage.xml";
            string policySetFilename = m_testPath + "TestCreatePolicySetConditionsMasterCataloguePolicySet.xml";

            XmlPolicyLanguageStore languageStore = XmlPolicyLanguageStore.Instance;
            languageStore.Reset();

            Guid languageId = new Guid("{E8B22533-98EB-4D00-BDE4-406DC3E1858B}");
            IPolicyLanguage language = new PolicyLanguage(languageId, "en");
            language.DefaultLanguage = true;
            languageStore.AddLanguage(language);

            PolicyLanguageCache policyLanguageCache = PolicyLanguageCache.Instance;
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{B5C31A66-1B39-4CA7-BF02-AF271B5864F7}"), "New catalogue");
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{9465CA41-A0A1-40BD-BE26-E83E17D83148}"), "New policy set");
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{08BC5764-4879-42ED-9AD8-15040C4ADEDE}"), "New policy");

            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            catalogueStore.Reset();
            PolicyCatalogue policyCatalogue = new PolicyCatalogue(new Guid("{AB5E2A43-01FB-4AA6-98FC-8F74BB0621CA}"), language.Identifier, new TranslateableLanguageItem("{B5C31A66-1B39-4CA7-BF02-AF271B5864F7}"), catalogueStore);
            catalogueStore.AddPolicyCatalogue(policyCatalogue);

            IPolicyStore policyStore = new XmlStore();
            IPolicySet policySet = new PolicySet(new Guid("{29EC30A5-1271-4306-89C8-5811172D901A}"), new TranslateableLanguageItem("{9465CA41-A0A1-40BD-BE26-E83E17D83148}"), policyStore, policyCatalogue, false);
            IPolicy newPolicy = new P5Policy(policySet, new Guid("{D257D4DC-4A12-438F-A32A-CF1CE4474441}"), new TranslateableLanguageItem("{08BC5764-4879-42ED-9AD8-15040C4ADEDE}"), PolicyStatus.Active);
            policySet.Policies.Add(newPolicy);

            // Create a condition group for the policy.
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{8EB7FF08-1DC8-4F11-9D55-AF47F83F843A}"), "Test condition group");
            IConditionGroup conditionGroup = new ConditionGroup(new Guid("{B87DF614-2400-4C1F-BEA8-3C2EB3964EAE}"), new TranslateableLanguageItem("{8EB7FF08-1DC8-4F11-9D55-AF47F83F843A}"), ConditionLogic.AND, false);
            newPolicy.Conditions.Add(conditionGroup);

            // Create a condition for the condition group.
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{EC8E1E63-7097-4330-8130-5776D4FDF1ED}"), "Test condition");
            ICondition condition = new Condition(new Guid("{98C73BC3-3E20-403C-8023-C91E2818355F}"), "TestClass", new TranslateableLanguageItem("{EC8E1E63-7097-4330-8130-5776D4FDF1ED}"), OperatorType.Equals);
            conditionGroup.Conditions.Add(condition);

            // Create the data left for the condition data.
            DataMethod dataMethod = new DataMethod("ThisIsATest");
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{BA56AB4C-43D0-465A-BE67-D8A569A1894C}"), "Test data item to the left");

            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{AB454A4B-1A0F-4864-9F46-3AAC8A34ACA5}"), "Test parameter data element");
            DataElement parameterDataElement = new DataElement(new Guid("{015035B7-1793-464D-AF69-030E9DC7151E}"), new TranslateableLanguageItem("{AB454A4B-1A0F-4864-9F46-3AAC8A34ACA5}"), new NonTranslateableLanguageItem(""), DataType.String, "Lets go dynamo");
            dataMethod.Parameters.Add(new Parameter("somethingTerrible", parameterDataElement));
            IDataSource dataSource = new DataSource("ThisIsADodgyAssembly.dll", "ItWantsToTakeOverYourComputer", dataMethod);

            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{79784B11-5FCC-47A8-A35E-C8399BE71C05}"), "Test data left");
            condition.DataLeft = new DataElement(new Guid("{454672AC-BCED-4DAB-813F-6CF14E6289C5}"), new TranslateableLanguageItem("{79784B11-5FCC-47A8-A35E-C8399BE71C05}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);

            // Create the data right for the condition data.
            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{BD40DDEE-B045-4D3B-8092-D596329230FE}"), "Test data item to the right");
            IDataItem dataRightDataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("{BD40DDEE-B045-4D3B-8092-D596329230FE}"), DataType.String, "This is a test");

            policyLanguageCache.SetLanguageItemText(languageId, new Guid("{8549333F-0A4D-4939-8A36-36FB0FF1C89A}"), "Test data right");
            condition.DataRight = new DataElement(new Guid("{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}"), new TranslateableLanguageItem("{8549333F-0A4D-4939-8A36-36FB0FF1C89A}"), new NonTranslateableLanguageItem(""), DataType.String, dataRightDataItem);

            // Save everything
            IPolicyCatalogueWriter catalogueWriter = catalogueStore.GetWriter(policyCatalogue.Identifier, language.Identifier);
            catalogueWriter.WriteCatalogue(policyCatalogue);
            catalogueWriter.Close();

            policySet.Save();

            TestHelpers.CompareXml(policySetFilename, policyStore.XMLRepresentation);
            TestHelpers.CompareXml(testCatalogue, catalogueStore.GetStoreXML(policySet.MasterCatalogue.Identifier));
            TestHelpers.CompareXml(languageFilename, languageStore.GetXMLRepresentation(language.Identifier, language.Name.Value));
        }
		private static ICondition CreateTotalAttachmentSizeCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataComparer", new TranslateableLanguageItem(""), OperatorType.GreaterThan);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.TotalAttachmentSize);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);
			CustomAttributes.SetConditionSummary(condition, "");

			//dataleft
			IDataMethod method = new DataMethod("TotalAttachmentSize");

			//size parameter
			IDataMethod sizeMethod = new DataMethod("TotalAttachmentSize");
			IDataSource dataSource = new DataSource("this", "this", sizeMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("size"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("size", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.FileAttributeAnalysis", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("sizeMethod"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("sizeDataElement"), new NonTranslateableLanguageItem(""), DataType.Double, DataItem.CreateDataItem(new NonTranslateableLanguageItem("size"), DataType.Double, 0));
			condition.DataRight = dataElement;

			return condition;
		}
        private void BuildDataElementArray(XMLPolicyCatalogueStore catalogueStore, object dataArray, DataType dataArrayType)
        {
            Guid languageGuid = new Guid("{054846D4-6540-4C78-BA7D-141C91EE6A4C}");
            PolicyLanguage language = new PolicyLanguage(languageGuid, "en");
            language[new Guid("{D0FE23B8-B8A0-4DD6-A0F1-A7836DC0417E}")] = "Test catalogue";
            language[new Guid("{594F9A70-DD97-4335-82EC-850DD410EF63}")] = "Embedded data element";
            language[new Guid("{1758BA56-407A-49C8-9C44-C5F6B4772097}")] = "Test data source with array";
            language[new Guid("{2C12FE25-8912-431C-BB94-115B805E0487}")] = "Test data item with array";

            XmlPolicyLanguageStore languageStore = XmlPolicyLanguageStore.Instance;
            languageStore.AddLanguage(language);

            Guid catalogueId = new Guid("{B496E117-29DA-4770-87E9-62573B28BB4F}");
            XmlPolicyCatalogueWriter catalogueWriter = catalogueStore.GetWriter(catalogueId, languageGuid) as XmlPolicyCatalogueWriter;
            Assert.IsNotNull(catalogueWriter, "Expected a valid [IPolicyStoreWriter] writer");

            catalogueWriter.WriteName("{D0FE23B8-B8A0-4DD6-A0F1-A7836DC0417E}");

            DataMethod dataMethod = new DataMethod("TextLookupCount");
            dataMethod.Parameters.Add(new Parameter("context", new DataElement(new NonTranslateableLanguageItem(""), new NonTranslateableLanguageItem(""), DataType.String, "Paragraph")));

            dataMethod.Parameters.Add(new Parameter("settings", new DataElement(new Guid("{7FDCDDCE-D6F7-4853-82A8-8996BF0AFA37}"), new TranslateableLanguageItem("{594F9A70-DD97-4335-82EC-850DD410EF63}"), new NonTranslateableLanguageItem(""), dataArrayType, dataArray)));
            DataSource dataSource = new DataSource("Workshare.DocInspector.dll", "ContentAnalyzer", dataMethod);
            string dataElementGuid = "{CC7A83B9-5382-4BD0-93EC-74C693D8CD87}";
            DataElement dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{1758BA56-407A-49C8-9C44-C5F6B4772097}"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);

            catalogueWriter.WriteDataElement(dataElement);

            dataElementGuid = "{C6E38158-AB8C-496B-B97D-FD413680977D}";
            dataElement = new DataElement(new Guid(dataElementGuid), new TranslateableLanguageItem("{2C12FE25-8912-431C-BB94-115B805E0487}"), new NonTranslateableLanguageItem(""), dataArrayType, dataArray);
            catalogueWriter.WriteDataElement(dataElement);

            catalogueWriter.Close();
        }
        public void TestAddDataElement()
        {
            IPolicyLanguage language = new PolicyLanguage(new Guid("{E8B22533-98EB-4D00-BDE4-406DC3E1858B}"), "en");

            XMLPolicyCatalogueStore catalogueStore = XMLPolicyCatalogueStore.Instance;
            catalogueStore.Reset();
            PolicyCatalogue policyCatalogue = new PolicyCatalogue(new Guid("{AB5E2A43-01FB-4AA6-98FC-8F74BB0621CA}"), language.Identifier, new TranslateableLanguageItem("{B5C31A66-1B39-4CA7-BF02-AF271B5864F7}"), catalogueStore);
            catalogueStore.AddPolicyCatalogue(policyCatalogue);

            PolicySetObserver policySetObserver = new PolicySetObserver(policyCatalogue);

            Assert.AreEqual(0, policyCatalogue.DataElements.Count);

            // Create data elements
            DataMethod dataMethod = new DataMethod("ThisIsATest");
            DataItem parameterDataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("Test data item to the left"), DataType.String, "Lets go dynamo");

            DataElement parameterDataElement = new DataElement(new Guid("{015035B7-1793-464D-AF69-030E9DC7151E}"), new TranslateableLanguageItem("Test parameter data element"), new TranslateableLanguageItem(""), DataType.String, parameterDataItem);
            dataMethod.Parameters.Add(new Parameter("somethingTerrible", parameterDataElement));
            IDataSource dataSource = new DataSource("ThisIsADodgyAssembly.dll", "ItWantsToTakeOverYourComputer", dataMethod);

            DataElement leftDataElement = new DataElement(new Guid("{454672AC-BCED-4DAB-813F-6CF14E6289C5}"), new TranslateableLanguageItem("Test data left"), new TranslateableLanguageItem(""), DataType.Object, dataSource);
            policySetObserver.AddObject(leftDataElement);

            IDataItem dataRightDataItem = DataItem.CreateDataItem(new TranslateableLanguageItem("Test data item to the right"), DataType.String, "This is a test");
            DataElement rightDataElement = new DataElement(new Guid("{4E2F50C5-D310-47A1-AE3A-621F5C77FA68}"), new TranslateableLanguageItem("Test data right"), new TranslateableLanguageItem(""), DataType.String, dataRightDataItem);

            policySetObserver.AddObject(rightDataElement);

            Assert.AreEqual(2, policyCatalogue.DataElements.Count);
        }
		private static ICondition CreateRegexInFileContextCondition()
		{
			//file type contains regex in file context condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataLengthComparer", new TranslateableLanguageItem(""), OperatorType.GreaterThan);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.RegexInFileContext);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);

			//dataleft
			IDataMethod method = new DataMethod("RegExLookupInFileType");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			//file types parameter
			method.Parameters.Add(CreateFileTypesParameter());

			//regex parameter
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("regex"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Properties.Resources.IDS_EXPRESSION_PARAM_REGEX_DEFAULT));
			parameter = new Parameter("regex", dataElement);
			method.Parameters.Add(parameter);

			//context parameter
			IPolicyObjectCollection<IDataItem> collection = new PolicyObjectCollection<IDataItem>();
			collection.Add(DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Enum.GetName(typeof(FileContextType), FileContextType.Paragraph)));
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("context"), new NonTranslateableLanguageItem(""), DataType.StringArray, collection);
			parameter = new Parameter("context", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.ContentAnalysis", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("regexInFileContext"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("numberOfOccurrences"), new NonTranslateableLanguageItem(""), DataType.Long, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.Long, 0));
			condition.DataRight = dataElement;

			return condition;
		}
Example #29
0
        /// <summary>
        /// Invokes a dialog to allow the user to construct a new action
        /// </summary>
        protected void AddNewAction()
        {
            if (!VerifyOKToAdd())
                return;

            //TODO: don't construct the form here, as this ties into a particular UI and makes it difficult to test
            try
            {
                m_addEditActionsForm = new AddEditActionsForm(ResourcesCache.GetResources());
            }
            catch(TypeInitializationException)
            {
                MessageBox.Show(Properties.Resources.REMOTECACHENOTRUNNING, Properties.Resources.REMOTECACHENOTRUNNING_CAP, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            m_addEditActionsForm.OpenForEdit = false;
            m_addEditActionsForm.Channel = m_channel;
            m_addEditActionsForm.Policy = m_policy;
            m_addEditActionsForm.AllowTransparent = RoutingHelper.SupportTransparentProcessing(m_channel.Routing);
            m_addEditActionsForm.IsExceptionCell = (m_Cell is ActionExceptionCell);

            // Set the actions that are already present for the cell
            m_addEditActionsForm.CurrentActions = m_Cell.ActionConditionGroups[0].ActionGroup.Actions;
            
            // Check if any items can be added
            if (!m_addEditActionsForm.CanExistingActionCoexist())
            {
                return;
            }

            if (!m_addEditActionsForm.AreAnyActionsAvailable())
            {
                return;
            }

            if (m_addEditActionsForm.PolicySupportsActions())
            {
                if (m_addEditActionsForm.ShowDialog() == DialogResult.OK)
                {
                    if (ShouldAddActionIfDuplicateForType(m_addEditActionsForm.BaseAction))
                    {
						Workshare.Policy.ObjectModel.Action anAction = new Workshare.Policy.ObjectModel.Action(Guid.NewGuid(), m_addEditActionsForm.AssemblyName, m_addEditActionsForm.ClassName, m_addEditActionsForm.RunAt, m_addEditActionsForm.Override, m_addEditActionsForm.BasePrecedence + m_addEditActionsForm.Precedence);
                        anAction.Name.Value = m_addEditActionsForm.MyName;
						
						anAction[LanguageItemKeys.TYPE] = new NonTranslateableLanguageItem(m_addEditActionsForm.BaseAction);
                        
                        IDataElement transparentDataElem = CreateBoolElement(LanguageItemKeys.TRANSPARENT, m_addEditActionsForm.Transparent);
                        anAction.DataElements.Add(transparentDataElem);

                        IDataElement executeDataElem = CreateBoolElement(LanguageItemKeys.ALWAYSEXECUTE, false);
                        SetExecutionDataElemProps(executeDataElem);
                        anAction.DataElements.Add(executeDataElem);

                        IDictionaryEnumerator propEnumerator = m_addEditActionsForm.ListItems.GetEnumerator();
                        while (propEnumerator.MoveNext())
                        {
                            string name = propEnumerator.Key as string;
                            ActionDataElement ade = (ActionDataElement)propEnumerator.Value;

                            if (0 == string.Compare(ade.Name, LanguageItemKeys.AUTOEXPAND, StringComparison.InvariantCultureIgnoreCase))
                                continue;

                            if (0 == string.Compare(ade.Name, LanguageItemKeys.ALWAYSEXECUTE, StringComparison.InvariantCultureIgnoreCase))
                                continue;

                            object dataElementData = null;
                            DataType dataType;
                            if (ade.IsSystemProperty)
                            {
                                //create a new DataElement that contains the system property as a data source
                                dataType = DataType.Object;
                                ISystemProperty systemProperty = ade.MappedSystemProperty as ISystemProperty;
                                IDataMethod dataMethod = new DataMethod(systemProperty.PropertyName);
                                dataElementData = new DataSource(systemProperty.Assembly, systemProperty.Class, dataMethod);
                            }
                            else
                            {
                                //if not a system property, must be a non-object data type
                                dataType = ConditionUnitFactory.GetDataType(ade.Value.GetType());
                                dataElementData = DataItem.CreateDataItem(new NonTranslateableLanguageItem(ade.Name), dataType, ade.Value);
                                if (dataType == DataType.StringArray)
                                {
                                    dataElementData = ConversionUtils.StringArrayToPolicyObjectModelStringArray((string[])ade.Value);
                                }
                            }
                            DataElement de = new DataElement(new NonTranslateableLanguageItem(ade.Name), new TranslateableLanguageItem(name), dataType, dataElementData);
                            de["iscustomproperty"].Value = ade.IsCustomProperty.ToString();
                            de["allowoverride"].Value = ade.Override.ToString();
                            de["visible"].Value = ade.Visible.ToString();

                            anAction.DataElements.Add(de);
                        }

                        // For the file types, as well as adding them as a collection in their
                        // own right, add them as a new data element consisting of a delimited string

                        propEnumerator = m_addEditActionsForm.FileItems.GetEnumerator();
                        while (propEnumerator.MoveNext())
                        {
                            ActionFiletype filetype = (ActionFiletype)propEnumerator.Value;
                            anAction.Filetypes.Add(filetype);
                        }

                        //// Set the supported types as custom attributes on the Actions
                        //propEnumerator = m_addEditActionsForm.SupportedChannels.GetEnumerator();
                        //while (propEnumerator.MoveNext())
                        //{
                        //    ChannelType channelType = ((Channel)propEnumerator.Value).Type;
                        //    anAction[channelType.ToString().ToLower(CultureInfo.InvariantCulture)] = new NonTranslateableLanguageItem("true");
                        //}

                        // Set the supported types as custom attributes on the Actions
                        propEnumerator = m_addEditActionsForm.SupportedPolicies.GetEnumerator();
                        while (propEnumerator.MoveNext())
                        {
                            PolicyType policyType = (PolicyType)propEnumerator.Value;
                            anAction[policyType.ToString().ToLower(CultureInfo.InvariantCulture)] = new NonTranslateableLanguageItem("true");
                        }

                        if (!AddAction(anAction))
                        {
							ArgumentException ex = new ArgumentException("Could not add this action as an action already exists with the same id");
                            Logger.LogError(ex.Message);
                            throw ex;
                        }

                        StateMachine.ChildForm.IsModified = true;
                    }
                }
            }
            else
            {
                string str = string.Format(CultureInfo.CurrentCulture, Properties.Resources.ACTION_NOTSUPPORT, m_channel.Name.Value);
                MessageBox.Show(str, Properties.Resources.ACTION_NOTSUPPORT_CAP, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
		private static ICondition CreateRegexInFileNameCondition()
		{
			//condition
			ICondition condition = new Condition(Guid.NewGuid(), "IDataLengthComparer", new TranslateableLanguageItem(""), OperatorType.Equals);

			//condition attributes
			CustomAttributes.SetPreDefinedConditionType(condition, PreDefinedConditionType.RegexInFileName);
			CustomAttributes.SetIgnore(condition, false);
			CustomAttributes.SetLongDescription(condition, "");
			CustomAttributes.SetRiskRating(condition, RiskRatingType.Medium);

			//dataleft
			IDataMethod method = new DataMethod("FileName");

			//file parameter
			IDataMethod fileMethod = new DataMethod("CurrentFile");
			IDataSource dataSource = new DataSource("this", "this", fileMethod);
			IDataElement dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("file"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			IParameter parameter = new Parameter("file", dataElement);
			method.Parameters.Add(parameter);

			dataSource = new DataSource("Workshare.Policy.Condition.ContentAnalysis.dll", "Workshare.Policy.Condition.FileAttributeAnalysis", method);
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("regexInFileName"), new NonTranslateableLanguageItem(""), DataType.Object, dataSource);
			condition.DataLeft = dataElement;

			//dataright
			dataElement = new DataElement(Guid.NewGuid(), new NonTranslateableLanguageItem("fileNameRegex"), new NonTranslateableLanguageItem(""), DataType.String, DataItem.CreateDataItem(new NonTranslateableLanguageItem(""), DataType.String, Properties.Resources.IDS_EXPRESSION_PARAM_REGEX_DEFAULT));
			condition.DataRight = dataElement;

			return condition;
		}