Example #1
0
        public virtual void FireAfterReset(Net.Vpc.Upa.Persistence.EntityExecutionContext context) /* throws Net.Vpc.Upa.Exceptions.UPAException */
        {
            Net.Vpc.Upa.Callbacks.EntityEvent @event = null;
            object methodExecId = Net.Vpc.Upa.Impl.FwkConvertUtils.Random();

            //        Log.method_enter(methodExecId, getName(), updates, condition);
            //        entity.postUpdateTable(updates, condition, context);
            if (entity.GetPersistenceUnit().IsTriggersEnabled())
            {
                foreach (Net.Vpc.Upa.Callbacks.Trigger et in entity.GetSoftTriggers())
                {
                    Net.Vpc.Upa.Impl.DefaultTrigger t = (Net.Vpc.Upa.Impl.DefaultTrigger)et;
                    //                Log.log(EditorConstants.Logs.TRIGGER, "<START " + getName() + ".fireAfterUpdate> " + t.toString());
                    try {
                        Net.Vpc.Upa.Callbacks.EntityListener li = t.GetListener();
                        if (@event == null)
                        {
                            @event = new Net.Vpc.Upa.Callbacks.EntityEvent(context, Net.Vpc.Upa.EventPhase.AFTER);
                        }
                        li.OnReset(@event);
                    } catch (Net.Vpc.Upa.Exceptions.UPAException e) {
                        log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("problem when executing trigger " + t.GetName() + ".onReset(" + t.GetEntity().GetName() + ")", e));
                        //                    Log.bug(e);
                        throw e;
                    }
                }
            }
            //                Log.log(EditorConstants.Logs.TRIGGER, "<END   " + getName() + ".fireAfterUpdate> " + t.toString());
            if (@event == null)
            {
                @event = new Net.Vpc.Upa.Callbacks.EntityEvent(context, Net.Vpc.Upa.EventPhase.AFTER);
            }
            foreach (Net.Vpc.Upa.Callback invoker in persistenceUnitListenerManager.GetPostCallbacks(Net.Vpc.Upa.CallbackType.ON_RESET, Net.Vpc.Upa.ObjectType.ENTITY, @event.GetEntity().GetName(), Net.Vpc.Upa.Impl.Event.PersistenceUnitListenerManager.DEFAULT_SYSTEM))
            {
                invoker.Invoke(@event);
            }
        }
Example #2
0
 public virtual void FireAfterPersist(object objectId, Net.Vpc.Upa.Record record, Net.Vpc.Upa.Persistence.EntityExecutionContext context) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     //        Object methodExecId = Math.random();
     //        Log.method_enter(methodExecId, getName(), key, record);
     //        entity.postInsertRecord(key, record, context);
     Net.Vpc.Upa.Callbacks.PersistEvent @event = null;
     if (entity.GetPersistenceUnit().IsTriggersEnabled())
     {
         foreach (Net.Vpc.Upa.Callbacks.Trigger et in entity.GetSoftTriggers())
         {
             Net.Vpc.Upa.Impl.DefaultTrigger t = (Net.Vpc.Upa.Impl.DefaultTrigger)et;
             //                Log.log(EditorConstants.Logs.TRIGGER, "<START " + getName() + ".firePostInsertTable> " + t.toString());
             try {
                 Net.Vpc.Upa.Callbacks.EntityListener li = t.GetListener();
                 if (@event == null)
                 {
                     @event = new Net.Vpc.Upa.Callbacks.PersistEvent(objectId, record, context, Net.Vpc.Upa.EventPhase.AFTER);
                 }
                 @event.SetTrigger(et);
                 li.OnPersist(@event);
             } catch (Net.Vpc.Upa.Exceptions.UPAException e) {
                 log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("problem when executing trigger " + t.GetName() + ".onPersist(" + t.GetEntity().GetName() + "," + objectId + ")", e));
                 //                    Log.bug("19987", "problem when executing trigger " + t.getName() + ".entityInserted(" + getName() + "," + key + ")");
                 //                    Log.bug(e);
                 throw e;
             }
         }
     }
     //                Log.log(EditorConstants.Logs.TRIGGER, "<END   " + getName() + ".firePostInsertTable> " + t.toString());
     if (@event == null)
     {
         @event = new Net.Vpc.Upa.Callbacks.PersistEvent(objectId, record, context, Net.Vpc.Upa.EventPhase.AFTER);
     }
     foreach (Net.Vpc.Upa.Callback invoker in persistenceUnitListenerManager.GetPostCallbacks(Net.Vpc.Upa.CallbackType.ON_PERSIST, Net.Vpc.Upa.ObjectType.ENTITY, @event.GetEntity().GetName(), Net.Vpc.Upa.Impl.Event.PersistenceUnitListenerManager.DEFAULT_SYSTEM))
     {
         invoker.Invoke(@event);
     }
 }
