⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wbemployee_ji9hxe__weblogic_cmp_rdbms_wbrole_set.java

📁 客户管理系统,很强大的功能,能完成日常生活中的大部分事务
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
      }
    } catch (RuntimeException re) {
      if (__WL_verbose) {
        Debug.say("rethrowing RuntimeException.");
        re.printStackTrace();
      }
      throw re;
    } catch (Exception ex) {
      if (__WL_verbose) {
        Debug.say("wrapping Exception in PersistenceRuntimeException.");
        ex.printStackTrace();
      }
      throw new PersistenceRuntimeException(ex);
    }

      finally {
        __WL_pm.releaseResources(__WL_con, __WL_stmt, null);
    }
  }


  public boolean remove(Object o) {
    return remove(o, true, true);
  }


  // The flag 'remove' controls whether the Relationship's
  // underlying __WL_cache does a remove() operation.
  // If an Iterator of the __WL_cache is used to effect a remove()
  // then we must be sure to not do a __WL_cache.remove()
  //   that is the intended use of the 'remove' flag.

  public boolean remove(Object o, boolean dummyIgnore, boolean remove)
  {
    if (__WL_verbose) Debug.say("remove() called.");

    checkTransaction();

    if (o==null)
      throw new IllegalArgumentException(
        "Null value passed to WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set.remove.");

    if (!(o instanceof custom_management.WbRole)) {
      throw new IllegalArgumentException(
        "WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set.remove called with argument of type '" +
        o.getClass().getName() +
        "', must be 'custom_management.WbRole'.");
    }

    try {
      EJBLocalObject eo = (EJBLocalObject)o;

      custom_management.WbRole_wjvqb2_Intf __WL_bean = (custom_management.WbRole_wjvqb2_Intf)
        __WL_bm.lookup(eo.getPrimaryKey());

      try {
        __WL_bean.__WL_checkExistsOnMethod();
      }
      catch (NoSuchEntityException nsee) { 
        Loggable l = EJBLogger.logbeanDoesNotExistLoggable("WbRole",eo.getPrimaryKey().toString());
        throw new IllegalArgumentException(l.getMessage());  
      }

      boolean changed = false;

      if (orderDatabaseOperations) {
              Object otherPK = eo.getPrimaryKey();

      // if we have previously cached a deferred INSERT
      //   for this PK,
      // then simply undo the add and set changed == true
      // else go and do the normal Join Table remove step

      if (getAddSet().contains(otherPK)) {
        if (__WL_verbose)
          Debug.say("WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set: remove: skipping JoinTable DELETE, "+
                    "remove from addSet which contains cached Join Table INSERT pk '"+otherPK+"'");
        getAddSet().remove(otherPK);
        changed = true;
      }
      else {
        
      // do existence check for non-deferred Join Table INSERT

      changed = removeJoinTable(__WL_createPk, eo.getPrimaryKey());
      if (__WL_symmetric) {
        if (!__WL_createPk.equals(eo.getPrimaryKey())) {
          removeJoinTable(eo.getPrimaryKey(), __WL_createPk);
        }
      }

      }

      }
      else {
        
      // do existence check for non-deferred Join Table INSERT

      changed = removeJoinTable(__WL_createPk, eo.getPrimaryKey());
      if (__WL_symmetric) {
        if (!__WL_createPk.equals(eo.getPrimaryKey())) {
          removeJoinTable(eo.getPrimaryKey(), __WL_createPk);
        }
      }

      }

      if (changed) {
        doRemove(eo, remove);

        int oldState = __WL_bean.__WL_getMethodState();
        try {
          __WL_bean.__WL_setMethodState(WLEnterpriseBean.STATE_BUSINESS_METHOD);
          RDBMSM2NSet __WL_collection = (RDBMSM2NSet)
            __WL_bean.getWbEmployee();

          __WL_collection.doRemove(__WL_createEo);

          if (orderDatabaseOperations) {

            // remove from other cached INSERT AddSet if entry exists
            __WL_collection.getAddSet().remove(__WL_createPk);
          }
        } finally {
          __WL_bean.__WL_setMethodState(oldState);
        }
      }
      return changed;
     } catch (RuntimeException re) {
      if (__WL_verbose) {
        Debug.say("rethrowing RuntimeException.");
        re.printStackTrace();
      }
      throw re;
    } catch (Exception ex) {
      if (__WL_verbose) {
        Debug.say("wrapping Exception in PersistenceRuntimeException.");
        ex.printStackTrace();
      }
      throw new PersistenceRuntimeException(ex);
    }

  }


  public boolean removeAll(Collection col)
  {
    if (__WL_verbose) Debug.say("removeAll() called.");

    checkTransaction();

    if (col==null) return false;

    boolean changed = false;
    Iterator iter = col.iterator();
    while (iter.hasNext()) {
      changed |= remove(iter.next());
    }

    return changed;
  }


  public boolean retainAll(Collection col)
  {
    if (__WL_verbose) Debug.say("retainAll() called.");

    checkTransaction();

    Set retainSet = new HashSet();
    Iterator iter = null;
    if (col!=null) {
      iter = col.iterator();
      while (iter.hasNext()) {
        Object o = iter.next();
        if (o instanceof custom_management.WbRole) {
          EJBLocalObject eo = (EJBLocalObject)o;
          retainSet.add(new EloWrapper(eo));
        }
      }
    }
    if (__WL_cache==null) {
      populateCache();
    }
    iter = __WL_cache.iterator();
    List removeList = new ArrayList();

    while (iter.hasNext()) {
      EloWrapper wrap = (EloWrapper)iter.next();

      if (!retainSet.contains(wrap)) {
        removeList.add(wrap.getEJBLocalObject());
      }
    }

    iter = removeList.iterator();
    boolean changed = false;
    while (iter.hasNext()) {
      EJBLocalObject eo = (EJBLocalObject)iter.next();
      changed |= remove(eo);
    }

    return changed;
  }


  public int size()
  {
    if (__WL_verbose) Debug.say("size() called.");

    checkTransaction();

    if (__WL_cache==null)
      populateCache();

    return __WL_cache.size();
  }


  public Object[] toArray()
  {
    if (__WL_verbose) Debug.say("toArray() called.");

    checkTransaction();

    if (__WL_cache==null) populateCache();

    int i = 0;
    Object[] arry = new Object[__WL_cache.size()];
    Iterator iter = __WL_cache.iterator();
    while (iter.hasNext()) {
      EloWrapper wrap = (EloWrapper)iter.next();
      arry[i++] = wrap.getEJBLocalObject();
    }

    return arry;
  }


  public Object[] toArray(Object[] a)
  {
    if (__WL_verbose) Debug.say("toArray() called.");

    checkTransaction();

    if (a==null)
      throw new ArrayStoreException(
        "Null argument passed to WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set.toArray");

    try {
      Class toClass = a.getClass().getComponentType();

      if (__WL_cache==null) populateCache();

      if (a.length<__WL_cache.size())
        a = (Object[])Array.newInstance(toClass, __WL_cache.size());

      int i = 0;
      Iterator iter = __WL_cache.iterator();
      while (iter.hasNext()) {
        EloWrapper wrap = (EloWrapper)iter.next();
        custom_management.WbRole elem =
         (custom_management.WbRole)wrap.getEJBLocalObject();

        if (i==0) {
          Class colClass = elem.getClass();
          if (!toClass.isAssignableFrom(colClass)) {
            throw new ArrayStoreException(
              "Argument type '" +
              toClass.getName() +
              "' passed to WbEmployee_ji9hxe__WebLogic_CMP_RDBMS_wbRole_Set.toArray " +
              "is not a superclass of the element type of the collection '" +
              colClass.getName() +
              "'.");
          }
        }

        a[i++] = elem;
      }

      while (i<a.length) {
        a[i++] = null;
      }

      return a;
    } catch (RuntimeException re) {
      if (__WL_verbose) {
        Debug.say("rethrowing RuntimeException.");
        re.printStackTrace();
      }
      throw re;
    } catch (Exception ex) {
      if (__WL_verbose) {
        Debug.say("wrapping Exception in PersistenceRuntimeException.");
        ex.printStackTrace();
      }
      throw new PersistenceRuntimeException(ex);
    }

  }

  private void checkTransaction()
  {
    Transaction tx = TransactionHelper.getTransactionHelper().getTransaction();

    if (tx==null) {
      Loggable l = EJBLogger.logaccessedCmrCollectionOutsideTransactionLoggable("WbEmployee", "wbRole");
      throw new IllegalStateException(
        l.getMessage());
    }
    if (!tx.equals(__WL_createTx) && ! false ) {
      Loggable l1 = EJBLogger.logaccessedCmrCollectionInDifferentTransactionLoggable("WbEmployee", "wbRole");
      throw new IllegalStateException(
        l1.getMessage());
    }
  }
  
  public boolean checkIfCurrentTxEqualsCreateTx(javax.transaction.Transaction currentTx) {

     if(currentTx != null && currentTx.equals(__WL_createTx))
       return true;
     else
       return false;
  }


  public Object clone() throws CloneNotSupportedException {
     return super.clone();
  }
   
  private void writeObject(java.io.ObjectOutputStream out)
    throws IOException
  {
    throw new EJBException(
      "Attempt to serialize a collection that implements a cmr-field.  " +
      "Collections managed by the CMP RDBMS persistence manager may not " +
      "be passed directly to a remote client.");
  }

  private void readObject(java.io.ObjectInputStream in)
    throws IOException, ClassNotFoundException
  {
    // this method is never called

    throw new EJBException(
      "Attempt to serialize a collection that implements a cmr-field.  " +
      "Collections managed by the CMP RDBMS persistence manager may not " +
      "be passed directly to a remote client.");
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -