示例#1
0
 public virtual void MergeHierarchy(Net.Vpc.Upa.Config.Decoration gid)
 {
     if (gid.GetConfig().GetOrder() >= hierarchyConfigOrder)
     {
         specified    = true;
         hierarchy    = true;
         manyToOne    = true;
         targetEntity = baseFieldInfo.GetEntityInfo().GetName();
         System.Type entityType = baseFieldInfo.GetEntityInfo().GetEntityType();
         targetEntityType = entityType;
         if (Net.Vpc.Upa.Impl.Util.PlatformUtils.IsUndefinedValue <Net.Vpc.Upa.RelationshipType>(typeof(Net.Vpc.Upa.RelationshipType), relationType))
         {
             relationType = Net.Vpc.Upa.RelationshipType.COMPOSITION;
         }
         System.Type nativeClass = GetFieldType();
         if (!nativeClass.Equals(entityType))
         {
             throw new System.ArgumentException("Hierarchy Relationship invalid as " + nativeClass + " <> " + entityType);
         }
         if ((gid.GetString("path")).Length > 0)
         {
             hierarchyPathField = gid.GetString("path");
         }
         if ((gid.GetString("separator")).Length > 0)
         {
             hierarchyPathSeparator = gid.GetString("separator");
         }
         if (gid.GetConfig().GetOrder() > hierarchyConfigOrder)
         {
             hierarchyConfigOrder = gid.GetConfig().GetOrder();
         }
     }
 }
示例#2
0
        public virtual int Compare(System.Type o1, System.Type o2, int i1, int i2)
        {
            Net.Vpc.Upa.Config.Decoration e1 = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(o1, typeof(Net.Vpc.Upa.Config.Entity));
            Net.Vpc.Upa.Config.Decoration e2 = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(o1, typeof(Net.Vpc.Upa.Config.Entity));
            int x = e1.GetDecoration("config").GetInt("order") - e2.GetDecoration("config").GetInt("order");

            if (x != 0)
            {
                return(x);
            }
            Net.Vpc.Upa.Config.Decoration p1 = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(o1, typeof(Net.Vpc.Upa.Config.Partial));
            Net.Vpc.Upa.Config.Decoration p2 = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(o1, typeof(Net.Vpc.Upa.Config.Partial));
            if (p1 != null && p2 == null)
            {
                return(1);
            }
            if (p2 != null && p1 == null)
            {
                return(-1);
            }
            if (p1 != null && p2 != null)
            {
                if (p1.GetType("value").Equals(o2))
                {
                    return(-1);
                }
                if (p2.GetType("value").Equals(o1))
                {
                    return(1);
                }
            }
            return(i1 - i2);
        }
示例#3
0
 public static Net.Vpc.Upa.Config.Decoration GetDecoration(System.Type type, System.Type annotationClass, string persistenceGroup, string persistenceUnit, Net.Vpc.Upa.Impl.Config.Decorations.DecorationRepository repository)
 {
     Net.Vpc.Upa.Config.Decoration a = repository.GetTypeDecoration(type, annotationClass);
     if (a != null && AcceptAnnotation(a, persistenceGroup, persistenceUnit))
     {
         return(a);
     }
     return(null);
 }
示例#4
0
 public ScanEvent(Net.Vpc.Upa.UPAContext context, Net.Vpc.Upa.PersistenceGroup persistenceGroup, Net.Vpc.Upa.PersistenceUnit persistenceUnit, System.Type contract, System.Type type, System.Reflection.MethodInfo method, Net.Vpc.Upa.Field field, Net.Vpc.Upa.Config.Decoration decoration, object instance)
 {
     this.context           = context;
     this.persistenceGroup  = persistenceGroup;
     this.persistenceUnit   = persistenceUnit;
     this.contract          = contract;
     this.visitedType       = type;
     this.visitedMethod     = method;
     this.visitedField      = field;
     this.visitedDecoration = decoration;
     this.userObject        = instance;
 }
