protected internal virtual void ValidateChildren(object key, Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Record r = GetEntity().CreateQueryBuilder().ByExpression(GetEntity().GetBuilder().IdToExpression(key, null)).SetFieldFilter(Net.Vpc.Upa.Filters.Fields.ByName(GetHierarchyPathField())).GetRecord(); System.Collections.Generic.IList <Net.Vpc.Upa.Field> lfs = GetTreeRelationship().GetSourceRole().GetFields(); Net.Vpc.Upa.Expressions.Concat concat = new Net.Vpc.Upa.Expressions.Concat(); concat.Add(new Net.Vpc.Upa.Expressions.Literal(r.GetString(GetHierarchyPathField()), GetEntity().GetField(GetHierarchyPathField()).GetDataType())); System.Collections.Generic.IList <Net.Vpc.Upa.Field> primaryFields = GetEntity().GetPrimaryFields(); foreach (Net.Vpc.Upa.Field f in primaryFields) { concat.Add(new Net.Vpc.Upa.Expressions.Literal(GetHierarchyPathSeparator())); Net.Vpc.Upa.Types.DataType t = f.GetDataType(); Net.Vpc.Upa.Expressions.Var var = new Net.Vpc.Upa.Expressions.Var(f.GetName()); Net.Vpc.Upa.Expressions.Expression svar = null; if (t is Net.Vpc.Upa.Types.StringType) { svar = var; } else if (t is Net.Vpc.Upa.Types.IntType) { svar = new Net.Vpc.Upa.Expressions.I2V(var); } else if (t is Net.Vpc.Upa.Types.LongType) { svar = new Net.Vpc.Upa.Expressions.I2V(var); } else if (t is Net.Vpc.Upa.Types.DoubleType) { svar = new Net.Vpc.Upa.Expressions.D2V(var); } else if (t is Net.Vpc.Upa.Types.FloatType) { svar = new Net.Vpc.Upa.Expressions.D2V(var); } else { throw new System.ArgumentException("Unsupported "); } concat.Add(svar); } Net.Vpc.Upa.Record s = GetEntity().GetBuilder().CreateRecord(); s.SetObject(GetHierarchyPathField(), concat); Net.Vpc.Upa.Expressions.Expression p = null; Net.Vpc.Upa.Relationship rel = GetTreeRelationship(); object[] kvalue = GetEntity().GetBuilder().IdToKey(key).GetValue(); for (int i = 0; i < rel.Size(); i++) { Net.Vpc.Upa.Field field = lfs[i]; Net.Vpc.Upa.Expressions.Expression e = (new Net.Vpc.Upa.Expressions.Equals(new Net.Vpc.Upa.Expressions.Var(field.GetName()), new Net.Vpc.Upa.Expressions.Literal(kvalue[i], field.GetDataType()))); p = p == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(p, e); } GetEntity().UpdateCore(s, p, executionContext); System.Collections.Generic.IList <object> children = GetEntity().CreateQueryBuilder().ByExpression(p).GetIdList <K>(); foreach (object aChildren in children) { ValidateChildren(aChildren, executionContext); } }
public override Net.Vpc.Upa.Expressions.Expression Copy() { Net.Vpc.Upa.Expressions.I2V o = new Net.Vpc.Upa.Expressions.I2V(expression.Copy()); return(o); }
protected internal virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledI2V CompileI2V(Net.Vpc.Upa.Expressions.I2V v, Net.Vpc.Upa.Impl.Uql.ExpressionTranslationManager manager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) { if (v == null) { return(null); } Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledI2V s = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledI2V(manager.TranslateAny(v.GetExpression(), declarations)); // s.setDeclarationList(declarations); return(s); }