public virtual Net.Vpc.Upa.Expressions.CompiledExpression Update(Net.Vpc.Upa.Expressions.CompiledExpression e)
        {
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.IsHierarchyDescendentCompiled o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.IsHierarchyDescendentCompiled)e;
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression     c = o.GetChildExpression();
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression     p = o.GetAncestorExpression();
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName            n = o.GetEntityName();
            Net.Vpc.Upa.Entity treeEntity = null;
            Net.Vpc.Upa.Field  treeField  = null;
            if (c is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)
            {
                object childReferrer = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)c).GetFinest().GetReferrer();
                if (childReferrer != null)
                {
                    if (childReferrer is Net.Vpc.Upa.Entity)
                    {
                        if (treeEntity == null)
                        {
                            treeEntity = (Net.Vpc.Upa.Entity)childReferrer;
                        }
                        else
                        {
                            if (!treeEntity.GetName().Equals(((Net.Vpc.Upa.Entity)childReferrer).GetName()))
                            {
                                throw new System.ArgumentException("Ambiguous or Invalid Type " + treeEntity.GetName() + " in TreeEntity near " + e);
                            }
                        }
                    }
                }
            }
            else if (c is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)
            {
                object co = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)c).GetValue();
                if (co != null && persistenceUnit.ContainsEntity(co.GetType()))
                {
                    Net.Vpc.Upa.Entity rr = persistenceUnit.GetEntity(co.GetType());
                    if (treeEntity == null)
                    {
                        treeEntity = rr;
                    }
                    ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)c).SetValue(rr.GetBuilder().ObjectToId(co));
                }
            }
            //            Object co = ((CompiledParam) c).getEffectiveDataType();
            if (p is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)
            {
                object parentReferrer = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)p).GetFinest().GetReferrer();
                if (parentReferrer != null)
                {
                    if (parentReferrer is Net.Vpc.Upa.Entity)
                    {
                        if (treeEntity == null)
                        {
                            treeEntity = (Net.Vpc.Upa.Entity)parentReferrer;
                        }
                        else
                        {
                            if (!treeEntity.GetName().Equals(((Net.Vpc.Upa.Entity)parentReferrer).GetName()))
                            {
                                throw new System.ArgumentException("Ambiguous or Invalid Type " + treeEntity.GetName() + " in TreeEntity near " + e);
                            }
                        }
                    }
                }
            }
            else if (p is Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)
            {
                object co = ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)p).GetValue();
                if (co != null && persistenceUnit.ContainsEntity(co.GetType()))
                {
                    Net.Vpc.Upa.Entity rr = persistenceUnit.FindEntity(co.GetType());
                    if (treeEntity == null)
                    {
                        treeEntity = rr;
                    }
                    ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)p).SetValue(rr.GetBuilder().ObjectToId(co));
                    if ((rr.GetPrimaryFields()).Count > 1)
                    {
                        throw new System.ArgumentException("Not supported");
                    }
                    ((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledParam)p).SetTypeTransform(Net.Vpc.Upa.Impl.Util.UPAUtils.GetTypeTransformOrIdentity(rr.GetPrimaryFields()[0]));
                }
            }
            //            Object co = ((CompiledParam) c).getEffectiveDataType();
            if (treeEntity == null)
            {
                treeEntity = persistenceUnit.GetEntity(n.GetName());
            }
            Net.Vpc.Upa.Relationship t = Net.Vpc.Upa.Impl.Extension.HierarchicalRelationshipSupport.GetTreeRelationName(treeEntity);
            if (t == null)
            {
                throw new System.ArgumentException("Hierarchy Relationship not found");
            }
            Net.Vpc.Upa.Extensions.HierarchyExtension s = t.GetHierarchyExtension();
            if (s == null)
            {
                throw new System.ArgumentException("Not a valid TreeEntity");
            }
            Net.Vpc.Upa.Field pathField = treeEntity.GetField(s.GetHierarchyPathField());
            string            pathSep   = s.GetHierarchyPathSeparator();

            return(CreateConditionForDeepSearch(c, (Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression)p, true, pathField, pathSep));
        }
Esempio n. 2
0
 public virtual void SetHierarchyExtension(Net.Vpc.Upa.Extensions.HierarchyExtension hierarchyExtension)
 {
     this.hierarchyExtension = hierarchyExtension;
 }