示例#5
0
 public virtual void Parse(System.Collections.Generic.IList <System.Reflection.FieldInfo> fields, bool nullable)
 {
     fieldsList = fields;
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> manyToOneDecorations = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> hierarchyDecorations = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     foreach (System.Reflection.FieldInfo javaField in fields)
     {
         Net.Vpc.Upa.Config.Decoration gid  = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.ManyToOne));
         Net.Vpc.Upa.Config.Decoration gid2 = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Hierarchy));
         if (gid != null)
         {
             //                ConfigInfo config = gid.getConfig();
             manyToOneDecorations.Add(gid);
         }
         if (gid2 != null)
         {
             //                ConfigInfo config = gid.getConfig();
             hierarchyDecorations.Add(gid2);
         }
     }
     if ((manyToOneDecorations).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(manyToOneDecorations, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     if ((hierarchyDecorations).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(hierarchyDecorations, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in manyToOneDecorations)
     {
         MergeManyToOne(gid);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in hierarchyDecorations)
     {
         MergeHierarchy(gid);
     }
     if (GetTargetEntityType() == null || GetTargetEntityType().Equals(typeof(void)))
     {
         SetTargetEntityType(GetFieldType());
     }
     if (IsManyToOne())
     {
         System.Type nativeClass = GetFieldType();
         if (!Net.Vpc.Upa.Impl.Util.UPAUtils.IsSimpleFieldType(nativeClass))
         {
             Net.Vpc.Upa.Types.ManyToOneType manyToOneType = new Net.Vpc.Upa.Types.ManyToOneType(name, nativeClass, null, true, nullable);
             preferredDataType = (manyToOneType);
         }
     }
 }
 protected internal override Net.Vpc.Upa.Config.ConfigInfo GetConfigInfo0()
 {
     if (configInfo == null)
     {
         Net.Vpc.Upa.Config.Decoration config = GetDecoration("config");
         if (config != null)
         {
             Net.Vpc.Upa.Config.Decoration c = (Net.Vpc.Upa.Config.Decoration)config;
             if (c.GetName().Equals((typeof(Net.Vpc.Upa.Config.Config)).FullName))
             {
                 configInfo = new Net.Vpc.Upa.Config.ConfigInfo(c.GetInt("order"), (Net.Vpc.Upa.Config.ConfigAction)(System.Enum.Parse(typeof(Net.Vpc.Upa.Config.ConfigAction), c.GetString("action"))), c.GetString("persistenceGroup"), c.GetString("persistenceUnit"));
             }
         }
     }
     return(configInfo);
 }
示例#7
0
 public virtual void Parse(System.Collections.Generic.IList <System.Reflection.FieldInfo> fields)
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> formulas = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     foreach (System.Reflection.FieldInfo javaField in fields)
     {
         Net.Vpc.Upa.Config.Decoration gid = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Formula));
         if (gid != null)
         {
             formulas.Add(gid);
         }
         Net.Vpc.Upa.Config.Decoration flist = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Formulas));
         if (flist != null)
         {
             foreach (Net.Vpc.Upa.Config.DecorationValue ff in flist.GetArray("value"))
             {
                 //net.vpc.upa.config.Formula formula
                 formulas.Add((Net.Vpc.Upa.Config.Decoration)ff);
             }
         }
     }
     if ((formulas).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(formulas, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in formulas)
     {
         MergeFormula(gid);
     }
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> sequences = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     foreach (System.Reflection.FieldInfo javaField in fields)
     {
         Net.Vpc.Upa.Config.Decoration gid = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Sequence));
         if (gid != null)
         {
             sequences.Add(gid);
         }
     }
     if ((sequences).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(sequences, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in sequences)
     {
         MergeSequence(gid);
     }
 }
        public virtual string GetFieldName(System.Reflection.FieldInfo javaField)
        {
            string name = null;

            if (AcceptField(javaField))
            {
                Net.Vpc.Upa.Config.Decoration anno = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Field));
                if (anno != null)
                {
                    name = anno.GetString("name");
                }
                if (name == null || (name).Length == 0)
                {
                    name = (javaField).Name;
                }
            }
            return(name);
        }
示例#9
0
 public virtual int Compare(System.Reflection.FieldInfo o1, System.Reflection.FieldInfo o2)
 {
     Net.Vpc.Upa.Config.Decoration f1 = repo.GetFieldDecoration(o1, typeof(Net.Vpc.Upa.Config.Field));
     Net.Vpc.Upa.Config.Decoration f2 = repo.GetFieldDecoration(o2, typeof(Net.Vpc.Upa.Config.Field));
     if (f1 == null && f2 == null)
     {
         return(0);
     }
     if (f1 == null)
     {
         return(-1);
     }
     if (f2 == null)
     {
         return(1);
     }
     return(f1.GetConfig().GetOrder().CompareTo(f2.GetConfig().GetOrder()));
 }
示例#10
0
 public virtual void MergeSequence(Net.Vpc.Upa.Config.Decoration gid)
 {
     specified = true;
     if (gid.GetConfig().GetOrder() >= configOrder)
     {
         specified = true;
         if (gid.GetInt("allocationSize") != System.Int32.MinValue)
         {
             allocationSize = gid.GetInt("allocationSize");
         }
         if (gid.GetInt("initialValue") != System.Int32.MinValue)
         {
             initialValue = gid.GetInt("initialValue");
         }
         if ((gid.GetString("format")).Length > 0)
         {
             format = gid.GetString("format");
         }
         if ((gid.GetString("group")).Length > 0)
         {
             group = gid.GetString("group");
         }
         if (!System.Collections.Generic.EqualityComparer <Net.Vpc.Upa.SequenceType> .Default.Equals(gid.GetEnum <Net.Vpc.Upa.SequenceType>("type", typeof(Net.Vpc.Upa.SequenceType)), Net.Vpc.Upa.SequenceType.DEFAULT))
         {
             sequenceType = gid.GetEnum <Net.Vpc.Upa.SequenceType>("type", typeof(Net.Vpc.Upa.SequenceType));
         }
         if ((gid.GetString("name")).Length > 0)
         {
             name = gid.GetString("name");
         }
         if (!System.Collections.Generic.EqualityComparer <Net.Vpc.Upa.SequenceStrategy> .Default.Equals(gid.GetEnum <Net.Vpc.Upa.SequenceStrategy>("strategy", typeof(Net.Vpc.Upa.SequenceStrategy)), Net.Vpc.Upa.SequenceStrategy.UNSPECIFIED))
         {
             strategy = gid.GetEnum <Net.Vpc.Upa.SequenceStrategy>("strategy", typeof(Net.Vpc.Upa.SequenceStrategy));
         }
         if (gid.GetInt("formulaOrder") != System.Int32.MinValue)
         {
             formulaOrder = gid.GetInt("formulaOrder");
         }
         if (gid.GetConfig().GetOrder() > configOrder)
         {
             configOrder = gid.GetConfig().GetOrder();
         }
     }
 }
