Esempio n. 1
0
 /**
  * Check for the faisabilty of the rename operation. When oldId is null, the
  * verification is done for ALL keys (rname should be supported+enabled for
  * the curent user) When newId is null, the verification is done only on
  * oldId
  *
  * @param oldId old id
  * @param newId new id
  * @throws net.vpc.upa.exceptions.UPAException :
  * RenameRecordNotAllowedException, UnrenamableRecordException,
  * RenameRecordOldKeyNotFoundException, RenameRecordNewKeyInUseException
  */
 public virtual void CheckRename(object oldId, object newId) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (!entity.GetPersistenceUnit().GetSecurityManager().IsAllowedRename(entity))
     {
         throw new Net.Vpc.Upa.Exceptions.RenameRecordNotAllowedException(entity);
     }
     if (!IsRenameSupported())
     {
         throw new Net.Vpc.Upa.Exceptions.UnrenamableRecordException(entity);
     }
     if (oldId != null)
     {
         Net.Vpc.Upa.Expressions.Expression e = GetFullNonRenamableRecordsExpression();
         if (e != null && e.IsValid())
         {
             Net.Vpc.Upa.Expressions.And a = new Net.Vpc.Upa.Expressions.And(entity.GetBuilder().IdToExpression(oldId, null), e);
             if (entity.GetEntityCount(a) > 0)
             {
                 throw new Net.Vpc.Upa.Exceptions.UnrenamableRecordException(entity);
             }
         }
         object o = entity.CreateQueryBuilder().ById(oldId).SetFieldFilter(Net.Vpc.Upa.Impl.Util.Filters.Fields2.PERSISTENT_NON_FORMULA).GetEntity <R>();
         if (o == null)
         {
             throw new Net.Vpc.Upa.Exceptions.RenameRecordOldKeyNotFoundException(entity);
         }
     }
     if (newId != null)
     {
         if (entity.Contains(newId))
         {
             throw new Net.Vpc.Upa.Exceptions.RenameRecordNewKeyInUseException(entity);
         }
     }
     CheckVeto(Net.Vpc.Upa.VetoableOperation.checkRename, oldId, newId);
 }
Esempio n. 2
0
 public virtual bool IsDeletableRecord(object k, bool recurse)
 {
     try {
         if (!entity.GetPersistenceUnit().GetSecurityManager().IsAllowedRemove(entity))
         {
             return(false);
         }
         Net.Vpc.Upa.Expressions.Expression e = GetFullNonDeletableRecordsExpression();
         if (e != null && e.IsValid())
         {
             Net.Vpc.Upa.Expressions.Expression a = new Net.Vpc.Upa.Expressions.And(entity.GetBuilder().IdToExpression(k, null), e);
             if (entity.GetEntityCount(a) > 0)
             {
                 return(false);
             }
         }
         CheckVeto(Net.Vpc.Upa.VetoableOperation.deletableRecord, k, recurse);
         return(true);
     } catch (Net.Vpc.Upa.Exceptions.UPAException e) {
     }
     // e.printStackTrace(); //To change body of catch statement use
     // Options | File Templates.
     return(false);
 }
Esempio n. 3
0
        public override void SetArgument(int index, Net.Vpc.Upa.Expressions.Expression e)
        {
            switch (index)
            {
            case 0:
            {
                this.ancestorExpression = e;
                break;
            }

            case 1:
            {
                this.childExpression = e;
                break;
            }

            case 2:
            {
                this.entityName = (Net.Vpc.Upa.Expressions.EntityName)e;
                break;
            }
            }
            throw new System.IndexOutOfRangeException();
        }
Esempio n. 4
0
 public Between(Net.Vpc.Upa.Expressions.Expression expression, object min, object max)  : this(expression, Net.Vpc.Upa.Expressions.ExpressionFactory.ToLiteral(min), Net.Vpc.Upa.Expressions.ExpressionFactory.ToLiteral(max))
 {
 }
Esempio n. 5
0
 public LessThan(Net.Vpc.Upa.Expressions.Expression left, Net.Vpc.Upa.Expressions.Expression right)  : base(Net.Vpc.Upa.Expressions.BinaryOperator.LT, left, right)
 {
 }
