예제 #1
0
 public RefALAttribute(IALInterface parentInterface, DimensionALInterface referencedDim, BT.RefBTAttribute btAttribute)
 {
     this.ParentInterface     = parentInterface;
     this.ReferencedDimension = referencedDim;
     this.BTAttribute         = btAttribute;
     this.Name = ReferencedDimension.IdColumn.Name;
 }
예제 #2
0
        internal DimensionALInterface GetDimensionInterfaceFor(DimensionALInterface dimIn)
        {
            var dimOut = GetDimensionInterfaceByName(dimIn.Name);

            if (dimOut == null)
            {
                DimensionInterfaces.Add(dimIn);
                dimOut = dimIn;
            }
            return(dimOut);
        }
예제 #3
0
 internal DimensionALInterface(ALModel model, BT.RefBTAttribute refAttr, DimensionALInterface rootDimension, int depth)
 {
     if (rootDimension == null)
     {
         rootDimension = this;
     }
     this.Model         = model;
     this.BTInterface   = refAttr.ReferencedBTInterface;
     this.Core          = refAttr.ReferencedBTInterface.coreInterface;
     this.Depth         = depth;
     this.RootDimension = rootDimension;
     this.Alias         = CalculateAlias(model, refAttr);
     this.ShortName     = CalculateShortName(model, refAttr);
     this.Name          = CalculateName(model, refAttr);
     PrepareAttributes();
 }
예제 #4
0
        private void PrepareRefAttribute(BT.RefBTAttribute refAttr)
        {
            if (refAttr.ReferencedBTInterface.InterfaceType == CoreInterfaceType.FACT_TABLE)
            {
                var child = new FactALInterface(refAttr.ReferencedBTInterface, Model);
                child    = Model.GetFactInterfaceFor(child);
                joinIdx += 1;
                var joinAlias = $"t{joinIdx}";

                this.FactInterfaceReferences.Add(new FactInterfaceReference()
                {
                    BTInterface   = refAttr.ReferencedBTInterface,
                    JoinAlias     = joinAlias,
                    RefColumnName = refAttr.IdAttribute.Name
                });

                // Alle Attribute der Kind-Fakttabelle übernehmen
                // (ohne Fakten, Historisierungsattribut und Mandant-Spalte)
                foreach (var attr in child.Attributes.Where(a => !a.IsFact && a.Name != "Mandant_ID" && a != child.HistoryAttribute))
                {
                    var clone = attr.Clone(this);
                    clone.JoinAlias = joinAlias;
                    Attributes.Add(clone);
                }
            }
            else
            {
                var dim = new DimensionALInterface(Model, refAttr);
                dim = Model.GetDimensionInterfaceFor(dim);
                var refAlAttr = new RefALAttribute(this, dim, refAttr);
                refAlAttr.JoinAlias = "t0";
                Attributes.Add(refAlAttr);

                // Wenn es sich hier um das Historienattribut handelt, merken
                if (refAttr?.ParentInterface?.blInterface?.HistoryAttribute != null &&
                    refAttr?.ParentInterface?.blInterface?.HistoryAttribute == refAttr.blAttribute)
                {
                    HistoryAttribute = refAlAttr;
                }
            }
        }
예제 #5
0
 private void PrepareAttributes()
 {
     Attributes = new List <IALAttribute>();
     foreach (var attr in BTInterface.Attributes.OrderBy(a => a.GetBLAttribute().SortId))
     {
         if (attr is BT.BaseBTAttribute)
         {
             var baseAttr = new BaseALAttribute(this, (BT.BaseBTAttribute)attr);
             Attributes.Add(baseAttr);
             if (attr.IsIdentity && IdColumn == null)
             {
                 IdColumn = baseAttr;
             }
             else if (attr.IsIdentity)
             {
                 throw new InvalidStateException($"Die Dimension {this.Name} hat mehr als eine Identity-Spalte");
             }
         }
         else if (attr is BT.RefBTAttribute)
         {
             var refAttr = (BT.RefBTAttribute)attr;
             DimensionALInterface dim = null;
             // Prüfen, ob es sich um die Current-State-Table zur aktuellen Tabelle handelt
             if (this.BTInterface.IsHistoryTable && refAttr.ReferencedBTInterface.IsCurrentStateTable &&
                 refAttr.ReferencedBTInterface.coreInterface == this.BTInterface.coreInterface)
             {
                 dim = new DimensionALInterface(Model, refAttr, null, this.Depth + 1);
             }
             else
             {
                 dim = new DimensionALInterface(Model, refAttr, this.RootDimension, this.Depth + 1);
             }
             dim = Model.GetDimensionInterfaceFor(dim);
             Attributes.Add(new RefALAttribute(this, dim, refAttr));
         }
         else
         {
             throw new NotImplementedException($"DimensionALInterface.PrepareAttributes: Attributtyp {attr.GetType().Name} nicht unterstützt");
         }
     }
 }