public override void Persist(Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext, Net.Vpc.Upa.PersistenceState status) /* throws System.Exception, Net.Vpc.Upa.Exceptions.UPAException */
 {
     Net.Vpc.Upa.Entity entityManager = (Net.Vpc.Upa.Entity)@object;
     Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore persistenceUnitManager = (Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore)executionContext.GetPersistenceStore();
     log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("Commit {0} / {1} : found {2}, persist", null, new object[] { @object, typedObject, status }));
     Net.Vpc.Upa.Persistence.UConnection b = executionContext.GetConnection();
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.ViewEntityExtension> specSupport = entityManager.GetExtensions <Net.Vpc.Upa.Persistence.ViewEntityExtension>(typeof(Net.Vpc.Upa.Persistence.ViewEntityExtension));
     foreach (Net.Vpc.Upa.Persistence.ViewEntityExtension ss in specSupport)
     {
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateViewStatement(entityManager, ss.GetQuery(), executionContext), null, null);
     }
     System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.UnionEntityExtension> uspecSupport = entityManager.GetExtensions <Net.Vpc.Upa.Persistence.UnionEntityExtension>(typeof(Net.Vpc.Upa.Persistence.UnionEntityExtension));
     foreach (Net.Vpc.Upa.Persistence.UnionEntityExtension ss in uspecSupport)
     {
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateViewStatement(entityManager, ss.GetQuery(), executionContext), null, null);
     }
     System.Collections.Generic.IList <Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition> fspecSupport = entityManager.GetExtensionDefinitions <Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition>(typeof(Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition));
     foreach (Net.Vpc.Upa.Extensions.FilterEntityExtensionDefinition ss in fspecSupport)
     {
         b.ExecuteNonQuery(persistenceUnitManager.GetCreateViewStatement(entityManager, ss.GetQuery(), executionContext), null, null);
     }
 }
Example #2
0
 public override System.Collections.Generic.IList <Net.Vpc.Upa.Key> GetKeyList() /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (!context.GetPersistenceUnit().GetPersistenceGroup().CurrentSessionExists())
     {
         if (sessionAwareInstance == null)
         {
             sessionAwareInstance = context.GetPersistenceUnit().GetPersistenceGroup().GetContext().MakeSessionAware <Net.Vpc.Upa.Impl.Persistence.DefaultQuery>(this);
         }
         return(sessionAwareInstance.GetKeyList());
     }
     if ((query is Net.Vpc.Upa.Expressions.QueryStatement))
     {
         Net.Vpc.Upa.Entity entity = ResolveDefaultEntity();
         if (entity != null)
         {
             Net.Vpc.Upa.Impl.Util.ConvertedList <object, Net.Vpc.Upa.Key> r = new Net.Vpc.Upa.Impl.Util.ConvertedList <object, Net.Vpc.Upa.Key>(GetIdList <K2>(), new Net.Vpc.Upa.Impl.IdToKeyConverter <object>(entity));
             allResults.Add(r);
             return(r);
         }
     }
     throw new Net.Vpc.Upa.Exceptions.FindException(new Net.Vpc.Upa.Types.I18NString("InvalidQuery"));
 }
Example #3
0
 private bool Build()
 {
     if (this.fieldNames == null)
     {
         idEntity = entity.GetPersistenceUnit().FindEntity(idType);
         if (idEntity != null)
         {
             isEntityKey = true;
             System.Collections.Generic.IList <string> fn = new System.Collections.Generic.List <string>();
             //                for (Field primaryField : entity.getPrimaryFields()) {
             //                    fn.add(primaryField.getName());
             //                }
             this.fieldNames = fn.ToArray();
         }
         else
         {
             bnfo = Net.Vpc.Upa.Impl.Util.PlatformBeanTypeRepository.GetInstance().GetBeanType(idType);
             System.Collections.Generic.ISet <string> fn = bnfo.GetPropertyNames();
             this.fieldNames = fn.ToArray();
         }
     }
     return(isEntityKey);
 }
Example #4
0
        public override void OnPersist(Net.Vpc.Upa.Callbacks.PersistEvent @event) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            object parent_id     = relation.ExtractId(@event.GetPersistedRecord());
            string path          = support.GetHierarchyPathSeparator() + support.ToStringId(@event.GetPersistedId());
            string pathFieldName = support.GetHierarchyPathField();

            Net.Vpc.Upa.Entity entity = relation.GetSourceRole().GetEntity();
            if (parent_id != null)
            {
                Net.Vpc.Upa.Record r = entity.CreateQueryBuilder().ByExpression(entity.GetBuilder().IdToExpression(parent_id, null)).SetFieldFilter(Net.Vpc.Upa.Filters.Fields.ByName(pathFieldName)).GetRecord();
                if (r != null)
                {
                    path = r.GetString(pathFieldName) + path;
                }
            }
            @event.GetPersistedRecord().SetString(pathFieldName, path);
            Net.Vpc.Upa.Persistence.EntityExecutionContext executionContext = @event.GetContext();
            Net.Vpc.Upa.Persistence.EntityExecutionContext updateContext    = executionContext.GetPersistenceUnit().GetFactory().CreateObject <Net.Vpc.Upa.Persistence.EntityExecutionContext>(typeof(Net.Vpc.Upa.Persistence.EntityExecutionContext));
            updateContext.InitPersistenceUnit(executionContext.GetPersistenceUnit(), executionContext.GetPersistenceStore(), Net.Vpc.Upa.Persistence.ContextOperation.UPDATE);
            Net.Vpc.Upa.Record u2 = entity.GetBuilder().CreateRecord();
            u2.SetString(pathFieldName, path);
            entity.UpdateCore(u2, entity.GetBuilder().IdToExpression(@event.GetPersistedId(), entity.GetName()), updateContext);
        }
Example #5
0
        public virtual Net.Vpc.Upa.Expressions.Expression CreateFindEntityByMainPathExpression(string mainFieldPath, string entityAlias)
        {
            Net.Vpc.Upa.Entity           entity     = GetEntity();
            Net.Vpc.Upa.RelationshipRole detailRole = GetTreeRelationship().GetSourceRole();
            if (Net.Vpc.Upa.Impl.Util.StringUtils.IsNullOrEmpty(mainFieldPath))
            {
                return(null);
            }
            string mainFieldName  = entity.GetMainField().GetName();
            object mainFieldValue = null;
            object parent         = null;

            string[] parentAndName = Net.Vpc.Upa.Impl.Util.StringUtils.Split(mainFieldPath, GetHierarchyPathSeparator()[0], false);
            if (parentAndName != null)
            {
                parent         = FindEntityByMainPath(parentAndName[0]);
                mainFieldValue = parentAndName[1];
            }
            else
            {
                mainFieldValue = mainFieldPath;
            }
            Net.Vpc.Upa.Expressions.Expression expr = null;
            if (entityAlias == null)
            {
                entityAlias = entity.GetName();
            }
            expr = new Net.Vpc.Upa.Expressions.Equals(new Net.Vpc.Upa.Expressions.Var(new Net.Vpc.Upa.Expressions.Var(entityAlias), mainFieldName), mainFieldValue);
            Net.Vpc.Upa.Key entityToKey = parent == null ? null : entity.GetBuilder().ObjectToKey(parent);
            System.Collections.Generic.IList <Net.Vpc.Upa.Field> primaryFields = detailRole.GetFields();
            for (int index = 0; index < (primaryFields).Count; index++)
            {
                Net.Vpc.Upa.Field field = primaryFields[index];
                expr = new Net.Vpc.Upa.Expressions.And(expr, new Net.Vpc.Upa.Expressions.Equals(new Net.Vpc.Upa.Expressions.Var(new Net.Vpc.Upa.Expressions.Var(entityAlias), field.GetName()), entityToKey == null ? null : entityToKey.GetObjectAt(index)));
            }
            return(expr);
        }