Esempio n. 6
0
 public If(Net.Vpc.Upa.Expressions.Expression condition)
 {
     @params = new System.Collections.Generic.List <Net.Vpc.Upa.Expressions.Expression>(2);
     Add(condition);
     state = EXPECT_VALUE;
 }
Esempio n. 7
0
 public ExpressionTransformerResult(Net.Vpc.Upa.Expressions.Expression expression, bool replaced, bool updated)
 {
     this.expression = expression;
     this.replaced   = replaced;
     this.updated    = updated;
 }
 public override Net.Vpc.Upa.Expressions.Expression TranslateExpression(Net.Vpc.Upa.Expressions.Expression e) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     return(relation.GetTargetCondition(e, relation.GetSourceRole().GetEntity().GetName(), relation.GetTargetRole().GetEntity().GetName()));
 }
Esempio n. 9
0
 public virtual bool Accept(Net.Vpc.Upa.Expressions.Expression e)
 {
     return((e is Net.Vpc.Upa.Expressions.Param) && name.Equals(((Net.Vpc.Upa.Expressions.Param)e).GetName()));
 }
Esempio n. 10
0
 public StrLen(Net.Vpc.Upa.Expressions.Expression[] expressions)
 {
     CheckArgCount(GetName(), expressions, 1);
     this.expression = expressions[0];
 }
 public virtual Net.Vpc.Upa.Persistence.ResultMetaData CreateResultMetaData(Net.Vpc.Upa.Expressions.Expression baseExpression, Net.Vpc.Upa.Filters.FieldFilter fieldFilter, System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.QueryStatement> context)
 {
     baseExpression = Net.Vpc.Upa.Impl.Uql.Util.UQLUtils.ParseUserExpressions(baseExpression, pu);
     Net.Vpc.Upa.Impl.Persistence.DefaultResultMetaData m = new Net.Vpc.Upa.Impl.Persistence.DefaultResultMetaData();
     if (baseExpression is Net.Vpc.Upa.Expressions.NonQueryStatement)
     {
         m.SetStatement((Net.Vpc.Upa.Expressions.EntityStatement)baseExpression);
         m.AddField(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(null, "result", Net.Vpc.Upa.Types.TypesFactory.INT, null, null));
         return(m);
     }
     else
     {
         Net.Vpc.Upa.Expressions.QueryStatement q = (Net.Vpc.Upa.Expressions.QueryStatement)baseExpression;
         if (q is Net.Vpc.Upa.Expressions.Select)
         {
             Net.Vpc.Upa.Expressions.Select qs = (Net.Vpc.Upa.Expressions.Select)q;
             if ((qs.GetFields()).Count == 0)
             {
                 if (!Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(qs.GetEntityAlias()))
                 {
                     qs.Field(new Net.Vpc.Upa.Expressions.Var(qs.GetEntityAlias()));
                 }
                 else if (qs.GetEntityName() != null)
                 {
                     qs.Field(new Net.Vpc.Upa.Expressions.Var(qs.GetEntityName()));
                 }
                 else
                 {
                     throw new Net.Vpc.Upa.Exceptions.UPAException("MissingAlias");
                 }
                 foreach (Net.Vpc.Upa.Expressions.JoinCriteria joinCriteria in qs.GetJoins())
                 {
                     if (!Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(joinCriteria.GetEntityAlias()))
                     {
                         qs.Field(new Net.Vpc.Upa.Expressions.Var(joinCriteria.GetEntityAlias()));
                     }
                     else if (joinCriteria.GetEntityName() != null)
                     {
                         qs.Field(new Net.Vpc.Upa.Expressions.Var(joinCriteria.GetEntityName()));
                     }
                     else
                     {
                         throw new Net.Vpc.Upa.Exceptions.UPAException("MissingAlias");
                     }
                 }
             }
             System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.QueryField>     oldFields  = new System.Collections.Generic.List <Net.Vpc.Upa.Expressions.QueryField>(q.GetFields());
             System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.QueryField>     newFields  = new System.Collections.Generic.List <Net.Vpc.Upa.Expressions.QueryField>();
             System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField>    newResults = new System.Collections.Generic.List <Net.Vpc.Upa.Persistence.ResultField>();
             System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.QueryStatement> context2   = new System.Collections.Generic.List <Net.Vpc.Upa.Expressions.QueryStatement>();
             Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(context2, context);
             context2.Add(q);
             foreach (Net.Vpc.Upa.Expressions.QueryField f in oldFields)
             {
                 Net.Vpc.Upa.Expressions.Expression expression = f.GetExpression();
                 string oldAlias = f.GetAlias();
                 System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> newVal = CreateResultFields(expression, oldAlias, fieldFilter, context2);
                 Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(newResults, newVal);
                 if ((newVal).Count == 0)
                 {
                 }
                 else if ((newVal).Count == 1)
                 {
                     f.SetExpression(newVal[0].GetExpression());
                     f.SetAlias(Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(oldAlias) ? oldAlias : newVal[0].GetAlias());
                     newFields.Add(f);
                 }
                 else
                 {
                     foreach (Net.Vpc.Upa.Persistence.ResultField nf in newVal)
                     {
                         Net.Vpc.Upa.Expressions.QueryField f2 = new Net.Vpc.Upa.Expressions.QueryField(Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(oldAlias) ? oldAlias : nf.GetAlias(), nf.GetExpression());
                         newFields.Add(f2);
                     }
                 }
             }
             qs.ClearFields();
             foreach (Net.Vpc.Upa.Expressions.QueryField newField in newFields)
             {
                 qs.Field(newField);
             }
             m.SetStatement(qs);
             foreach (Net.Vpc.Upa.Persistence.ResultField newResult in newResults)
             {
                 m.AddField(newResult);
             }
         }
         else if (q is Net.Vpc.Upa.Expressions.Union)
         {
             System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.QueryStatement> context2 = new System.Collections.Generic.List <Net.Vpc.Upa.Expressions.QueryStatement>();
             Net.Vpc.Upa.Impl.FwkConvertUtils.ListAddRange(context2, context);
             context2.Add(q);
             Net.Vpc.Upa.Expressions.Union         u0     = (Net.Vpc.Upa.Expressions.Union)q;
             Net.Vpc.Upa.Expressions.Union         u      = new Net.Vpc.Upa.Expressions.Union();
             Net.Vpc.Upa.Persistence.ResultField[] fields = null;
             foreach (Net.Vpc.Upa.Expressions.QueryStatement qs in u0.GetQueryStatements())
             {
                 Net.Vpc.Upa.Persistence.ResultMetaData resultMetaData = CreateResultMetaData(qs, fieldFilter, context2);
                 u.Add((Net.Vpc.Upa.Expressions.QueryStatement)resultMetaData.GetStatement());
                 System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> f = resultMetaData.GetFields();
                 if (fields == null)
                 {
                     fields = f.ToArray();
                 }
                 else
                 {
                     if (fields.Length != (f).Count)
                     {
                         throw new Net.Vpc.Upa.Exceptions.UPAException("InvalidUnion");
                     }
                     for (int i = 0; i < fields.Length; i++)
                     {
                         fields[i] = Merge(fields[i], f[i]);
                     }
                 }
             }
             m.SetStatement(u);
             if (fields != null)
             {
                 foreach (Net.Vpc.Upa.Persistence.ResultField field in fields)
                 {
                     m.AddField(field);
                 }
             }
         }
         else
         {
             throw new System.Exception();
         }
     }
     return(m);
 }
 public virtual Net.Vpc.Upa.Persistence.ResultMetaData CreateResultMetaData(Net.Vpc.Upa.Expressions.Expression baseExpression, Net.Vpc.Upa.Filters.FieldFilter fieldFilter)
 {
     return(CreateResultMetaData(baseExpression, fieldFilter, new System.Collections.Generic.List <Net.Vpc.Upa.Expressions.QueryStatement>()));
 }
 protected internal virtual System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> CreateResultFields(Net.Vpc.Upa.Expressions.Expression expression, string alias, Net.Vpc.Upa.Filters.FieldFilter fieldFilter, System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.QueryStatement> context)
 {
     expression = expressionManager.ParseExpression(expression);
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> results = new System.Collections.Generic.List <Net.Vpc.Upa.Persistence.ResultField>();
     if (expression is Net.Vpc.Upa.Expressions.Var)
     {
         Net.Vpc.Upa.Expressions.Var        v      = (Net.Vpc.Upa.Expressions.Var)expression;
         Net.Vpc.Upa.Expressions.Expression parent = v.GetApplier();
         if (parent != null)
         {
             System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ResultField> parentResults = CreateResultFields(parent, null, fieldFilter, context);
             int size = (parentResults).Count;
             foreach (Net.Vpc.Upa.Persistence.ResultField p in parentResults)
             {
                 if (size > 1)
                 {
                     v = (Net.Vpc.Upa.Expressions.Var)v.Copy();
                 }
                 if (p.GetExpression() != parent)
                 {
                     //change parent
                     v.SetApplier((Net.Vpc.Upa.Expressions.Var)p.GetExpression());
                 }
                 if (p.GetEntity() != null)
                 {
                     if (v.GetName().Equals("*"))
                     {
                         foreach (Net.Vpc.Upa.Field field in p.GetEntity().GetFields(fieldFilter))
                         {
                             results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, field.GetDataType(), field, null));
                         }
                     }
                     else
                     {
                         Net.Vpc.Upa.Field field = p.GetEntity().GetField(v.GetName());
                         results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, field.GetDataType(), field, null));
                     }
                 }
                 else if (p.GetField() != null)
                 {
                     if (p.GetField().GetDataType() is Net.Vpc.Upa.Types.ManyToOneType)
                     {
                         Net.Vpc.Upa.Entity entity = ((Net.Vpc.Upa.Types.ManyToOneType)p.GetField().GetDataType()).GetTargetEntity();
                         if (v.GetName().Equals("*"))
                         {
                             foreach (Net.Vpc.Upa.Field field in entity.GetFields(fieldFilter))
                             {
                                 results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, field.GetDataType(), field, null));
                             }
                         }
                         else
                         {
                             Net.Vpc.Upa.Field field = entity.GetField(v.GetName());
                             results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, field.GetDataType(), field, null));
                         }
                     }
                     else
                     {
                         results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, Net.Vpc.Upa.Types.TypesFactory.OBJECT, null, null));
                     }
                 }
                 else
                 {
                     results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, Net.Vpc.Upa.Types.TypesFactory.OBJECT, null, null));
                 }
             }
         }
         else
         {
             string name = v.GetName();
             System.Collections.Generic.IDictionary <string, Net.Vpc.Upa.Expressions.NameOrQuery> declarations = FindDeclarations(context);
             Net.Vpc.Upa.Expressions.NameOrQuery r = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <string, Net.Vpc.Upa.Expressions.NameOrQuery>(declarations, name);
             if (r != null)
             {
                 if (r is Net.Vpc.Upa.Expressions.EntityName)
                 {
                     Net.Vpc.Upa.Entity entity = pu.GetEntity(((Net.Vpc.Upa.Expressions.EntityName)r).GetName());
                     results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, entity.GetDataType(), null, entity));
                 }
                 else
                 {
                     results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, Net.Vpc.Upa.Types.TypesFactory.OBJECT, null, null));
                 }
             }
             else
             {
                 if ("*".Equals(name))
                 {
                     foreach (System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Expressions.NameOrQuery> entry in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Expressions.NameOrQuery> >(declarations))
                     {
                         r = (entry).Value;
                         if (r is Net.Vpc.Upa.Expressions.EntityName)
                         {
                             Net.Vpc.Upa.Entity entity = pu.GetEntity(((Net.Vpc.Upa.Expressions.EntityName)r).GetName());
                             Net.Vpc.Upa.Field  field  = entity.FindField(name);
                             results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, field.GetDataType(), field, null));
                             break;
                         }
                     }
                 }
                 else
                 {
                     Net.Vpc.Upa.Field field = null;
                     foreach (System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Expressions.NameOrQuery> entry in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, Net.Vpc.Upa.Expressions.NameOrQuery> >(declarations))
                     {
                         r = (entry).Value;
                         if (r is Net.Vpc.Upa.Expressions.EntityName)
                         {
                             Net.Vpc.Upa.Entity entity = pu.GetEntity(((Net.Vpc.Upa.Expressions.EntityName)r).GetName());
                             field = entity.FindField(name);
                             break;
                         }
                     }
                     if (field != null)
                     {
                         results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, field.GetDataType(), field, null));
                     }
                     else
                     {
                         results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(v, alias, Net.Vpc.Upa.Types.TypesFactory.OBJECT, null, null));
                     }
                 }
             }
         }
         return(results);
     }
     results.Add(new Net.Vpc.Upa.Impl.Persistence.DefaultResultField(expression, alias, Net.Vpc.Upa.Types.TypesFactory.OBJECT, null, null));
     return(results);
 }
 public virtual Net.Vpc.Upa.DefaultRelationshipDescriptor SetFilter(Net.Vpc.Upa.Expressions.Expression filter)
 {
     this.filter = filter;
     return(this);
 }
