public virtual int CompareTo(object other) { if (other == this) { return(0); } if (other == null) { return(1); } Net.Vpc.Upa.Field f = (Net.Vpc.Upa.Field)other; Net.Vpc.Upa.NamingStrategy comp = GetEntity().GetPersistenceUnit().GetNamingStrategy(); string s1 = entity != null?comp.GetUniformValue(entity.GetName()) : ""; string s2 = f.GetName() != null?comp.GetUniformValue(f.GetEntity().GetName()) : ""; int i = s1.CompareTo(s2); if (i != 0) { return(i); } else { string s3 = GetName() != null?comp.GetUniformValue(GetName()) : ""; string s4 = f.GetName() != null?comp.GetUniformValue(f.GetName()) : ""; i = s3.CompareTo(s4); return(i); } }
public Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledUpdate AddQuery(Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledUpdate other) { if (other == null) { return(this); } if (other.entityName != null) { this.Entity(((Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName)other.entityName).GetName(), other.entityAlias); } for (int i = 0; i < (other.fields).Count; i++) { Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar fvar = other.GetField(i); Net.Vpc.Upa.Field field = (Net.Vpc.Upa.Field)fvar.GetReferrer(); Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression fieldValue = other.GetFieldValue(i); Set(field, fieldValue == null ? null : fieldValue.Copy()); } if (other.condition != null) { if (condition == null) { Where(other.condition.Copy()); } else { Where(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledAnd(condition, other.condition.Copy())); } } return(this); }
public virtual bool IsDefaultValue(object o) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { object fieldValue = GetValue(o); Net.Vpc.Upa.Entity entity = entityBeanAdapter.GetEntity(); Net.Vpc.Upa.Field field = null; if (entity != null) { field = entity.FindField(GetName()); if (field == null) { entity = null; } } if (entity == null || field == null) { object fieldDefaultValue = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, object>(Net.Vpc.Upa.Impl.Util.PlatformUtils.DEFAULT_VALUES_BY_TYPE, GetFieldType()); if (fieldDefaultValue == null) { return(fieldValue == null); } else { return(fieldDefaultValue.Equals(fieldValue)); } } else { return(field.IsUnspecifiedValue(fieldValue)); } }
public virtual void PrepareFieldForPersist(Net.Vpc.Upa.Field field, object @value, Net.Vpc.Upa.Record userRecord, Net.Vpc.Upa.Record persistentRecord, Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, System.Collections.Generic.ISet <Net.Vpc.Upa.Field> persistNonNullable, System.Collections.Generic.ISet <Net.Vpc.Upa.Field> persistWithDefaultValue) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Types.ManyToOneType e = (Net.Vpc.Upa.Types.ManyToOneType)field.GetDataType(); if (e.IsUpdatable()) { Net.Vpc.Upa.Entity masterEntity = executionContext.GetPersistenceUnit().GetEntity(e.GetTargetEntityName()); Net.Vpc.Upa.Key k = null; if (@value is Net.Vpc.Upa.Record) { k = masterEntity.GetBuilder().RecordToKey((Net.Vpc.Upa.Record)@value); } else { k = masterEntity.GetBuilder().ObjectToKey(@value); } int x = 0; foreach (Net.Vpc.Upa.Field fk in e.GetRelationship().GetSourceRole().GetFields()) { persistNonNullable.Remove(fk); persistWithDefaultValue.Remove(fk); persistentRecord.SetObject(fk.GetName(), k == null ? null : k.GetObjectAt(x)); x++; } } }
public Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledUpdate Set(Net.Vpc.Upa.Field key, Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression @value) { Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal varVal = new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVarVal(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(key), @value); fields.Add(varVal); PrepareChildren(varVal); return(this); }
private System.Collections.Generic.IList <Net.Vpc.Upa.Field> GetUpdateTreeFields() { Net.Vpc.Upa.Relationship treeRelation = GetTreeRelationship(); System.Collections.Generic.IList <Net.Vpc.Upa.Field> updateTreeFields = new System.Collections.Generic.List <Net.Vpc.Upa.Field>(); switch (treeRelation.GetSourceRole().GetRelationshipUpdateType()) { case Net.Vpc.Upa.RelationshipUpdateType.COMPOSED: { Net.Vpc.Upa.Field f = treeRelation.GetSourceRole().GetEntityField(); if (f != null) { updateTreeFields.Add(f); } break; } case Net.Vpc.Upa.RelationshipUpdateType.FLAT: { System.Collections.Generic.IList <Net.Vpc.Upa.Field> fields = treeRelation.GetSourceRole().GetFields(); if (fields != null) { foreach (Net.Vpc.Upa.Field f in fields) { updateTreeFields.Add(f); } } break; } } return(updateTreeFields); }
public virtual Net.Vpc.Upa.Key ObjectToKey(object @object) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { if (@object == null) { return(null); } if (@object is Net.Vpc.Upa.Record) { return(RecordToKey((Net.Vpc.Upa.Record)@object)); } Net.Vpc.Upa.Entity entity = GetEntity(); System.Collections.Generic.IList <Net.Vpc.Upa.Field> f = entity.GetPrimaryFields(); object[] rawKey = new object[(f).Count]; for (int i = 0; i < rawKey.Length; i++) { Net.Vpc.Upa.Field field = f[i]; string name = field.GetName(); if (!entity.GetBeanType().IsDefaultValue(@object, name)) { rawKey[i] = GetProperty(@object, name); } else { return(null); } } return(entity.GetBuilder().CreateKey(rawKey)); }
public virtual string GetNewValue(Net.Vpc.Upa.Field field) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Entity entity = field.GetEntity(); string idName = field.GetName(); string goodId = null; for (int i = 0; i < asynchNbrTry; i++) { System.Collections.Generic.SortedSet <string> requestedIds = new System.Collections.Generic.SortedSet <string>(); Net.Vpc.Upa.Expressions.InCollection idsSet = new Net.Vpc.Upa.Expressions.InCollection(new Net.Vpc.Upa.Expressions.Var(idName)); for (int j = 0; j < synchNbrTry; j++) { string id = (string)GenerateValue(field); idsSet.Add(new Net.Vpc.Upa.Expressions.Literal(id)); requestedIds.Add(id); } System.Collections.Generic.IList <Net.Vpc.Upa.Record> recordList = entity.CreateQuery((new Net.Vpc.Upa.Expressions.Select()).From(entity.GetName()).Field(new Net.Vpc.Upa.Expressions.Var(idName)).Where(idsSet)).GetRecordList(); System.Collections.Generic.SortedSet <string> foundIds = new System.Collections.Generic.SortedSet <string>(); foreach (Net.Vpc.Upa.Record record in recordList) { foundIds.Add(record.GetString()); } Net.Vpc.Upa.Impl.FwkConvertUtils.SetRemoveRange(requestedIds, foundIds); if ((requestedIds.Count == 0)) { continue; } goodId = Net.Vpc.Upa.Impl.FwkConvertUtils.CollectionSetFirst <string>(requestedIds); break; } return(goodId); }
public virtual Net.Vpc.Upa.Expressions.Expression GetViewElementExpressionAt(int updatableTableIndex, Net.Vpc.Upa.Expressions.Expression expression) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { System.Collections.Generic.IList <Net.Vpc.Upa.Field> pf = GetEntity().GetPrimaryFields(); System.Collections.Generic.IList <Net.Vpc.Upa.Field> pft = updatableTables[updatableTableIndex].GetPrimaryFields(); Net.Vpc.Upa.Expressions.Expression[] pfte = new Net.Vpc.Upa.Expressions.Expression[(pft).Count]; for (int i = 0; i < pfte.Length; i++) { Net.Vpc.Upa.Field f = pft[i]; pfte[i] = new Net.Vpc.Upa.Expressions.Var(f.GetName()); } Net.Vpc.Upa.Expressions.Uplet ut = new Net.Vpc.Upa.Expressions.Uplet(pfte); Net.Vpc.Upa.Expressions.Expression[] pfe = new Net.Vpc.Upa.Expressions.Expression[(pf).Count - 1]; for (int i = 0; i < pfe.Length; i++) { Net.Vpc.Upa.Field f = pf[i + 1]; pfe[i] = new Net.Vpc.Upa.Expressions.Var(f.GetName()); } Net.Vpc.Upa.Expressions.Expression w = new Net.Vpc.Upa.Expressions.Equals(new Net.Vpc.Upa.Expressions.Var(pf[0].GetName()), new Net.Vpc.Upa.Expressions.Literal(updatableTables[updatableTableIndex].GetName())); if (expression != null) { w = new Net.Vpc.Upa.Expressions.And(w, expression); } Net.Vpc.Upa.Expressions.Select q = new Net.Vpc.Upa.Expressions.Select().From(GetEntity().GetName()).Uplet(pfe).Where(w); return(new Net.Vpc.Upa.Expressions.InSelection(ut, q)); }
public override R RecordToObject <R>(Net.Vpc.Upa.Record record) { if (record is Net.Vpc.Upa.Impl.BeanAdapterRecord) { Net.Vpc.Upa.Impl.BeanAdapterRecord g = (Net.Vpc.Upa.Impl.BeanAdapterRecord)record; return((R)g.UserObject()); } object obj = CreateObject <R>(); Net.Vpc.Upa.Record ur = ObjectToRecord(obj, true); foreach (string k in record.KeySet()) { object o = record.GetObject <T>(k); if (o is Net.Vpc.Upa.Record) { Net.Vpc.Upa.Field f = entity.FindField(k); Net.Vpc.Upa.Types.DataType dt = f.GetDataType(); if (dt is Net.Vpc.Upa.Types.ManyToOneType) { Net.Vpc.Upa.Entity oe = ((Net.Vpc.Upa.Types.ManyToOneType)dt).GetRelationship().GetTargetEntity(); o = oe.GetBuilder().RecordToObject <R>((Net.Vpc.Upa.Record)o); } } ur.SetObject(k, o); } // ur.setAll(unstructuredRecord); return((R)obj); }
public virtual Net.Vpc.Upa.Impl.Util.EntityBeanAttribute GetAttrAdapter(string field) { Net.Vpc.Upa.Impl.Util.EntityBeanAttribute r = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Impl.Util.EntityBeanAttribute>(fields, field); if (r != null) { return(r); } Net.Vpc.Upa.Field f = entity.GetField(field); Net.Vpc.Upa.PropertyAccessType propertyAccessType = f.GetPropertyAccessType(); if (propertyAccessType == default(Net.Vpc.Upa.PropertyAccessType)) { propertyAccessType = Net.Vpc.Upa.PropertyAccessType.PROPERTY; } if (propertyAccessType == Net.Vpc.Upa.PropertyAccessType.FIELD) { System.Reflection.FieldInfo ff = Net.Vpc.Upa.Impl.Util.PlatformUtils.FindField(entity.GetEntityType(), f.GetName(), Net.Vpc.Upa.Impl.Util.BeanFieldFilter.INSTANCE); if (ff != null) { r = new Net.Vpc.Upa.Impl.Util.EntityBeanFieldAttribute(this, ff, entity.GetEntityType()); fields[field] = r; } } else { Net.Vpc.Upa.Impl.Util.EntityBeanGetterSetterAttribute a = new Net.Vpc.Upa.Impl.Util.EntityBeanGetterSetterAttribute(this, field, f.GetDataType().GetPlatformType(), entity.GetEntityType()); if (a.IsValid()) { r = a; fields[field] = r; } } return(r); }
public virtual Net.Vpc.Upa.Types.I18NString GetFieldString(Net.Vpc.Upa.Field field) { Net.Vpc.Upa.Entity entityName = (field != null) ? (field.GetEntity() != null) ? field.GetEntity() : field.GetEntity() : null; string fieldName = (field != null) ? field.GetName() : null; return(GetFieldListString(entityName).Append(Key(fieldName))); }
public override bool Accept(Net.Vpc.Upa.Field f) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { if (checkPersist) { if (!accepted.Contains(f.GetPersistAccessLevel())) { return(false); } } if (checkUpdate) { if (!accepted.Contains(f.GetUpdateAccessLevel())) { return(false); } } if (checkSelect) { if (!accepted.Contains(f.GetReadAccessLevel())) { return(false); } } return(true); }
public virtual bool ContainsField(Net.Vpc.Upa.Field item) { Net.Vpc.Upa.Entity entity = item.GetEntity(); Net.Vpc.Upa.Package module = entity.GetParent(); string s = (module == null ? "/" : module.GetPath() + "/") + entity.GetName() + "/" + item.GetName(); return(fields.ContainsKey(s)); }
public virtual void UnregisterField(Net.Vpc.Upa.Field item) { Net.Vpc.Upa.Entity entity = item.GetEntity(); Net.Vpc.Upa.Package module = entity.GetParent(); string s = (module == null ? "/" : module.GetPath() + "/") + entity.GetName() + "/" + item.GetName(); fields.Remove(s); }
public virtual void RegisterField(Net.Vpc.Upa.Field item) { Net.Vpc.Upa.Impl.DefaultEntity entity = (Net.Vpc.Upa.Impl.DefaultEntity)item.GetEntity(); Net.Vpc.Upa.Package module = entity.GetParent(); string s = (module == null ? "/" : module.GetPath() + "/") + entity.GetName() + "/" + item.GetName(); fields[s] = item; entity.fieldsMap[entity.GetPersistenceUnit().GetNamingStrategy().GetUniformValue(item.GetName())] = (Net.Vpc.Upa.Field)item; }
/** * * @param field * @param id * @param object * @return * @throws UPAException */ public virtual bool IsAllowedWrite(Net.Vpc.Upa.Field field, object id, object @object) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.EntitySecurityManager s = field.GetEntity().GetEntitySecurityManager(); if (s != null) { return(s.IsAllowedWrite(field, id, @object)); } return(IsAllowedKey(field.GetEntity(), "Update")); }
public static Net.Vpc.Upa.Types.DataTypeTransform GetTypeTransformOrIdentity(Net.Vpc.Upa.Field f) { Net.Vpc.Upa.Types.DataTypeTransform t = f.GetTypeTransform(); if (t == null) { return(new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(f.GetDataType())); } return(t); }
public ComposedToFlatFieldPersister(Net.Vpc.Upa.Field field) { this.field = field; Net.Vpc.Upa.Types.ManyToOneType t = (Net.Vpc.Upa.Types.ManyToOneType)field.GetDataType(); Net.Vpc.Upa.Entity master = t.GetRelationship().GetTargetRole().GetEntity(); Net.Vpc.Upa.RelationshipRole detailRole = t.GetRelationship().GetSourceRole(); flatFields = detailRole.GetFields(); relationshipTargetConverter = master.GetBuilder(); }
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 virtual bool IsAllowedRead(Net.Vpc.Upa.Field field) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.EntitySecurityManager s = field.GetEntity().GetEntitySecurityManager(); if (s != null) { return(s.IsAllowedRead(field)); } return(IsAllowedKey(field.GetEntity(), "Load")); }
private static Net.Vpc.Upa.Expressions.Expression GetFieldExpression(Net.Vpc.Upa.Field field, bool forPersist) { if (forPersist) { return((field.GetPersistFormula() is Net.Vpc.Upa.ExpressionFormula) ? ((Net.Vpc.Upa.ExpressionFormula)field.GetPersistFormula()).GetExpression() : null); } else { return((field.GetUpdateFormula() is Net.Vpc.Upa.ExpressionFormula) ? ((Net.Vpc.Upa.ExpressionFormula)field.GetUpdateFormula()).GetExpression() : null); } }
public FieldEvent(Net.Vpc.Upa.Field field, Net.Vpc.Upa.PersistenceUnit persistenceUnit, Net.Vpc.Upa.Entity entity, Net.Vpc.Upa.EntityPart parent, int index, Net.Vpc.Upa.EntityPart oldParent, int oldIndex, Net.Vpc.Upa.EventPhase phase) { this.persistenceUnit = persistenceUnit; this.field = field; this.parent = parent; this.index = index; this.oldParent = oldParent; this.oldIndex = oldIndex; this.entity = entity; this.phase = phase; }
public override bool Accept(Net.Vpc.Upa.Field field) { foreach (Net.Vpc.Upa.Filters.FieldFilter fieldFilter in v) { if (!fieldFilter.Accept(field)) { return(false); } } return(true); }
public virtual object GetMainProperty(object @object) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Field mf = GetEntity().GetMainField(); object v = GetProperty(@object, mf.GetName()); if (v != null && mf.GetDataType() is Net.Vpc.Upa.Types.ManyToOneType && !Net.Vpc.Upa.Impl.Util.UPAUtils.IsSimpleFieldType(v.GetType())) { Net.Vpc.Upa.Entity t = ((Net.Vpc.Upa.Types.ManyToOneType)mf.GetDataType()).GetRelationship().GetTargetEntity(); return(t.GetMainFieldValue(v)); } return(v); }
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; }
public override void CommitModelChanges() /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Entity entity = GetEntity(); if ((entity.GetPrimaryFields().Count == 0)) { Net.Vpc.Upa.Field field = entity.AddField("SGLcode", null, Net.Vpc.Upa.FlagSets.Of <E>(Net.Vpc.Upa.UserFieldModifier.ID), null, 0, new Net.Vpc.Upa.Types.IntType(0, 0, false, false), -1); field.SetAccessLevel(Net.Vpc.Upa.AccessLevel.PRIVATE); field.SetPersistFormula(new Net.Vpc.Upa.Sequence(Net.Vpc.Upa.SequenceStrategy.AUTO)); } if (!entity.GetUserExcludeModifiers().Contains(Net.Vpc.Upa.EntityModifier.NAVIGATE)) { entity.GetModifiers().Add(Net.Vpc.Upa.EntityModifier.NAVIGATE); } }
protected internal virtual object GetNewValue(Net.Vpc.Upa.Field field, Net.Vpc.Upa.Record record, Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Entity entity = field.GetEntity(); Net.Vpc.Upa.Entity seq = entity.GetPersistenceUnit().GetEntity(Net.Vpc.Upa.Impl.PrivateSequence.ENTITY_NAME); Net.Vpc.Upa.Impl.SequenceManager sm = new Net.Vpc.Upa.Impl.EntitySequenceManager(seq); string groupString = Eval(this.group, "{#}", record); // String fieldName = field.getName(); // while (true) { object nextValue = GetNewValue(sm, groupString, record); // long count = entity.getEntityCount(new Equals(new Var(fieldName), nextValue)); // if (count == 0) { return(nextValue); }
public virtual Net.Vpc.Upa.Expressions.Expression CreateFindImmediateChildrenExpression(string alias, object id) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { System.Collections.Generic.IList <Net.Vpc.Upa.Field> parentFields = GetTreeRelationship().GetSourceRole().GetFields(); Net.Vpc.Upa.Expressions.Expression a = null; Net.Vpc.Upa.Key key = GetEntity().GetBuilder().IdToKey(id); for (int i = 0; i < (parentFields).Count; i++) { Net.Vpc.Upa.Field field = parentFields[i]; Net.Vpc.Upa.Expressions.Var v = new Net.Vpc.Upa.Expressions.Var(alias == null ? null : new Net.Vpc.Upa.Expressions.Var(alias), field.GetName()); Net.Vpc.Upa.Expressions.Expression e = (new Net.Vpc.Upa.Expressions.Equals(v, new Net.Vpc.Upa.Expressions.Literal(key.GetObjectAt(i), field.GetDataType()))); a = a == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(a, e); } return(a); }
public virtual long GetNewValue(Net.Vpc.Upa.Field field) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Entity entity = field.GetEntity(); Net.Vpc.Upa.Expressions.Select s = new Net.Vpc.Upa.Expressions.Select().From(entity.GetName()); s.Field(new Net.Vpc.Upa.Expressions.Plus(new Net.Vpc.Upa.Expressions.Coalesce(new Net.Vpc.Upa.Expressions.Max(new Net.Vpc.Upa.Expressions.Var(field.GetName())), new Net.Vpc.Upa.Expressions.Literal(0)), new Net.Vpc.Upa.Expressions.Literal(1)), "next"); Net.Vpc.Upa.Record next = field.GetPersistenceUnit().CreateQuery(s).GetRecord(); if (next != null) { return(next.GetLong("next")); } else { return(0); } }