Example #6
0
        public override string GetSQL(object oo, Net.Vpc.Upa.Persistence.EntityExecutionContext qlContext, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar o = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)oo;
            Net.Vpc.Upa.Persistence.PersistenceStore            persistenceStore = qlContext.GetPersistenceStore();
            object referrer = o.GetReferrer();

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (referrer is Net.Vpc.Upa.Field)
            {
                Net.Vpc.Upa.Field field = (Net.Vpc.Upa.Field)referrer;
                string            name  = persistenceStore.GetPersistenceName(field);
                sb.Append(persistenceStore.GetValidIdentifier(name));
            }
            else if (referrer is Net.Vpc.Upa.Entity)
            {
                Net.Vpc.Upa.Entity entity = (Net.Vpc.Upa.Entity)referrer;
                //            if ("this".equals(o.getName())) {
                //                throw new IllegalArgumentException("Unexpected this alias");
                //                //this must be resolved to the ancestor alias
                //                ExpressionDeclarationList declarationList = o.getDeclarationList();
                //                name = persistenceManager.getPersistenceName(declarationList.getValue(null).getName(), PersistenceNameStrategyNames.ALIAS);
                //            } else {
                string name = persistenceStore.GetPersistenceName(o.GetName(), Net.Vpc.Upa.Persistence.PersistenceNameType.ALIAS);
                sb.Append(persistenceStore.GetValidIdentifier(name));
            }
            else
            {
                string name = persistenceStore.GetPersistenceName(o.GetName(), Net.Vpc.Upa.Persistence.PersistenceNameType.ALIAS);
                sb.Append(persistenceStore.GetValidIdentifier(name));
            }
            if (o.GetChild() != null)
            {
                string cc = GetSQL(o.GetChild(), qlContext, sqlManager, declarations);
                sb.Append(".").Append(cc);
            }
            return(sb.ToString());
        }
Example #7
0
 public virtual Net.Vpc.Upa.Key RecordToKey(Net.Vpc.Upa.Record record) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (record == null)
     {
         return(null);
     }
     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 (record.IsSet(name))
         {
             rawKey[i] = record.GetObject <T>(name);
         }
         else
         {
             return(entity.GetBuilder().CreateKey((object[])null));
         }
     }
     return(entity.GetBuilder().CreateKey(rawKey));
 }
Example #8
0
 public virtual System.Collections.Generic.IList <Net.Vpc.Upa.Entity> FindEntities(System.Type entityType) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     System.Collections.Generic.IList <Net.Vpc.Upa.Entity> all = new System.Collections.Generic.List <Net.Vpc.Upa.Entity>();
     if (entityType == null)
     {
         return(all);
     }
     Net.Vpc.Upa.Entity entityManager = Net.Vpc.Upa.Impl.FwkConvertUtils.GetMapValue <System.Type, Net.Vpc.Upa.Entity>(entityManagerByEntityType, entityType);
     if (entityManager != null)
     {
         all.Add(entityManager);
     }
     if (entityManagerByEntityTypeAmbiguity.Contains(entityType))
     {
         foreach (Net.Vpc.Upa.Entity entity in GetEntities())
         {
             if (entity.GetEntityType().Equals(entityType) && (entityManager == null || !entity.GetName().Equals(entityManager.GetName())))
             {
                 all.Add(entity);
             }
         }
     }
     return(all);
 }
