Ejemplo n.º 1
0
 public virtual void CheckRemove(Net.Vpc.Upa.Expressions.Expression condition, bool recurse) /* throws Net.Vpc.Upa.Exceptions.UPAException */
 {
     if (entity.GetEntityCount(condition) == 0)
     {
         //nothing to remove!!
         return;
     }
     if (!IsDeleteSupported())
     {
         throw new Net.Vpc.Upa.Exceptions.UndeletableRecordException(entity);
     }
     if (!entity.GetPersistenceUnit().GetSecurityManager().IsAllowedRemove(entity))
     {
         throw new Net.Vpc.Upa.Exceptions.DeleteRecordNotAllowedException(entity);
     }
     Net.Vpc.Upa.Expressions.Expression e = GetFullNonDeletableRecordsExpression();
     if (e != null && e.IsValid())
     {
         Net.Vpc.Upa.Expressions.Expression a = (condition == null) ? ((Net.Vpc.Upa.Expressions.Expression)(e)) : new Net.Vpc.Upa.Expressions.And(condition, e);
         if (entity.GetEntityCount(a) > 0)
         {
             throw new Net.Vpc.Upa.Exceptions.UndeletableRecordException(entity);
         }
     }
     Net.Vpc.Upa.Entity p = entity.GetParentEntity();
     if (p != null)
     {
         Net.Vpc.Upa.Expressions.Expression ss = entity.ChildToParentExpression(condition);
         //            p.getShield().checkRemove(ss, recurse);
         p.GetShield().CheckUpdate(p.GetBuilder().CreateRecord(), ss);
     }
     CheckVeto(Net.Vpc.Upa.VetoableOperation.checkDelete, condition, recurse);
 }