Example #3
0
 public virtual void FireBeforeFormulasUpdate(Net.Vpc.Upa.Record updates, Net.Vpc.Upa.Expressions.Expression condition, Net.Vpc.Upa.Persistence.EntityExecutionContext context) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     //        Object methodExecId = Math.random();
     //        Log.method_enter(methodExecId, getName(), updates, condition);
     //        entity.preUpdateTable(updates, condition, context);
     Net.Vpc.Upa.Callbacks.UpdateFormulaEvent @event = null;
     if (entity.GetPersistenceUnit().IsTriggersEnabled())
     {
         foreach (Net.Vpc.Upa.Callbacks.Trigger et in entity.GetSoftTriggers())
         {
             Net.Vpc.Upa.Impl.DefaultTrigger t = (Net.Vpc.Upa.Impl.DefaultTrigger)et;
             //                Log.log(EditorConstants.Logs.TRIGGER, "<START " + getName() + ".fireBeforeUpdate> " + t.toString());
             try {
                 Net.Vpc.Upa.Callbacks.EntityListener li = t.GetListener();
                 if (@event == null)
                 {
                     @event = new Net.Vpc.Upa.Callbacks.UpdateFormulaEvent(updates, condition, context, Net.Vpc.Upa.EventPhase.BEFORE);
                 }
                 li.OnPreUpdateFormula(@event);
             } catch (Net.Vpc.Upa.Exceptions.UPAException ex) {
                 log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("problem when executing trigger " + t.GetName() + ".onPreUpdateFormula(" + t.GetEntity().GetName() + "," + condition + ")", ex));
                 //                    Log.bug("19987", "problem when executing trigger " + t.getName() + ".beforeUpdate(" + getName() + "," + condition + ")");
                 //                    Log.bug(e);
                 throw ex;
             }
         }
     }
     //                Log.log(EditorConstants.Logs.TRIGGER, "<END   " + getName() + ".fireBeforeUpdate> " + t.toString());
     if (@event == null)
     {
         @event = new Net.Vpc.Upa.Callbacks.UpdateFormulaEvent(updates, condition, context, Net.Vpc.Upa.EventPhase.BEFORE);
     }
     foreach (Net.Vpc.Upa.Callback invoker in persistenceUnitListenerManager.GetPreCallbacks(Net.Vpc.Upa.CallbackType.ON_UPDATE_FORMULAS, Net.Vpc.Upa.ObjectType.ENTITY, @event.GetEntity().GetName(), Net.Vpc.Upa.Impl.Event.PersistenceUnitListenerManager.DEFAULT_SYSTEM))
     {
         invoker.Invoke(@event);
     }
     foreach (Net.Vpc.Upa.PreparedCallback invoker in persistenceUnitListenerManager.GetPostPreparedCallbacks(Net.Vpc.Upa.CallbackType.ON_UPDATE_FORMULAS, Net.Vpc.Upa.ObjectType.ENTITY, @event.GetEntity().GetName(), Net.Vpc.Upa.Impl.Event.PersistenceUnitListenerManager.DEFAULT_SYSTEM))
     {
         invoker.Prepare(@event);
     }
 }