protected internal virtual int ValidateDefault(System.Collections.Generic.ICollection <Net.Vpc.Upa.Field> fields, Net.Vpc.Upa.Expressions.Expression expression) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { // System.out.println("DEFAULT_VALIDATION = " + // validationPass.pass+" : "+ validationPass.fields); Net.Vpc.Upa.Record u = entity.GetBuilder().CreateRecord(); foreach (Net.Vpc.Upa.Field field in fields) { Net.Vpc.Upa.Expressions.Expression fieldExpression = GetFieldExpression(field, onPersist); Net.Vpc.Upa.Expressions.Expression validExpression = fieldExpression; if (forceExpressionTypeCasting || (fieldExpression is Net.Vpc.Upa.Expressions.Literal && ((Net.Vpc.Upa.Expressions.Literal)fieldExpression).GetValue() == null)) { validExpression = new Net.Vpc.Upa.Expressions.Cast(fieldExpression, field.GetDataType()); } u.SetObject(field.GetName(), validExpression); } try { return(entity.UpdateCore(u, expression, context)); } catch (Net.Vpc.Upa.Exceptions.UPAException ex) { // Log.bug(ex); // Select sb0 = new Select(); // for (Field f : fields) { // Expression fieldExpression = getFieldExpression(f, onPersist); // sb0.field(fieldExpression, f.getName() + "Expression"); // Expression validExpression = fieldExpression; // if (forceExpressionTypeCasting || (fieldExpression instanceof Literal && ((Literal) fieldExpression).getValue() == null)) { // validExpression = new Cast(fieldExpression, f.getDataType()); // } // sb0.field(validExpression, f.getName() + "CastExpression"); // } // sb0.from(entity.getName()); // sb0.setWhere(expression); // //// Log.bug("Values to update are : "); // for (Record ur : entity.createQuery(sb0).getRecordList()) { // for (Map.Entry<String, Object> entry : ur.toMap().entrySet()) { // //Log.bug(entry.getKey() + " : " + entry.getValue()); // } // } throw ex; } }
protected internal virtual Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledCast CompileCast(Net.Vpc.Upa.Expressions.Cast 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.CompiledCast s = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledCast(manager.TranslateAny(v.GetValue(), declarations), new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(v.GetDataType())); // s.setDeclarationList(declarations); return(s); }