コード例 #1
0
 protected internal virtual Net.Vpc.Upa.Config.DecorationValue Convert(object v, int pos)
 {
     if (v == null)
     {
         return(new Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue(null, Net.Vpc.Upa.Config.ConfigInfo.DEFAULT));
     }
     if (v is System.Attribute)
     {
         return(new Net.Vpc.Upa.Impl.Config.Decorations.AnnotationDecoration((System.Attribute)v, Net.Vpc.Upa.Config.DecorationSourceType.TYPE, Net.Vpc.Upa.Impl.Util.PlatformUtils.GetUndefinedValue <Net.Vpc.Upa.Config.DecorationTarget>(typeof(Net.Vpc.Upa.Config.DecorationTarget)), null, null, pos));
     }
     else if ((v.GetType()).IsArray)
     {
         int len = ((System.Array)(v)).Length;
         Net.Vpc.Upa.Config.DecorationValue[] arr = new Net.Vpc.Upa.Config.DecorationValue[len];
         for (int i = 0; i < arr.Length; i++)
         {
             arr[i] = Convert(((System.Array)(v)).GetValue(i), i);
         }
         return(new Net.Vpc.Upa.Impl.Config.Decorations.DecorationArray(arr, GetConfig()));
     }
     else if (v is Net.Vpc.Upa.Config.DecorationValue)
     {
         return((Net.Vpc.Upa.Config.DecorationValue)v);
     }
     return(new Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue(v, GetConfig()));
 }
コード例 #2
0
 public virtual Net.Vpc.Upa.Config.DecorationValue Get(string name)
 {
     System.Collections.Generic.IDictionary <string, Net.Vpc.Upa.Config.DecorationValue> a = GetAttributes();
     Net.Vpc.Upa.Config.DecorationValue v = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Config.DecorationValue>(a, name);
     if (v == null)
     {
         throw new System.ArgumentException("Attribute not found " + GetName() + "." + name);
     }
     return(v);
 }
コード例 #3
0
 public virtual void Merge()
 {
     System.Collections.Generic.Dictionary <string, Net.Vpc.Upa.Config.DecorationValue> att = new System.Collections.Generic.Dictionary <string, Net.Vpc.Upa.Config.DecorationValue>();
     Net.Vpc.Upa.Config.DecorationValue[] alternatives1 = GetAlternatives();
     Net.Vpc.Upa.Config.DecorationValue[] alternatives  = Shrink(alternatives1);
     foreach (Net.Vpc.Upa.Config.DecorationValue alternative in alternatives)
     {
         Net.Vpc.Upa.Config.Decoration d = (Net.Vpc.Upa.Config.Decoration)alternative;
         foreach (System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Config.DecorationValue> e in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Config.DecorationValue> >(d.GetAttributes()))
         {
             Net.Vpc.Upa.Impl.Config.Decorations.AbstractDecorationValue v1 = (Net.Vpc.Upa.Impl.Config.Decorations.AbstractDecorationValue)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Config.DecorationValue>(att, (e).Key);
             Net.Vpc.Upa.Impl.Config.Decorations.AbstractDecorationValue v2 = (Net.Vpc.Upa.Impl.Config.Decorations.AbstractDecorationValue)(e).Value;
             if (v1 == null)
             {
                 att[(e).Key] = v2;
             }
             else
             {
                 v1.AddAlternative(v2);
             }
         }
         break;
     }
     foreach (System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Config.DecorationValue> e in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Config.DecorationValue> >(att))
     {
         ((Net.Vpc.Upa.Impl.Config.Decorations.AbstractDecoration)(e).Value).Merge();
     }
     if (alternatives.Length == 0)
     {
         Net.Vpc.Upa.Config.DecorationValue last = alternatives1[alternatives1.Length - 1];
         mergedAttributes = new System.Collections.Generic.Dictionary <string, Net.Vpc.Upa.Config.DecorationValue>();
         mergedConfigInfo = new Net.Vpc.Upa.Config.ConfigInfo(last.GetConfig().GetOrder(), Net.Vpc.Upa.Config.ConfigAction.DELETE, last.GetConfig().GetPersistenceGroup(), last.GetConfig().GetPersistenceUnit());
     }
     else
     {
         Net.Vpc.Upa.Config.DecorationValue last = alternatives[alternatives.Length - 1];
         mergedAttributes = att;
         mergedConfigInfo = new Net.Vpc.Upa.Config.ConfigInfo(last.GetConfig().GetOrder(), Net.Vpc.Upa.Config.ConfigAction.MERGE, last.GetConfig().GetPersistenceGroup(), last.GetConfig().GetPersistenceUnit());
     }
 }
コード例 #4
0
 public virtual int CompareTo(Net.Vpc.Upa.Config.DecorationValue o)
 {
     if (o == null)
     {
         return(1);
     }
     if (o == this)
     {
         return(0);
     }
     Net.Vpc.Upa.Config.ConfigInfo c1 = this.GetConfig();
     Net.Vpc.Upa.Config.ConfigInfo c2 = o.GetConfig();
     if (c1 == c2)
     {
         return(0);
     }
     if (c1 != null)
     {
         return(c1.CompareTo(c2));
     }
     return(0);
 }
コード例 #5
0
        public virtual void Merge()
        {
            System.Collections.Generic.IList <object> ok           = new System.Collections.Generic.List <object>();
            Net.Vpc.Upa.Config.DecorationValue[]      alternatives = GetAlternatives();
            foreach (Net.Vpc.Upa.Config.DecorationValue alternative in alternatives)
            {
                Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue d = (Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue)alternative;
                switch (d.GetConfig().GetConfigAction())
                {
                case Net.Vpc.Upa.Config.ConfigAction.DELETE:
                {
                    ok.Clear();
                    break;
                }

                case Net.Vpc.Upa.Config.ConfigAction.MERGE:
                case Net.Vpc.Upa.Config.ConfigAction.REPLACE:
                {
                    ok.Clear();
                    ok.Add(d.GetValue());
                    break;
                }
                }
            }
            Net.Vpc.Upa.Config.DecorationValue last = alternatives[alternatives.Length - 1];
            if ((ok.Count == 0))
            {
                @value     = null;
                configInfo = new Net.Vpc.Upa.Config.ConfigInfo(last.GetConfig().GetOrder(), Net.Vpc.Upa.Config.ConfigAction.DELETE, last.GetConfig().GetPersistenceGroup(), last.GetConfig().GetPersistenceUnit());
            }
            else
            {
                @value     = ok[(ok).Count - 1];
                configInfo = new Net.Vpc.Upa.Config.ConfigInfo(last.GetConfig().GetOrder(), Net.Vpc.Upa.Config.ConfigAction.MERGE, last.GetConfig().GetPersistenceGroup(), last.GetConfig().GetPersistenceUnit());
            }
        }
コード例 #6
0
 public virtual void AddAlternative(Net.Vpc.Upa.Config.DecorationValue other)
 {
     alternatives.Add(other);
     Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(alternatives, null);
 }