Пример #1
0
        public SampleDynamicMBean()
        {
            var rowType = new CompositeType("Row", "Row", new[] {"ID", "Name"}, new[] {"Unique ID", "Name"},
                                         new[] {SimpleType.Integer, SimpleType.String});
             _tabularType = new TabularType("Table", "Table", rowType, new[] {"ID"});
             _tabularValue = new TabularDataSupport(_tabularType);

             _nestedCompositeValueType = new CompositeType("Nested composite value", "Nested composite value",
                                                       new[] {"NestedItem1", "NestedItem2"},
                                                       new[] {"Nested item 1", "Nested item 2"},
                                                       new[] {SimpleType.String, SimpleType.Double});
             _compositeValueType = new CompositeType("Composite value", "Composite value",
                                                 new[] {"Item1", "Item2", "Item3"},
                                                 new[] {"Item 1", "Item 2", "Item 3"},
                                                 new[]
                                                    {SimpleType.Integer, SimpleType.Boolean, _nestedCompositeValueType});

             var innerRowType = new CompositeType("Row", "Row", new[] {"ID", "Name", "CompositeValue"},
                                              new[] {"Unique ID", "Name", "Composite Value"},
                                              new[] {SimpleType.Integer, SimpleType.String, _compositeValueType});
             _innerTabularType = new TabularType("Inner table", "Inner table", innerRowType, new[] {"ID"});
             var outerRowType = new CompositeType("Outer Row", "Outer Row", new[] {"ID", "Value"},
                                              new[] {"Unique ID", "Tabular value"},
                                              new[] {SimpleType.Integer, _innerTabularType});
             _outerTabularType = new TabularType("Outer table", "Outer table", outerRowType, new[] {"ID"});
             _nestedTabularValue = new TabularDataSupport(_outerTabularType);
        }
Пример #2
0
        public SampleDynamicMBean()
        {
            var rowType = new CompositeType("Row", "Row", new[] { "ID", "Name" }, new[] { "Unique ID", "Name" },
                                            new[] { SimpleType.Integer, SimpleType.String });

            _tabularType  = new TabularType("Table", "Table", rowType, new[] { "ID" });
            _tabularValue = new TabularDataSupport(_tabularType);

            _nestedCompositeValueType = new CompositeType("Nested composite value", "Nested composite value",
                                                          new[] { "NestedItem1", "NestedItem2" },
                                                          new[] { "Nested item 1", "Nested item 2" },
                                                          new[] { SimpleType.String, SimpleType.Double });
            _compositeValueType = new CompositeType("Composite value", "Composite value",
                                                    new[] { "Item1", "Item2", "Item3" },
                                                    new[] { "Item 1", "Item 2", "Item 3" },
                                                    new[]
                                                    { SimpleType.Integer, SimpleType.Boolean, _nestedCompositeValueType });

            var innerRowType = new CompositeType("Row", "Row", new[] { "ID", "Name", "CompositeValue" },
                                                 new[] { "Unique ID", "Name", "Composite Value" },
                                                 new[] { SimpleType.Integer, SimpleType.String, _compositeValueType });

            _innerTabularType = new TabularType("Inner table", "Inner table", innerRowType, new[] { "ID" });
            var outerRowType = new CompositeType("Outer Row", "Outer Row", new[] { "ID", "Value" },
                                                 new[] { "Unique ID", "Tabular value" },
                                                 new[] { SimpleType.Integer, _innerTabularType });

            _outerTabularType   = new TabularType("Outer table", "Outer table", outerRowType, new[] { "ID" });
            _nestedTabularValue = new TabularDataSupport(_outerTabularType);
        }
Пример #3
0
 public SampleDynamicMBean()
 {
     _rowType = new CompositeType("Row", "Row", new[] { "ID", "Name" }, new[] { "Unique ID", "Name" },
                                  new[] { SimpleType.Integer, SimpleType.String });
     _tabularType  = new TabularType("Table", "Table", _rowType, new[] { "ID" });
     _tabularValue = new TabularDataSupport(_tabularType);
     _arrayType    = new ArrayType(1, SimpleType.Decimal);
 }