Esempio n. 15
0
 public virtual void SetGroupAt(int index, Net.Vpc.Upa.Expressions.Expression expression)
 {
     fields[index] = expression;
 }
Esempio n. 16
0
 public MonthStart(Net.Vpc.Upa.Expressions.Expression count)
 {
     expressions.Add(count);
 }
Esempio n. 17
0
 public override void SetArgument(int index, Net.Vpc.Upa.Expressions.Expression e)
 {
     expressions[index] = e;
 }
Esempio n. 18
0
 public StrLen(Net.Vpc.Upa.Expressions.Expression expression)
 {
     this.expression = expression;
 }
Esempio n. 19
0
 public virtual void SetApplier(Net.Vpc.Upa.Expressions.Var applier)
 {
     this.applier = applier;
 }
Esempio n. 20
0
 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));
 }
Esempio n. 21
0
 public virtual Net.Vpc.Upa.Expressions.Expression EvalObject(Net.Vpc.Upa.Expressions.Expression e, Net.Vpc.Upa.QLEvaluator evaluator, object context)
 {
     return(Net.Vpc.Upa.Expressions.Literal.NULL);
 }
Esempio n. 22
0
 public Negative(Net.Vpc.Upa.Expressions.Expression expression)  : base(Net.Vpc.Upa.Expressions.UnaryOperator.NEGATIVE, "-", expression)
 {
 }