示例#11
0
        public virtual void MergeSequence(Net.Vpc.Upa.Config.Decoration formulaInfo)
        {
            Net.Vpc.Upa.SequenceType  stype = formulaInfo.GetEnum <Net.Vpc.Upa.SequenceType>("type", typeof(Net.Vpc.Upa.SequenceType));
            Net.Vpc.Upa.FormulaType[] types = null;
            switch (stype)
            {
            case Net.Vpc.Upa.SequenceType.DEFAULT:
            case Net.Vpc.Upa.SequenceType.PERSIST:
            {
                types = new Net.Vpc.Upa.FormulaType[] { Net.Vpc.Upa.FormulaType.PERSIST };
                break;
            }

            case Net.Vpc.Upa.SequenceType.UPDATE:
            {
                types = new Net.Vpc.Upa.FormulaType[] { Net.Vpc.Upa.FormulaType.UPDATE };
                break;
            }

            case Net.Vpc.Upa.SequenceType.BOTH:
            {
                types = new Net.Vpc.Upa.FormulaType[] { Net.Vpc.Upa.FormulaType.PERSIST, Net.Vpc.Upa.FormulaType.UPDATE };
                break;
            }
            }
            if (types.Length == 0)
            {
                types = new Net.Vpc.Upa.FormulaType[] { Net.Vpc.Upa.FormulaType.PERSIST, Net.Vpc.Upa.FormulaType.UPDATE };
            }
            foreach (Net.Vpc.Upa.FormulaType type in types)
            {
                object o = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.FormulaType, object>(all, type);
                Net.Vpc.Upa.Impl.Config.Annotationparser.SequenceInfo old = (o is Net.Vpc.Upa.Impl.Config.Annotationparser.SequenceInfo) ? (Net.Vpc.Upa.Impl.Config.Annotationparser.SequenceInfo)o : null;
                if (old == null)
                {
                    old             = new Net.Vpc.Upa.Impl.Config.Annotationparser.SequenceInfo(repo);
                    old.configOrder = System.Int32.MinValue;
                    all[type]       = old;
                }
                old.MergeSequence(formulaInfo);
            }
        }
示例#12
0
 public virtual void Parse(System.Collections.Generic.IList <System.Reflection.FieldInfo> fields)
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> persistSequenceFields = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     foreach (System.Reflection.FieldInfo javaField in fields)
     {
         Net.Vpc.Upa.Config.Decoration gid = repo.GetFieldDecoration(javaField, typeof(Net.Vpc.Upa.Config.Sequence));
         if (gid != null)
         {
             persistSequenceFields.Add(gid);
         }
     }
     if ((persistSequenceFields).Count > 1)
     {
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListSort(persistSequenceFields, Net.Vpc.Upa.Impl.Config.Annotationparser.DecorationComparator.INSTANCE);
     }
     foreach (Net.Vpc.Upa.Config.Decoration gid in persistSequenceFields)
     {
         MergeSequence(gid);
     }
 }
示例#13
0
 public virtual void MergeFormula(Net.Vpc.Upa.Config.Decoration formulaInfo)
 {
     Net.Vpc.Upa.FormulaType[] types = formulaInfo.GetPrimitiveArray <Net.Vpc.Upa.FormulaType>("type", typeof(Net.Vpc.Upa.FormulaType));
     if (types.Length == 0)
     {
         types = new Net.Vpc.Upa.FormulaType[] { Net.Vpc.Upa.FormulaType.PERSIST, Net.Vpc.Upa.FormulaType.UPDATE };
     }
     foreach (Net.Vpc.Upa.FormulaType type in types)
     {
         object o = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <Net.Vpc.Upa.FormulaType, object>(all, type);
         Net.Vpc.Upa.Impl.Config.Annotationparser.FormulaInfo old = (o is Net.Vpc.Upa.Impl.Config.Annotationparser.FormulaInfo) ? (Net.Vpc.Upa.Impl.Config.Annotationparser.FormulaInfo)o : null;
         if (old == null)
         {
             old             = new Net.Vpc.Upa.Impl.Config.Annotationparser.FormulaInfo();
             old.configOrder = System.Int32.MinValue;
             old.formulaType = type;
             all[type]       = old;
         }
         old.MergeFormula(formulaInfo);
     }
 }
 private System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> FindIndexAnnotation(System.Type type)
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> list = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
     Net.Vpc.Upa.Config.Decoration indexAnn = repo.GetTypeDecoration(type, typeof(Net.Vpc.Upa.Config.Index));
     if (indexAnn != null)
     {
         list.Add(indexAnn);
     }
     Net.Vpc.Upa.Config.Decoration indexAnnAll = repo.GetTypeDecoration(type, typeof(Net.Vpc.Upa.Config.Indexes));
     if (indexAnnAll != null)
     {
         foreach (Net.Vpc.Upa.Config.DecorationValue index in indexAnnAll.GetArray("value"))
         {
             if (indexAnn != null)
             {
                 list.Add((Net.Vpc.Upa.Config.Decoration)index);
             }
         }
     }
     return(list);
 }
示例#15
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());
     }
 }
示例#16
0
 private static bool AcceptAnnotation(Net.Vpc.Upa.Config.Decoration a, string persistenceGroup, string persistenceUnit)
 {
     if (a == null)
     {
         return(false);
     }
     Net.Vpc.Upa.Config.Decoration configObject = a.GetDecoration("config");
     if (configObject != null)
     {
         string v = Net.Vpc.Upa.Impl.Util.StringUtils.Trim(configObject.GetString("persistenceGroup"));
         if (!Net.Vpc.Upa.Impl.Util.StringUtils.MatchesSimpleExpression(persistenceGroup, v, Net.Vpc.Upa.Impl.Util.PatternType.DOT_PATH))
         {
             return(false);
         }
         v = Net.Vpc.Upa.Impl.Util.StringUtils.Trim(configObject.GetString("persistenceUnit"));
         if (!Net.Vpc.Upa.Impl.Util.StringUtils.MatchesSimpleExpression(persistenceUnit, v, Net.Vpc.Upa.Impl.Util.PatternType.DOT_PATH))
         {
             return(false);
         }
     }
     return(true);
 }
示例#17
0
 public virtual void MergeFormula(Net.Vpc.Upa.Config.Decoration gid)
 {
     if (gid.GetConfig().GetOrder() >= configOrder)
     {
         specified = true;
         if (gid.GetInt("formulaOrder") != System.Int32.MinValue)
         {
             order = gid.GetInt("formulaOrder");
         }
         if ((gid.GetString("value")).Length > 0)
         {
             expression = gid.GetString("value");
             type       = null;
         }
         if (!gid.GetType("custom").Equals(typeof(object)) && !gid.GetType("custom").Equals(typeof(Net.Vpc.Upa.Formula)))
         {
             expression = null;
             type       = gid.GetType("custom");
         }
         configOrder = gid.GetConfig().GetOrder();
     }
 }