Пример #4
0
        public override bool Equals(object obj)
        {
            ITabularData other = obj as ITabularData;

            return(other != null &&
                   TabularType.Equals(other.TabularType) &&
                   ContainsSameValues(other.Values));
        }
Пример #5
0
 public SampleDynamicMBean()
 {
     _rowType = new CompositeType("Row", "Row", new[] { "ID", "Name" }, new[] { "Unique ID", "Name" },
                                  new[] { SimpleType.Integer, SimpleType.String });
     _tabularType = new TabularType("Table", "Table", _rowType, new[] { "ID" });
     _tabularValue = new TabularDataSupport(_tabularType);
     _arrayType = new ArrayType(1, SimpleType.Decimal);
 }
Пример #6
0
        public void SetAttribute(string attributeName, object value)
        {
            switch (attributeName)
            {
            case "Attribute":
                _tabularValue = (ITabularData)value;
                break;

            case "NestedTableAttribute":
                _nestedTabularValue = (ITabularData)value;
                break;

            default:
                throw new NotSupportedException();
            }
        }
Пример #7
0
        /// <summary>
        /// Puts new row into tabular data instance.
        /// </summary>
        /// <param name="data">Tabular data instance.</param>
        /// <param name="rowBuilderAction">Action used to build new row.</param>
        /// <returns>This tabular data instance.</returns>
        public static ITabularData Put(this ITabularData data, Action <ICompositeDataBuilder> rowBuilderAction)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }
            if (rowBuilderAction == null)
            {
                throw new ArgumentNullException("rowBuilderAction");
            }
            CompositeDataBuilder rowBuilder = new CompositeDataBuilder(data.TabularType.RowType);

            rowBuilderAction(rowBuilder);
            data.Put(rowBuilder.Create());
            return(data);
        }
Пример #8
0
 public void SetAttribute(string attributeName, object value)
 {
     switch (attributeName)
     {
         case "Tabular":
             _tabularValue = (ITabularData)value;
             break;
         case "Array":
             _arrayValue = (decimal[]) value;
             break;
         case "Composite":
             _compositeValue = (ICompositeData) value;
             break;
         default:
             throw new NotSupportedException();
     }
 }
Пример #9
0
        public void SetAttribute(string attributeName, object value)
        {
            switch (attributeName)
            {
            case "Tabular":
                _tabularValue = (ITabularData)value;
                break;

            case "Array":
                _arrayValue = (decimal[])value;
                break;

            case "Composite":
                _compositeValue = (ICompositeData)value;
                break;

            default:
                throw new NotSupportedException();
            }
        }
Пример #10
0
        public void CollectionMapperCanHandleMappingCollectionToTabular()
        {
            OpenType mappedType = mapper.MapType(typeof(IEnumerable <TestCollectionElement>), MapType);

            Assert.AreEqual(OpenTypeKind.TabularType, mappedType.Kind);

            TabularType tabuarType = (TabularType)mappedType;

            Assert.AreEqual(tabuarType.IndexNames.Count, 1);
            Assert.IsTrue(tabuarType.IndexNames.Contains("CollectionIndex"));
            Assert.AreEqual(3, tabuarType.RowType.KeySet.Count);
            Assert.IsTrue(tabuarType.RowType.ContainsKey("IntValue"));
            Assert.IsTrue(tabuarType.RowType.ContainsKey("StringValue"));
            Assert.IsTrue(tabuarType.RowType.ContainsKey("CollectionIndex"));
            Assert.AreEqual(SimpleType.Integer, tabuarType.RowType.GetOpenType("IntValue"));
            Assert.AreEqual(SimpleType.String, tabuarType.RowType.GetOpenType("StringValue"));
            Assert.AreEqual(SimpleType.Integer, tabuarType.RowType.GetOpenType("CollectionIndex"));

            List <TestCollectionElement> value = new List <TestCollectionElement>();

            value.Add(new TestCollectionElement(1, "1"));
            value.Add(new TestCollectionElement(2, "2"));
            value.Add(new TestCollectionElement(3, "3"));

            object mappedValue = mapper.MapValue(typeof(IEnumerable <TestCollectionElement>), mappedType, value, MapValue);

            Assert.IsTrue(mappedValue is ITabularData);
            ITabularData table = (ITabularData)mappedValue;

            Assert.AreEqual(3, table.Count);
            ICompositeData el = table[new object[] { 0 }];

            Assert.AreEqual(1, el["IntValue"]);
            Assert.AreEqual("1", el["StringValue"]);
            el = table[new object[] { 1 }];
            Assert.AreEqual(2, el["IntValue"]);
            Assert.AreEqual("2", el["StringValue"]);
            el = table[new object[] { 2 }];
            Assert.AreEqual(3, el["IntValue"]);
            Assert.AreEqual("3", el["StringValue"]);
        }