Example #9
0
 public CustomUpdateQueryExecutor(Net.Vpc.Upa.Impl.Persistence.DefaultPersistenceStore defaultPersistenceStore, System.Collections.Generic.IDictionary <string, object> finalHints, Net.Vpc.Upa.Expressions.Update baseExpression, System.Collections.Generic.IDictionary <string, object> parametersByName, System.Collections.Generic.IDictionary <int?, object> parametersByIndex, bool updatable, Net.Vpc.Upa.Filters.FieldFilter defaultFieldFilter, Net.Vpc.Upa.Persistence.EntityExecutionContext context, System.Collections.Generic.IList <Net.Vpc.Upa.Expressions.VarVal> complexVals, Net.Vpc.Upa.Entity entity, string entityName, Net.Vpc.Upa.Persistence.ResultMetaData metadata)
 {
     this.defaultPersistenceStore = defaultPersistenceStore;
     this.finalHints         = finalHints;
     this.baseExpression     = baseExpression;
     this.parametersByName   = parametersByName;
     this.parametersByIndex  = parametersByIndex;
     this.updatable          = updatable;
     this.defaultFieldFilter = defaultFieldFilter;
     this.context            = context;
     this.complexVals        = complexVals;
     this.entity             = entity;
     this.entityName         = entityName;
     this.metadata           = metadata;
     this.connection         = context.GetConnection();
 }
Example #10
0
 public QualifiedValue(Net.Vpc.Upa.Entity entityManager, object @value)
 {
     this.entityManager = entityManager;
     this.@value        = @value;
 }
Example #11
0
 public DefaultQueryBuilder(Net.Vpc.Upa.Entity entity)
 {
     this.entity = entity;
 }
Example #12
0
 public DataNotFoundException(Net.Vpc.Upa.Entity entity)  : base(entity, "DataNotFoundException")
 {
 }
 public virtual Net.Vpc.Upa.Query CreateQuery(Net.Vpc.Upa.Entity e, Net.Vpc.Upa.Expressions.Delete query, Net.Vpc.Upa.Persistence.EntityExecutionContext context) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     return(context.GetPersistenceStore().CreateQuery(e, query, context));
 }
Example #14
0
 public RecordBeanType(Net.Vpc.Upa.Entity entity)
 {
     this.entity = entity;
 }
Example #15
0
 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;
 }
Example #16
0
 public QualifiedIdentifier(Net.Vpc.Upa.Entity entity, object id)
 {
     this.id     = id;
     this.entity = entity;
 }
 public virtual Net.Vpc.Upa.Extensions.UnionQueryInfo GetQueryInfo(Net.Vpc.Upa.Entity entity)
 {
     return(info);
 }
Example #18
0
 public virtual int IndexOf(Net.Vpc.Upa.Entity entity)
 {
     return(updatableTables.IndexOf(entity));
 }
Example #19
0
 public FindByIdAction(Net.Vpc.Upa.Entity e, object id, System.Collections.Generic.IDictionary <string, object> hints)
 {
     this.e     = e;
     this.id    = id;
     this.hints = hints;
 }
Example #20
0
 public SingleEntityKeyList(Net.Vpc.Upa.Impl.Persistence.QueryExecutor queryExecutor, Net.Vpc.Upa.Entity entity)  : base(queryExecutor)
 {
     this.entity = entity;
     columns     = queryExecutor.GetFields().Length;
 }
 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 void Install(Net.Vpc.Upa.Entity e)
 {
     e.SetEntitySecurityManager(s);
 }
 public virtual void Uninstall(Net.Vpc.Upa.Entity e)
 {
 }
Example #24
0
 public KeyBeanFactory(System.Type keyType, Net.Vpc.Upa.Entity entity)
 {
     this.idType = keyType;
     this.entity = entity;
 }