示例#18
0
 public static void ConfigureMethodCallback(System.Type type, System.Reflection.MethodInfo method, Net.Vpc.Upa.Config.Decoration methodDecoration, Net.Vpc.Upa.PersistenceUnit persistenceUnit)
 {
     Net.Vpc.Upa.CallbackType callbackType  = Net.Vpc.Upa.Impl.Util.PlatformUtils.GetUndefinedValue <Net.Vpc.Upa.CallbackType>(typeof(Net.Vpc.Upa.CallbackType));
     Net.Vpc.Upa.EventPhase   callbackPhase = Net.Vpc.Upa.Impl.Util.PlatformUtils.GetUndefinedValue <Net.Vpc.Upa.EventPhase>(typeof(Net.Vpc.Upa.EventPhase));
     System.Collections.Generic.IDictionary <string, object> conf = new System.Collections.Generic.Dictionary <string, object>();
     if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreAlter)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_ALTER;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnAlter)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_ALTER;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreCreate)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_CREATE;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnCreate)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_CREATE;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreDrop)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_DROP;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnDrop)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_DROP;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPrePersist)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_PERSIST;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPersist)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_PERSIST;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreUpdate)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_UPDATE;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnUpdate)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_UPDATE;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreRemove)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_REMOVE;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnRemove)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_REMOVE;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreReset)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_RESET;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnReset)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_RESET;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreInitialize)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_INITIALIZE;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnInitialize)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_INITIALIZE;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnPreUpdateFormula)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_UPDATE_FORMULAS;
         callbackPhase = Net.Vpc.Upa.EventPhase.BEFORE;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.OnUpdateFormula)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_UPDATE_FORMULAS;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         conf["trackSystemObjects"] = methodDecoration.GetBoolean("trackSystemObjects");
     }
     else if (methodDecoration.IsName(typeof(Net.Vpc.Upa.Config.Function)))
     {
         callbackType  = Net.Vpc.Upa.CallbackType.ON_EVAL;
         callbackPhase = Net.Vpc.Upa.EventPhase.AFTER;
         string      functionName = methodDecoration.GetString("name");
         System.Type returnType   = methodDecoration.GetType("returnType");
         if (!Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(functionName))
         {
             conf["functionName"] = functionName;
         }
         if (returnType != null && !Net.Vpc.Upa.Impl.Util.PlatformUtils.IsVoid(returnType))
         {
             conf["returnType"] = returnType;
         }
     }
     if (callbackType != default(Net.Vpc.Upa.CallbackType))
     {
         object instance = null;
         if (!Net.Vpc.Upa.Impl.Util.PlatformUtils.IsStatic(method))
         {
             instance = persistenceUnit.GetFactory().GetSingleton <object>(type);
         }
         persistenceUnit.AddCallback(new Net.Vpc.Upa.CallbackConfig(instance, method, callbackType, callbackPhase, conf));
     }
 }
示例#19
0
 public virtual void PersistenceUnitItemScanned(Net.Vpc.Upa.ScanEvent @event)
 {
     if (listener != null)
     {
         listener.PersistenceUnitItemScanned(@event);
     }
     Net.Vpc.Upa.PersistenceUnit persistenceUnit = @event.GetPersistenceUnit();
     System.Type contract = @event.GetContract();
     System.Type type     = @event.GetVisitedType();
     if (Net.Vpc.Upa.Impl.Config.URLAnnotationStrategySupport.IsPersistenceUnitItemDefinitionListener(contract))
     {
         object i = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, type);
         if (i == null)
         {
             i = persistenceUnit.GetFactory().CreateObject <object>(type);
             instances[type] = i;
         }
         Net.Vpc.Upa.Config.Decoration at = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
         string _filter             = at.GetString("filter");
         bool   _trackSystemObjects = at.GetBoolean("trackSystemObjects");
         //                    Callback cb = (Callback) at.getAnnotation();
         if ((_filter).Length == 0)
         {
             persistenceUnit.AddDefinitionListener((Net.Vpc.Upa.Callbacks.DefinitionListener)i, _trackSystemObjects);
         }
         else
         {
             persistenceUnit.AddDefinitionListener(_filter, (Net.Vpc.Upa.Callbacks.DefinitionListener)i, _trackSystemObjects);
         }
     }
     else if (typeof(Net.Vpc.Upa.Callbacks.PersistenceUnitListener).Equals(contract))
     {
         object i = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, type);
         if (i == null)
         {
             i = persistenceUnit.GetFactory().CreateObject <object>(type);
             instances[type] = i;
         }
         persistenceUnit.AddPersistenceUnitListener((Net.Vpc.Upa.Callbacks.PersistenceUnitListener)i);
     }
     else if (typeof(Net.Vpc.Upa.Callbacks.EntityInterceptor).Equals(contract))
     {
         Net.Vpc.Upa.Callbacks.EntityInterceptor i = (Net.Vpc.Upa.Callbacks.EntityInterceptor)Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(instances, type);
         if (i == null)
         {
             try {
                 i = (Net.Vpc.Upa.Callbacks.EntityInterceptor)persistenceUnit.GetFactory().CreateObject <object>(type);
             } catch (System.Exception ex) {
                 log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter(null, ex));
             }
             if (i != null)
             {
                 instances[type] = i;
             }
         }
         if (i != null)
         {
             Net.Vpc.Upa.Config.Decoration at = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
             string _filter = at.GetString("filter");
             string _name   = at.GetString("name");
             if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(_name))
             {
                 _name = (i.GetType()).Name;
             }
             bool _trackSystemObjects = at.GetBoolean("trackSystemObjects");
             //                    Callback cb = (Callback) at.getAnnotation();
             persistenceUnit.AddTrigger(_name, i, _filter, _trackSystemObjects);
         }
     }
     else if (typeof(Net.Vpc.Upa.EntityDescriptor).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.EntityDescriptor desc = (Net.Vpc.Upa.EntityDescriptor)@event.GetUserObject();
         persistenceUnit.AddEntity(desc);
     }
     else if (typeof(Net.Vpc.Upa.Function).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.Function          f = (Net.Vpc.Upa.Function)persistenceUnit.GetFactory().CreateObject <T>(@event.GetVisitedType());
         Net.Vpc.Upa.Config.Decoration d = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
         //                net.vpc.upa.config.FunctionDefinition d = type.getAnnotation();
         Net.Vpc.Upa.Types.DataType dt = Net.Vpc.Upa.Types.TypesFactory.ForPlatformType(d.GetType("returnType"));
         string n = d.GetString("name");
         if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(n))
         {
             n = d.GetLocationType();
         }
         persistenceUnit.GetExpressionManager().AddFunction(n, dt, f);
     }
     else if (typeof(Net.Vpc.Upa.Callback).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.Callback callbackType = (Net.Vpc.Upa.Callback)persistenceUnit.GetFactory().CreateObject <T>(@event.GetVisitedType());
         persistenceUnit.AddCallback(callbackType);
     }
     else if (typeof(Net.Vpc.Upa.EntitySecurityManager).Equals(@event.GetContract()))
     {
         Net.Vpc.Upa.Config.Decoration     d    = (Net.Vpc.Upa.Config.Decoration)@event.GetUserObject();
         Net.Vpc.Upa.EntitySecurityManager secu = (Net.Vpc.Upa.EntitySecurityManager)persistenceUnit.GetFactory().CreateObject <T>(@event.GetVisitedType());
         Net.Vpc.Upa.Impl.Config.EntityConfiguratorProcessor.ConfigureOneShot(persistenceUnit, new Net.Vpc.Upa.Impl.Util.SimpleEntityFilter(new Net.Vpc.Upa.Impl.Util.EqualsStringFilter(d.GetString("entity"), false, false), true), new Net.Vpc.Upa.Impl.Config.SecurityManagerEntityConfigurator(secu));
     }
     else if (@event.GetUserObject() is Net.Vpc.Upa.Impl.Config.DecoratedMethodScan)
     {
         Net.Vpc.Upa.Impl.Config.DecoratedMethodScan dms  = (Net.Vpc.Upa.Impl.Config.DecoratedMethodScan)@event.GetUserObject();
         Net.Vpc.Upa.Config.Decoration callbackDecoration = dms.GetDecoration();
         ConfigureMethodCallback(type, dms.GetMethod(), callbackDecoration, persistenceUnit);
     }
 }