Пример #11
0
        public OpenDynamic()
        {
            _tabularType = Tabular.Type("Table", "Table")
            .WithIndexColumn("ID", "UniqueID").TypedAs(SimpleType.Integer)
            .WithColumn("Name", "Name").TypedAs(SimpleType.String);

             _tabularValue = new TabularDataSupport(_tabularType);

             _outerTabularType = Tabular.Type("Outer table", "Outer table")
            .WithIndexColumn("ID", "Unique ID").TypedAs(SimpleType.Integer)
            .WithColumn("Value", "Tabular value").TypedAs(
               Tabular.Type("Inner table", "Inner table")
                  .WithIndexColumn("ID", "Unique ID").TypedAs(SimpleType.Integer)
                  .WithColumn("Name", "Name").TypedAs(SimpleType.String)
                  .WithColumn("CompositeValue", "Composite Value").TypedAs(
                     Composite.Type("Composite value", "Composite value")
                        .WithItem("Item1", "Item 2").TypedAs(SimpleType.Integer)
                        .WithItem("Item2", "Item 2").TypedAs(SimpleType.Boolean)
                        .WithItem("Item3", "Item 3").TypedAs(
                           Composite.Type("Nested", "Nested composite")
                              .WithItem("NestedItem1", "NestedItem1").TypedAs(SimpleType.String)
                              .WithItem("NestedItem2", "NestedItem2").TypedAs(SimpleType.Double))));

             _nestedTabularValue = new TabularDataSupport(_outerTabularType);

             _beanInfoGetter = MBean.Info<OpenDynamic>("Sample dynamic MBean")
            .WithAttributes(
               MBean.WritableAttribute("Attribute", "Sample attribute").TypedAs(TabularType),
               MBean.WritableAttribute("NestedTableAttribute", "Nested Table Attribute").TypedAs(NestedTabularType)
            )
            .WithOperations(
               MBean.MutatorOperation("DoSomething", "Does somthing").WithParameters(
                  MBean.Parameter("First", "First parameter").TypedAs(SimpleType.Double),
                  MBean.Parameter("Second", "Second parameter").TypedAs(TabularType)
               ).Returning(SimpleType.Void)
            )
            .AndNothingElse();
        }