Esempio n. 23
0
 private void Add(Net.Vpc.Upa.Expressions.Expression expression)
 {
     @params.Add(expression);
 }
 public static System.Collections.Generic.IList <object> ResolveIdListUtility(Net.Vpc.Upa.Callbacks.EntityEvent @event, Net.Vpc.Upa.Expressions.Expression whereExpression) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext = @event.GetContext();
     if (whereExpression is Net.Vpc.Upa.Expressions.IdExpression)
     {
         object id = ((Net.Vpc.Upa.Expressions.IdExpression)whereExpression).GetId();
         return(id == null ? new System.Collections.Generic.List <object>() : new System.Collections.Generic.List <object>(new[] { id }));
     }
     else
     {
         if (!executionContext.IsSet("ALL_IDS"))
         {
             if (@event.GetPhase() == Net.Vpc.Upa.EventPhase.AFTER)
             {
                 throw new Net.Vpc.Upa.Exceptions.UPAException("SingleEntityEventCalledInPostProcessButNeverInPreProcess");
             }
             System.Collections.Generic.IList <object> idList = @event.GetEntity().CreateQueryBuilder().ByExpression(whereExpression).GetIdList <K>();
             executionContext.SetObject("ALL_IDS", idList);
         }
         return((System.Collections.Generic.IList <object>)executionContext.GetObject <T>("ALL_IDS"));
     }
 }