示例#20
0
 public DecoratedMethodScan(Net.Vpc.Upa.Config.Decoration decoration, System.Reflection.MethodInfo method)
 {
     this.decoration = decoration;
     this.method     = method;
 }
示例#21
0
 public virtual void MergeManyToOne(Net.Vpc.Upa.Config.Decoration gid)
 {
     if (gid.GetConfig().GetOrder() >= manyToOneConfigOrder)
     {
         specified = true;
         manyToOne = true;
         System.Type nativeClass = GetFieldType();
         if ((nativeClass).IsArray)
         {
             throw new System.ArgumentException("Invalid Array type " + nativeClass + " for ManyToOne");
         }
         if (typeof(System.Type).IsAssignableFrom(nativeClass))
         {
             throw new System.ArgumentException("Invalid Collection type " + nativeClass + " for ManyToOne");
         }
         if ((nativeClass).IsEnum)
         {
             throw new System.ArgumentException("Enumerations are not supported in Relations");
         }
         if ((gid.GetString("name")).Length > 0)
         {
             name = gid.GetString("name");
         }
         string[] _mappedTo = gid.GetPrimitiveArray <string>("mappedTo", typeof(string));
         if (_mappedTo.Length != 0)
         {
             mappedTo = _mappedTo;
         }
         if (!System.Collections.Generic.EqualityComparer <Net.Vpc.Upa.RelationshipType> .Default.Equals(gid.GetEnum <Net.Vpc.Upa.RelationshipType>("type", typeof(Net.Vpc.Upa.RelationshipType)), Net.Vpc.Upa.RelationshipType.DEFAULT))
         {
             relationType = gid.GetEnum <Net.Vpc.Upa.RelationshipType>("type", typeof(Net.Vpc.Upa.RelationshipType));
         }
         if ((gid.GetString("filter")).Length > 0)
         {
             filter = gid.GetString("filter");
         }
         entityField = (fieldsList[0]).Name;
         string      _targetEntity     = gid.GetString("targetEntity");
         System.Type _targetEntityType = gid.GetType("targetEntityType");
         if ((_targetEntity).Length > 0 && !_targetEntityType.Equals(typeof(void)))
         {
             //problem
             throw new System.ArgumentException("Could not support both targetEntity and targetEntityType");
         }
         else if ((_targetEntity).Length > 0)
         {
             targetEntity     = _targetEntity;
             targetEntityType = null;
         }
         else if (!_targetEntityType.Equals(typeof(void)))
         {
             targetEntity     = null;
             targetEntityType = _targetEntityType;
         }
         if (Net.Vpc.Upa.Impl.Util.UPAUtils.IsSimpleFieldType(nativeClass))
         {
             if ((targetEntityType == null || targetEntityType.Equals(typeof(void))) && targetEntity == null)
             {
                 throw new System.ArgumentException("Missing targetEntityType in field " + baseFieldInfo.GetEntityInfo().GetName() + "." + name);
             }
         }
         if (gid.GetConfig().GetOrder() > manyToOneConfigOrder)
         {
             manyToOneConfigOrder = gid.GetConfig().GetOrder();
         }
     }
 }