Пример #12
0
        public OpenDynamic()
        {
            _tabularType = Tabular.Type("Table", "Table")
                           .WithIndexColumn("ID", "UniqueID").TypedAs(SimpleType.Integer)
                           .WithColumn("Name", "Name").TypedAs(SimpleType.String);

            _tabularValue = new TabularDataSupport(_tabularType);

            _outerTabularType = Tabular.Type("Outer table", "Outer table")
                                .WithIndexColumn("ID", "Unique ID").TypedAs(SimpleType.Integer)
                                .WithColumn("Value", "Tabular value").TypedAs(
                Tabular.Type("Inner table", "Inner table")
                .WithIndexColumn("ID", "Unique ID").TypedAs(SimpleType.Integer)
                .WithColumn("Name", "Name").TypedAs(SimpleType.String)
                .WithColumn("CompositeValue", "Composite Value").TypedAs(
                    Composite.Type("Composite value", "Composite value")
                    .WithItem("Item1", "Item 2").TypedAs(SimpleType.Integer)
                    .WithItem("Item2", "Item 2").TypedAs(SimpleType.Boolean)
                    .WithItem("Item3", "Item 3").TypedAs(
                        Composite.Type("Nested", "Nested composite")
                        .WithItem("NestedItem1", "NestedItem1").TypedAs(SimpleType.String)
                        .WithItem("NestedItem2", "NestedItem2").TypedAs(SimpleType.Double))));

            _nestedTabularValue = new TabularDataSupport(_outerTabularType);

            _beanInfoGetter = MBean.Info <OpenDynamic>("Sample dynamic MBean")
                              .WithAttributes(
                MBean.WritableAttribute("Attribute", "Sample attribute").TypedAs(TabularType),
                MBean.WritableAttribute("NestedTableAttribute", "Nested Table Attribute").TypedAs(NestedTabularType)
                )
                              .WithOperations(
                MBean.MutatorOperation("DoSomething", "Does somthing").WithParameters(
                    MBean.Parameter("First", "First parameter").TypedAs(SimpleType.Double),
                    MBean.Parameter("Second", "Second parameter").TypedAs(TabularType)
                    ).Returning(SimpleType.Void)
                )
                              .AndNothingElse();
        }
Пример #13
0
 public static System.Decimal Total_Sales___Sales_Territory_sliced_by_Employee(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #14
0
 public TabularDataValueType(ITabularData value)
 {
     TabularDataType = new TabularDataType_Type(value.TabularType);
      Values = value.Values.Select(x => new GenericValueType(x)).ToArray();
 }
Пример #15
0
 public static System.Int64 Reseller_Current_Quarter_Gross_Profit_Performance(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #16
0
 public static System.Int64 Total_Current_Quarter_Sales_Performance(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #17
0
 public static System.Int64 Products_UnderStocked(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #18
0
 public static System.Decimal Total_Inventory_Maximum_Value(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #19
0
 public static System.Int64 Reseller_Previous_Quarter_Sales_Proportion_to_QTD(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #20
0
 public static System.Decimal Reseller_Current_Quarter_Sales(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #21
0
 public static System.Decimal Reseller_Previous_Quarter_Gross_Profit(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #22
0
 public static System.Decimal Reseller_Total_Discount_Amount(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #23
0
 public static System.Decimal Internet_Previous_Quarter_Sales(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #24
0
 public static System.Int64 Total_Units(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #25
0
 public static System.Decimal Internet_Total_Product_Cost(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #26
0
 public static System.Decimal Reseller_Total_Sales___Sales_Territory_sliced_by_Reseller(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #27
0
 public static System.Int64 Total_Inventory_Value_Performance(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #28
0
 public static System.Decimal Total_Tax_Amount(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #29
0
 public static System.Int64 Products_with_Negative_Stock(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #30
0
 public static System.Int64 Order_Lines_Count(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #31
0
 public static System.Int64 Days_In_Current_Quarter_to_Date(this ITabularData table)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #32
0
 public static System.Decimal Total_Current_Quarter_Gross_Profit(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #33
0
 public static System.Decimal Internet_Total_Freight(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #34
0
 public static System.Decimal Total_Previous_Quarter_Sales_Proportion_to_QTD(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #35
0
 public static System.Int64 Distinct_Count_Sales_Orders(this ITabularData table, bool filter)
 {
     throw new System.NotImplementedException("This method is only available in a LinqToDAX Query");
 }
Пример #36
0
 public void SetAttribute(string attributeName, object value)
 {
     switch (attributeName)
      {
     case "Attribute":
        _tabularValue = (ITabularData) value;
        break;
     case "NestedTableAttribute":
        _nestedTabularValue = (ITabularData) value;
        break;
     default:
        throw new NotSupportedException();
      }
 }