Ejemplo n.º 1
0
 private void SetRequestChannel()
 {
     Guid requestChannelId = Guid.NewGuid();
     Append(new NxObjectLookup(requestChannelId.ToString(), "this", "RequestChannel"));
     NxArgument nxArg = new NxArgument(requestChannelId.ToString(), true);
     Append(new NxObjectLookup(Guid.NewGuid().ToString(), "InternalExternalResolver", "SetRequestChannel", nxArg));
 }
Ejemplo n.º 2
0
        public void TestCreateValue()
        {
            NxArgument argValue = new NxArgument("some value", false);

            string expected = "<Argument value=\"some value\" />";
            string actual = argValue.Create().OuterXml;
            Assert.AreEqual(expected, actual);            
        }
Ejemplo n.º 3
0
        public void TestCreateValueId()
        {
            NxArgument argValueId = new NxArgument("valId", true);
            
            string expected = "<Argument valueId=\"valId\" />";
            string actual = argValueId.Create().OuterXml;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public NxObjectLookup(string id, string objectId, string member, NxArgument arg)
        {
            Identifier = id;
            m_objectid = objectId;
            m_member = member;

            m_args = new List<NxArgument>();
            m_args.Add(arg);
        }
Ejemplo n.º 5
0
        private void WriteDataSource(IDataElement parent, IDataSource datasource)
        {
            List<NxArgument> args = new List<NxArgument>();
            m_policysets.AddCondition(datasource, datasource.Class);
            foreach (IParameter param in datasource.Method.Parameters)
            {
                IDataElement element = param.Value;
                string argumentvalue = "";
                bool valueid = true;
                switch (element.Type)
                {
                    case DataType.Long:
                    case DataType.Boolean:
                    case DataType.Date:
                    case DataType.DateTime:
					case DataType.Double:
                		argumentvalue = element.Identifier.ToString();
						foreach (NxPolicySet policyset in m_policysets.PolicySets)
						{
							IDataItem di = element.Data as IDataItem;
							if (di != null)
							{
								policyset.Policies[policyset.Policies.Count - 1].Append(new NxPrimitive(element.Identifier.ToString(), element.Type, Convert.ToString(di.Value, CultureInfo.InvariantCulture)));
							}
							else
							{
								policyset.Policies[policyset.Policies.Count - 1].Append(new NxPrimitive(element.Identifier.ToString(), element.Type, Convert.ToString(element.Data, CultureInfo.InvariantCulture)));
							}
						}
                        break;
                    case DataType.String:
                        valueid = false;

                        if (element.Data is String)
                            argumentvalue = element.Data as string;
                        else
                        {
                            IDataItem di = (IDataItem)element.Data;
                            argumentvalue = di.Value as string;
                        }                       
                        break;
                    case DataType.BooleanArray:
                    case DataType.DateArray:
                    case DataType.DateTimeArray:
                    case DataType.DoubleArray:
                    case DataType.LongArray:
                    case DataType.StringArray:
                        argumentvalue = Guid.NewGuid().ToString();
                        NxArgument argument = new NxArgument(NxUtils.ConvertToStringArray(element.Data as IPolicyObjectCollection<IDataItem>), false);
                        foreach (NxPolicySet policyset in m_policysets.PolicySets)
                        {
                            policyset.CurrentPolicy.Append(new NxObjectLookup(argumentvalue, "helper", NxUtils.DataTypeToMember(element.Type), argument));
                        }
                        break;    
                    case DataType.Object:
                        argumentvalue = element.Identifier.ToString();
                        WriteDataSource(element, element.Data as IDataSource);
                        break;
                    case DataType.ObjectArray:
                        argumentvalue = element.Identifier.ToString();
                        WriteDataSource(element, element.Data as IDataSource);

                        break;
                    case DataType.Empty:
                        argumentvalue = Guid.NewGuid().ToString();
                        foreach (NxPolicySet policyset in m_policysets.PolicySets)
                        {
                            policyset.CurrentPolicy.Append(new NxObjectLookup(argumentvalue, "this", "GetNull"));
                        }
                        break;
                }
                args.Add(new NxArgument(argumentvalue, valueid));
            }
            foreach (NxPolicySet policyset in m_policysets.PolicySets)
            {
                //Parent Identifier might be a problem!
                policyset.CurrentPolicy.Append(new NxObjectLookup(parent.Identifier.ToString(), datasource.Class, datasource.Method.Name.Value, args));
            }
        }
Ejemplo n.º 6
0
 private void WriteDataItems(IDataElement parent,  IPolicyObjectCollection<IDataItem> items)
 {
     switch (parent.Type)
     {
         case DataType.BooleanArray:
         case DataType.DateArray:
         case DataType.DateTimeArray:
         case DataType.DoubleArray:
         case DataType.LongArray:
         case DataType.StringArray:
             string argumentvalue = parent.Identifier.ToString();
             NxArgument argument = new NxArgument(NxUtils.ConvertToStringArray(items), false);
             foreach (NxPolicySet policyset in m_policysets.PolicySets)
             {
                 policyset.CurrentPolicy.Append(new NxObjectLookup(argumentvalue, "helper", NxUtils.DataTypeToMember(parent.Type), argument));
             }
             break;
     }                        
 }