示例#22
0
        public virtual void Visit(Net.Vpc.Upa.Config.Decoration d)
        {
            string typeName = d.GetLocationType();

            try {
                if (enableLog && typeName.ToLower().Contains("upalock"))
                {
                    log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("\t[{0}] unexpected registration of {1}", null, new object[] { name, typeName }));
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
            }
            string methodOrFieldName = d.GetLocation();

            Net.Vpc.Upa.Config.DecorationTarget targetType = d.GetTarget();
            if (enableLog && /*IsLoggable=*/ true)
            {
                log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 40, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("\t[{0}] register Decoration {1}", null, new object[] { name, d }));
            }
            Net.Vpc.Upa.Impl.Config.Decorations.DefaultDecorationRepositoryTypeInfo typeInfo = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Config.Decorations.DefaultDecorationRepositoryTypeInfo>(decorationsByType, typeName);
            if (typeInfo == null)
            {
                typeInfo                    = new Net.Vpc.Upa.Impl.Config.Decorations.DefaultDecorationRepositoryTypeInfo();
                typeInfo.typeName           = typeName;
                decorationsByType[typeName] = typeInfo;
            }
            if (targetType != default(Net.Vpc.Upa.Config.DecorationTarget))
            {
                switch (targetType)
                {
                case Net.Vpc.Upa.Config.DecorationTarget.TYPE:
                {
                    if (typeInfo.decorations == null)
                    {
                        typeInfo.decorations = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>(3);
                    }
                    System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = typeInfo.decorations;
                    int found = -1;
                    for (int i = 0; i < (m).Count; i++)
                    {
                        Net.Vpc.Upa.Config.Decoration m1 = m[i];
                        if (m1.GetName().Equals(d.GetName()) && m1.GetPosition() == d.GetPosition())
                        {
                            found = i;
                            break;
                        }
                    }
                    if (found < 0)
                    {
                        m.Add(d);
                    }
                    break;
                }

                case Net.Vpc.Upa.Config.DecorationTarget.METHOD:
                {
                    if (typeInfo.methods == null)
                    {
                        typeInfo.methods = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >();
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                        typeInfo.methods[methodOrFieldName] = m;
                        m.Add(d);
                    }
                    else
                    {
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >(typeInfo.methods, methodOrFieldName);
                        if (m == null)
                        {
                            m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                            typeInfo.methods[methodOrFieldName] = m;
                        }
                        int found = -1;
                        for (int i = 0; i < (m).Count; i++)
                        {
                            Net.Vpc.Upa.Config.Decoration m1 = m[i];
                            if (m1.GetName().Equals(d.GetName()) && m1.GetPosition() == d.GetPosition())
                            {
                                found = i;
                                break;
                            }
                        }
                        if (found < 0)
                        {
                            m.Add(d);
                        }
                    }
                    break;
                }

                case Net.Vpc.Upa.Config.DecorationTarget.FIELD:
                {
                    if (typeInfo.fields == null)
                    {
                        typeInfo.fields = new System.Collections.Generic.Dictionary <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >();
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                        typeInfo.fields[methodOrFieldName] = m;
                        m.Add(d);
                    }
                    else
                    {
                        System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> m = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.IList <Net.Vpc.Upa.Config.Decoration> >(typeInfo.fields, methodOrFieldName);
                        if (m == null)
                        {
                            m = new System.Collections.Generic.List <Net.Vpc.Upa.Config.Decoration>();
                            typeInfo.fields[methodOrFieldName] = m;
                        }
                        int found = -1;
                        for (int i = 0; i < (m).Count; i++)
                        {
                            Net.Vpc.Upa.Config.Decoration m1 = m[i];
                            if (m1.GetName().Equals(d.GetName()) && m1.GetPosition() == d.GetPosition())
                            {
                                found = i;
                                break;
                            }
                        }
                        if (found < 0)
                        {
                            m.Add(d);
                        }
                    }
                    break;
                }
                }
            }
            System.Collections.Generic.ISet <string> tt = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, System.Collections.Generic.ISet <string> >(typesByDecoration, d.GetName());
            if (tt == null)
            {
                tt = new System.Collections.Generic.HashSet <string>();
                typesByDecoration[d.GetName()] = tt;
            }
            tt.Add(typeName);
        }
 internal virtual void ParseEntityType(Net.Vpc.Upa.Impl.Config.Annotationparser.EntityInfo entityInfo, System.Type type, bool parseFields, bool parseModifiers, bool parseExtensions, Net.Vpc.Upa.ObjectFactory factory)
 {
     Net.Vpc.Upa.Config.Decoration ue = repo.GetTypeDecoration(type, typeof(Net.Vpc.Upa.Config.Entity));
     entityInfo.idType = Net.Vpc.Upa.Impl.Config.Annotationparser.AnnotationParserUtils.ValidClass(ue == null ? null : ue.GetType("idType"), entityInfo.idType, typeof(object));
     if (ue != null && !ue.GetType("entityType").Equals(typeof(void)))
     {
         entityInfo.entityType.SetBetterValue(ue.GetType("entityType"), ue.GetConfig().GetOrder());
     }
     entityInfo.name      = Net.Vpc.Upa.Impl.Config.Annotationparser.AnnotationParserUtils.ValidStr(Net.Vpc.Upa.Impl.Config.Annotationparser.AnnotationParserUtils.ValidStr(ue == null ? null : ue.GetString("name"), entityInfo.name), (type).Name);
     entityInfo.shortName = Net.Vpc.Upa.Impl.Config.Annotationparser.AnnotationParserUtils.ValidStr(ue == null ? null : ue.GetString("shortName"), entityInfo.shortName);
     if (parseModifiers && ue != null)
     {
         System.Collections.Generic.List <Net.Vpc.Upa.EntityModifier> all = new System.Collections.Generic.List <Net.Vpc.Upa.EntityModifier>();
         foreach (Net.Vpc.Upa.Config.DecorationValue v in ue.GetArray("modifiers"))
         {
             Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue pv = (Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue)v;
             all.Add(Net.Vpc.Upa.Impl.Util.PlatformUtils.Convert <Net.Vpc.Upa.EntityModifier>(pv.GetValue(), typeof(Net.Vpc.Upa.EntityModifier)));
         }
         entityInfo.AddModifiers(all);
         all = new System.Collections.Generic.List <Net.Vpc.Upa.EntityModifier>();
         foreach (Net.Vpc.Upa.Config.DecorationValue v in ue.GetArray("excludeModifiers"))
         {
             Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue pv = (Net.Vpc.Upa.Impl.Config.Decorations.DecorationPrimitiveValue)v;
             all.Add(Net.Vpc.Upa.Impl.Util.PlatformUtils.Convert <Net.Vpc.Upa.EntityModifier>(pv.GetValue(), typeof(Net.Vpc.Upa.EntityModifier)));
         }
         entityInfo.AddExcludeModifiers(all);
     }
     if (ue != null && ue.GetString("path") != null && (ue.GetString("path")).Length > 0)
     {
         entityInfo.path.SetBetterValue(ue.GetString("path"), ue.GetConfig().GetOrder());
     }
     if (ue != null && ue.GetString("listOrder") != null && (ue.GetString("listOrder")).Length > 0)
     {
         entityInfo.listOrder.SetBetterValue(ue.GetString("listOrder"), ue.GetConfig().GetOrder());
     }
     if (ue != null && ue.GetString("archivingOrder") != null && (ue.GetString("archivingOrder")).Length > 0)
     {
         entityInfo.archivingOrder.SetBetterValue(ue.GetString("archivingOrder"), ue.GetConfig().GetOrder());
     }
     Net.Vpc.Upa.Config.Decoration path = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(type, typeof(Net.Vpc.Upa.Config.Path));
     if (path != null)
     {
         if ((path.GetString("value")).Length > 0)
         {
             entityInfo.path.SetBetterValue(path.GetString("value"), path.GetConfig().GetOrder());
         }
         if (path.GetInt("position") != System.Int32.MinValue)
         {
             entityInfo.pathPosition.SetBetterValue(path.GetInt("position"), path.GetConfig().GetOrder());
         }
     }
     foreach (Net.Vpc.Upa.Config.Decoration indexAnn in FindIndexAnnotation(type))
     {
         //net.vpc.upa.config.Index
         System.Collections.Generic.IList <string> rr = new System.Collections.Generic.List <string>();
         Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(rr, new System.Collections.Generic.List <string>(indexAnn.GetPrimitiveArray <string>("fields", typeof(string))));
         entityInfo.AddIndex(indexAnn.GetString("name"), rr, indexAnn.GetBoolean("unique"), indexAnn.GetConfig().GetOrder());
     }
     //        net.vpc.upa.config.Sequence gue = (net.vpc.upa.config.Sequence) type.getAnnotation(Sequence.class);
     //        if (gue != null) {
     //            if (privateInfo.generatedIdInfo == null) {
     //                privateInfo.generatedIdInfo = new SequenceInfo();
     //            }
     //            privateInfo.generatedIdInfo.merge(gue);
     //        }
     if (parseFields)
     {
         System.Collections.Generic.IList <Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo> fieldInfos = new System.Collections.Generic.List <Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo>();
         if (!typeof(Net.Vpc.Upa.Record).IsAssignableFrom(type))
         {
             System.Type c = type;
             while (c != null)
             {
                 System.Collections.Generic.IList <Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo> cfields = new System.Collections.Generic.List <Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo>();
                 foreach (System.Reflection.FieldInfo field in c.GetFields(System.Reflection.BindingFlags.Default))
                 {
                     if (AcceptField(field))
                     {
                         string fieldName = GetFieldName(field);
                         Net.Vpc.Upa.Config.Decoration ignored = repo.GetFieldDecoration(field, typeof(Net.Vpc.Upa.Config.Ignore));
                         if (ignored != null)
                         {
                             Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo oldValue = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo>(entityInfo.fieldsMap, fieldName);
                             if (oldValue != null)
                             {
                                 oldValue.valid = false;
                             }
                         }
                         else
                         {
                             Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo oldValue = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo>(entityInfo.fieldsMap, fieldName);
                             if (oldValue == null)
                             {
                                 oldValue = new Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo(fieldName, entityInfo, repo);
                                 cfields.Add(oldValue);
                             }
                             oldValue.RegisterField(field);
                         }
                     }
                 }
                 Net.Vpc.Upa.Impl.FwkConvertUtils.ListInsertRange(fieldInfos, 0, cfields);
                 c = (c).BaseType;
             }
         }
         foreach (Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo fieldInfo in fieldInfos)
         {
             string name = fieldInfo.name;
             Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo old = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Config.Annotationparser.FieldInfo>(entityInfo.fieldsMap, name);
             if (old != null)
             {
                 throw new System.ArgumentException("Should never happen");
             }
             entityInfo.fieldsMap[name] = fieldInfo;
         }
     }
     if (parseExtensions)
     {
         Net.Vpc.Upa.Config.Decoration unionEntity = repo.GetTypeDecoration(type, typeof(Net.Vpc.Upa.Config.UnionEntity));
         if (unionEntity != null)
         {
             if (unionEntity.GetType("spec").Equals(typeof(Net.Vpc.Upa.Extensions.UnionEntityExtensionDefinition)))
             {
                 string discriminator = unionEntity.GetString("discriminator");
                 //                    String[] fields = unionEntity.fields();
                 //                    UnionEntityEntry[] entities = unionEntity.entities();
                 Net.Vpc.Upa.Config.DecorationValue[]      entities  = unionEntity.GetArray("entities");
                 System.Collections.Generic.IList <string> _entities = new System.Collections.Generic.List <string>();
                 System.Collections.Generic.IList <string> _fields   = new System.Collections.Generic.List <string>();
                 Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(_fields, new System.Collections.Generic.List <string>(unionEntity.GetPrimitiveArray <string>("fields", typeof(string))));
                 string     _entityFieldName = discriminator;
                 string[][] _mapping         = (string[][])Net.Vpc.Upa.Impl.FwkConvertUtils.CreateMultiArray(typeof(string), entities.Length, (_fields).Count);
                 int        ientity          = 0;
                 foreach (Net.Vpc.Upa.Config.DecorationValue entity0 in entities)
                 {
                     Net.Vpc.Upa.Config.Decoration entity = (Net.Vpc.Upa.Config.Decoration)entity0;
                     //UnionEntityEntry
                     _entities.Add(entity.GetString("entity"));
                     int ifield = 0;
                     foreach (string field in _fields)
                     {
                         string   f       = null;
                         string[] efields = entity.GetPrimitiveArray <string>("fields", typeof(string));
                         if (ifield < efields.Length)
                         {
                             f = efields[ifield];
                         }
                         if (f == null)
                         {
                             f = field;
                         }
                         _mapping[ientity][ifield] = f;
                         ifield++;
                     }
                     ientity++;
                 }
                 entityInfo.specs.Add(new Net.Vpc.Upa.Extensions.DefaultUnionEntityExtensionDefinition(new Net.Vpc.Upa.Extensions.UnionQueryInfo(_entities, _fields, _entityFieldName, _mapping)));
             }
             else
             {
                 entityInfo.specs.Add((Net.Vpc.Upa.Extensions.EntityExtensionDefinition)factory.CreateObject <T>(unionEntity.GetType("spec")));
             }
         }
         Net.Vpc.Upa.Config.Decoration view = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(type, typeof(Net.Vpc.Upa.Config.View));
         if (view != null)
         {
             System.Type spec = view.GetType("spec");
             if (spec.Equals(typeof(Net.Vpc.Upa.Extensions.ViewEntityExtensionDefinition)))
             {
                 throw new System.ArgumentException("Unsupported");
             }
             else
             {
                 entityInfo.specs.Add(factory.CreateObject <Net.Vpc.Upa.Extensions.ViewEntityExtensionDefinition>(spec));
             }
         }
     }
 }
 public virtual Net.Vpc.Upa.EntityDescriptor Resolve(System.Type[] classes) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (classes.Length == 0)
     {
         throw new System.ArgumentException("Empty Class Array");
     }
     else
     {
         if (classes.Length > 1)
         {
             Net.Vpc.Upa.Impl.Util.CompareUtils.Sort <System.Type>(classes, new Net.Vpc.Upa.Impl.Config.Annotationparser.ClassIndexedComparator(repo));
         }
         Net.Vpc.Upa.Impl.Config.Annotationparser.EntityInfo entityInfo = new Net.Vpc.Upa.Impl.Config.Annotationparser.EntityInfo(repo, factory);
         entityInfo.source = classes;
         System.Collections.Generic.IList <Net.Vpc.Upa.Property> parameterInfos = new System.Collections.Generic.List <Net.Vpc.Upa.Property>();
         foreach (System.Type descriptorType in classes)
         {
             Net.Vpc.Upa.Config.Decoration ue = (Net.Vpc.Upa.Config.Decoration)repo.GetTypeDecoration(descriptorType, typeof(Net.Vpc.Upa.Config.Entity));
             int  configOrder   = 0;
             bool isEntityClass = true;
             if (ue != null)
             {
                 configOrder   = ue.GetConfig().GetOrder();
                 isEntityClass = ue.GetType("entityType").Equals(typeof(void));
             }
             if (!isEntityClass)
             {
                 //ue.entityType() is never null
                 entityInfo.entityType.SetBetterValue(ue.GetType("entityType"), configOrder);
                 if (entityInfo.entityType.specified && !typeof(Net.Vpc.Upa.Record).Equals(entityInfo.entityType.@value))
                 {
                     ParseEntityType(entityInfo, entityInfo.entityType.@value, ue.GetBoolean("useEntityTypeFields"), ue.GetBoolean("useEntityTypeModifiers"), ue.GetBoolean("useEntityTypeExtensions"), factory);
                 }
                 ParseEntityType(entityInfo, descriptorType, true, true, true, factory);
             }
             else
             {
                 Net.Vpc.Upa.Config.Decoration p = repo.GetTypeDecoration(descriptorType, typeof(Net.Vpc.Upa.Config.Partial));
                 if (p == null)
                 {
                     entityInfo.entityType.SetBetterValue(descriptorType, configOrder);
                 }
                 ParseEntityType(entityInfo, descriptorType, true, true, true, factory);
             }
             Net.Vpc.Upa.Config.Decoration paramAnn = repo.GetTypeDecoration(descriptorType, typeof(Net.Vpc.Upa.Config.Property));
             if (paramAnn != null)
             {
                 parameterInfos.Add(new Net.Vpc.Upa.Property(paramAnn.GetString("name"), paramAnn.GetString("value"), paramAnn.GetString("type"), paramAnn.GetString("format")));
             }
             Net.Vpc.Upa.Config.Decoration paramsAnn = repo.GetTypeDecoration(descriptorType, typeof(Net.Vpc.Upa.Config.Properties));
             if (paramsAnn != null)
             {
                 foreach (Net.Vpc.Upa.Config.DecorationValue p in paramsAnn.GetArray("value"))
                 {
                     //p of type net.vpc.upa.config.Property
                     Net.Vpc.Upa.Config.Decoration pp = (Net.Vpc.Upa.Config.Decoration)p;
                     parameterInfos.Add(new Net.Vpc.Upa.Property(pp.GetString("name"), pp.GetString("value"), pp.GetString("type"), pp.GetString("format")));
                 }
             }
             Net.Vpc.Upa.Config.Decoration pathDeco = repo.GetTypeDecoration(descriptorType, typeof(Net.Vpc.Upa.Config.Path));
             if (pathDeco != null)
             {
                 Net.Vpc.Upa.Impl.Config.Annotationparser.AnnotationParserUtils.ValidStr(pathDeco.GetString("value"), entityInfo.path, pathDeco.GetConfig().GetOrder());
             }
         }
         foreach (Net.Vpc.Upa.Property parameterInfo in parameterInfos)
         {
             entityInfo.GetProperties()[parameterInfo.GetName()] = Net.Vpc.Upa.Impl.Util.UPAUtils.CreateValue(parameterInfo);
         }
         return(Build(entityInfo));
     }
 }