Esempio n. 25
0
 public override void SetArgument(int index, Net.Vpc.Upa.Expressions.Expression e)
 {
     @params[index] = e;
     state          = VALID;
 }
 protected internal virtual System.Collections.Generic.IList <object> ResolveIdList(Net.Vpc.Upa.Callbacks.EntityEvent @event, Net.Vpc.Upa.Expressions.Expression whereExpression) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     return(ResolveIdListUtility(@event, whereExpression));
 }
Esempio n. 27
0
        private Net.Vpc.Upa.Query Build()
        {
            //        if (query == null) {
            string entityName = entity.GetName();

            Net.Vpc.Upa.Expressions.Select s = (new Net.Vpc.Upa.Expressions.Select()).From(entityName, entityAlias);
            if (GetFieldFilter() != null)
            {
                foreach (Net.Vpc.Upa.Field field in entity.GetFields(GetFieldFilter()))
                {
                    if (field != null)
                    {
                        s.Field(new Net.Vpc.Upa.Expressions.Var(field.GetName()), field.GetName());
                    }
                }
            }
            Net.Vpc.Upa.Expressions.Expression criteria = null;
            if (GetId() != null)
            {
                Net.Vpc.Upa.Expressions.Expression e = entity.GetBuilder().IdToExpression(GetId(), entityName);
                criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e);
            }
            if (GetKey() != null)
            {
                Net.Vpc.Upa.Expressions.Expression e = (entity.GetBuilder().IdToExpression(entity.GetBuilder().KeyToId(GetKey()), entityName));
                criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e);
            }
            if (GetPrototype() != null)
            {
                Net.Vpc.Upa.Expressions.Expression e = entity.GetBuilder().ObjectToExpression(GetPrototype(), true, entityName);
                criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e);
            }
            if (GetRecordPrototype() != null)
            {
                Net.Vpc.Upa.Expressions.Expression e = (entity.GetBuilder().RecordToExpression(GetRecordPrototype(), entityName));
                criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e);
            }
            if (GetExpression() != null)
            {
                Net.Vpc.Upa.Expressions.Expression e = GetExpression();
                criteria = criteria == null ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(criteria, e);
            }
            s.SetWhere(criteria);
            s.OrderBy(GetOrder());
            query = entity.CreateQuery(s);
            foreach (System.Collections.Generic.KeyValuePair <string, object> e in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, object> >(paramsByName))
            {
                query.SetParameter((e).Key, (e).Value);
            }
            foreach (System.Collections.Generic.KeyValuePair <int?, object> e in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <int?, object> >(paramsByIndex))
            {
                query.SetParameter(((e).Key).Value, (e).Value);
            }
            query.SetUpdatable(this.IsUpdatable());
            if (hints != null)
            {
                foreach (System.Collections.Generic.KeyValuePair <string, object> h in new System.Collections.Generic.HashSet <System.Collections.Generic.KeyValuePair <string, object> >(hints))
                {
                    query.SetHint((h).Key, (h).Value);
                }
            }
            //        }
            return(query);
        }
Esempio n. 28
0
 public Not(Net.Vpc.Upa.Expressions.Expression expression)  : base(Net.Vpc.Upa.Expressions.UnaryOperator.NOT, "!", expression)
 {
 }
Esempio n. 29
0
 public Between(Net.Vpc.Upa.Expressions.Expression expression, Net.Vpc.Upa.Expressions.Expression min, Net.Vpc.Upa.Expressions.Expression max)
 {
     left     = expression;
     this.min = min;
     this.max = max;
 }
 public virtual int Delete(Net.Vpc.Upa.Entity entity, Net.Vpc.Upa.Persistence.EntityExecutionContext context, Net.Vpc.Upa.Expressions.Expression condition, bool recurse, Net.Vpc.Upa.RemoveTrace deleteInfo) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (entity.GetShield().IsTransient())
     {
         return(0);
     }
     Net.Vpc.Upa.Expressions.Delete stmt = (new Net.Vpc.Upa.Expressions.Delete()).From(entity.GetName()).Where(condition);
     return(context.GetPersistenceStore().CreateQuery(stmt, context).ExecuteNonQuery());
 }