Example #25
0
        public override string GetSQL(object oo, Net.Vpc.Upa.Persistence.EntityExecutionContext context, Net.Vpc.Upa.Impl.Persistence.SQLManager sqlManager, Net.Vpc.Upa.Impl.Uql.ExpressionDeclarationList declarations) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledUpdate o  = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledUpdate)oo;
            Net.Vpc.Upa.Persistence.PersistenceStore persistenceStore = context.GetPersistenceStore();
            Net.Vpc.Upa.PersistenceUnit pu     = context.GetPersistenceUnit();
            Net.Vpc.Upa.Entity          entity = pu.GetEntity(o.GetEntity().GetName());
            //        String persistenceName = persistenceStore.getPersistenceName(entity);
            System.Text.StringBuilder sb = new System.Text.StringBuilder("Update " + sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName(entity.GetName()), context, declarations));
            string tableAlias            = o.GetEntityAlias();

            if (tableAlias != null)
            {
                sb.Append(" ");
                sb.Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(tableAlias), context, declarations));
            }
            sb.Append(" Set ");
            bool isFirst = true;
            int  max     = o.CountFields();

            for (int i = 0; i < max; i++)
            {
                Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar vv = o.GetField(i);
                Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar ev = null;
                Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar fv = null;
                if (vv.GetChild() == null)
                {
                    ev = null;
                    fv = vv;
                }
                else
                {
                    ev = vv;
                    fv = (Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar)vv.GetChild();
                }
                Net.Vpc.Upa.Impl.Uql.Compiledexpression.DefaultCompiledExpression fieldValue = o.GetFieldValue(i);
                //            Object referrer = vv.getReferrer();
                Net.Vpc.Upa.Field  f             = ((Net.Vpc.Upa.Field)fv.GetReferrer());
                Net.Vpc.Upa.Entity entityManager = f.GetEntity();
                System.Collections.Generic.IList <Net.Vpc.Upa.PrimitiveField> primFields = entityManager.ToPrimitiveFields <Net.Vpc.Upa.EntityPart>(new System.Collections.Generic.List <Net.Vpc.Upa.EntityPart>(new[] { (Net.Vpc.Upa.EntityPart)f }));
                foreach (Net.Vpc.Upa.PrimitiveField primField in primFields)
                {
                    if (isFirst)
                    {
                        isFirst = false;
                    }
                    else
                    {
                        sb.Append(", ");
                    }
                    if (ev != null)
                    {
                        sb.Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(ev.GetName()), context, declarations)).Append(".");
                    }
                    sb.Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(primField), context, declarations));
                    sb.Append("=").Append("(").Append(sqlManager.GetSQL(fieldValue, context, declarations)).Append(")");
                }
            }
            if (o.GetCondition() != null && o.GetCondition().IsValid())
            {
                sb.Append(" Where ").Append(sqlManager.GetSQL(o.GetCondition(), context, declarations));
            }
            if (persistenceStore.IsViewSupported() && entity.NeedsView() && o.GetEntity().IsUseView())
            {
                string implicitTableAlias = persistenceStore.GetPersistenceName("IT_" + entity.GetName(), Net.Vpc.Upa.Persistence.PersistenceNameType.ALIAS);
                sb.Append(" ");
                sb.Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName(entity.GetName()), context, declarations)).Append(" ").Append(implicitTableAlias).Append(",").Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledEntityName(entity.GetName(), true), context, declarations)).Append(" ").Append(sqlManager.GetSQL(new Net.Vpc.Upa.Impl.Uql.Compiledexpression.CompiledVar(tableAlias), context, declarations));
            }
            //            if (extraFrom != null)
            return(sb.ToString());
        }
Example #26
0
 public virtual void SetEntity(Net.Vpc.Upa.Entity entity)
 {
     this.entity = entity;
 }
 public override void Install(Net.Vpc.Upa.Entity entity, Net.Vpc.Upa.Persistence.EntityOperationManager entityOperationManager, Net.Vpc.Upa.Extensions.EntityExtensionDefinition extension) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     base.Install(entity, entityOperationManager, extension);
 }
Example #28
0
 public DeleteRecordNotAllowedException(Net.Vpc.Upa.Entity entity, string operationName)  : base(entity, operationName)
 {
 }
 public EntityChildComparator(Net.Vpc.Upa.Entity defaultEntity)
 {
     this.defaultEntity = defaultEntity;
 }
Example #30
0
 public DeleteRecordNotAllowedException(Net.Vpc.Upa.Entity entity)  : base(entity, "remove.NotAllowed")
 {
 }