📄 employee_az16cs__weblogic_cmp_rdbms_employeepermcmp_set.java
字号:
/**
* This code was automatically generated at 8:22:55 on 2005-4-22
* by weblogic.ejb20.cmp.rdbms.codegen.OneToManyGenerator -- do not edit.
*
* @version WebLogic Server 8.1 Fri Dec 5 15:01:51 PST 2003 316284
* @author Copyright (c) 2005 by BEA Systems, Inc. All Rights Reserved.
*/
package testejb;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.lang.reflect.Array;
import java.io.Serializable;
import java.io.IOException;
import javax.ejb.EJBObject;
import javax.ejb.EJBLocalObject;
import javax.ejb.EntityContext;
import javax.ejb.EJBException;
import javax.ejb.NoSuchEntityException;
import javax.transaction.Transaction;
import weblogic.ejb20.internal.EntityEJBContextImpl;
import weblogic.ejb20.interfaces.WLEnterpriseBean;
import weblogic.ejb20.persistence.spi.CMPBeanManager;
import weblogic.ejb20.persistence.spi.EoWrapper;
import weblogic.ejb20.persistence.spi.EloWrapper;
import weblogic.ejb20.persistence.spi.PersistenceRuntimeException;
import weblogic.ejb20.cmp.rdbms.RDBMSException;
import weblogic.ejb20.cmp.rdbms.RDBMSSet;
import weblogic.ejb20.cmp.rdbms.RDBMSUtils;
import weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager;
import javax.transaction.TransactionManager;
import weblogic.transaction.TransactionHelper;
import weblogic.ejb20.EJBLogger;
import weblogic.logging.Loggable;
import weblogic.utils.Debug;
import weblogic.utils.collections.ArraySet;
public final class Employee_az16cs__WebLogic_CMP_RDBMS_employeePermcmp_Set implements RDBMSSet, Set, Serializable,Cloneable
{
// =================================================================
// Class variable(s)
private static final boolean __WL_debug =
(System.getProperty(RDBMSUtils.RDBMS_CODEGEN_DEBUG_PROP) != null);
private static final boolean __WL_verbose =
(System.getProperty(RDBMSUtils.RDBMS_CODEGEN_VERBOSE_PROP) != null);
private CMPBeanManager __WL_bm;
private Method __WL_finder;
private Object __WL_createPk;
private EJBLocalObject __WL_createEo;
private Set __WL_cache;
private Set __WL_add;private Set __WL_rem;private RDBMSPersistenceManager __WL_pm;
private boolean isCreatorBeanInvalidated = false;
private Transaction __WL_createTx;
public Employee_az16cs__WebLogic_CMP_RDBMS_employeePermcmp_Set(testejb.Employee_az16cs_Intf __WL_creator,
CMPBeanManager __WL_bm,
Method __WL_finder
) {
try {
this.__WL_bm = __WL_bm;
this.__WL_finder = __WL_finder;
EntityEJBContextImpl __WL_ctx = (EntityEJBContextImpl) __WL_creator.__WL_getEntityContext();
__WL_createPk = __WL_ctx.__WL_getPrimaryKey();
__WL_createEo = __WL_ctx.__WL_getEJBLocalObject();
__WL_add = new ArraySet(10);__WL_rem = new ArraySet(10);__WL_pm = (RDBMSPersistenceManager)__WL_creator.__WL_getPersistenceManager();
__WL_createTx = TransactionHelper.getTransactionHelper().getTransaction();
} 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 populateCache() {
try {
if (__WL_debug) {
Debug.assertion(__WL_createPk !=null);
}
__WL_cache = __WL_bm.localWrapperSetFinder(__WL_finder, new Object[] {__WL_createPk});
Iterator __WL_additer = __WL_add.iterator();
while (__WL_additer.hasNext()) {
EloWrapper __WL_wrapper = (EloWrapper)__WL_additer.next();
if (!__WL_cache.contains(__WL_wrapper)) {
__WL_cache.add(__WL_wrapper);
}
}
Iterator __WL_remiter = __WL_rem.iterator();
while (__WL_remiter.hasNext()) {
EloWrapper __WL_wrapper = (EloWrapper)__WL_remiter.next();
if (__WL_cache.contains(__WL_wrapper)) {
__WL_cache.remove(__WL_wrapper);
}
}
__WL_add = null;
__WL_rem = null;
isCreatorBeanInvalidated = false;
} 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);
}
}
//======================================================================
//implementation of RDBMSSet
public void doAdd(Object o)
{
if (__WL_verbose) Debug.say("doAdd() called.");
EJBLocalObject eo = (EJBLocalObject)o;
checkTransaction();
EloWrapper wrap = new EloWrapper(eo);
if (__WL_cache==null) {
if (__WL_rem.contains(wrap)) {
__WL_rem.remove(wrap);
}
if (__WL_debug) {
Debug.assertion(!__WL_add.contains(wrap));
}
__WL_add.add(wrap);
}
else {
if (__WL_debug) {
Debug.assertion(!__WL_cache.contains(wrap));
}
__WL_cache.add(wrap);
}
if (!isCreatorBeanInvalidated) {
__WL_pm.registerInvalidatedBean(__WL_createPk);
isCreatorBeanInvalidated = true;
}
}
public void doRemove(Object o) {
doRemove(o, true);
}
public void doRemove(Object o, boolean remove)
{
checkTransaction();
EJBLocalObject eo = (EJBLocalObject)o;
EloWrapper wrap = new EloWrapper(eo);
if (__WL_cache==null) {
if (__WL_add.contains(wrap)) {
__WL_add.remove(wrap);
}
if (__WL_debug) {
Debug.assertion(!__WL_rem.contains(wrap));
}
__WL_rem.add(wrap);
}
else {
if (remove) {
if (__WL_debug) {
Debug.assertion(__WL_cache.contains(wrap));
}
__WL_cache.remove(wrap);
}
}
if(!isCreatorBeanInvalidated) {
__WL_pm.registerInvalidatedBean(__WL_createPk);
isCreatorBeanInvalidated = true;
}
}
public void doAddToCache(Object o)
{
if (__WL_verbose) Debug.say("doAddToCache() called.");
if (__WL_cache==null) {
__WL_cache = new HashSet(10);
}
if (o == null) return;
EJBLocalObject eo = (EJBLocalObject)o;
EloWrapper wrap = new EloWrapper(eo);
if (__WL_debug) {
Debug.assertion(!__WL_cache.contains(wrap));
}
__WL_cache.add(wrap);
}
//======================================================================
//implementation of java.util.Collection
public Iterator iterator() {
checkTransaction();
if (__WL_cache==null) {
populateCache();
}
return new Employee_az16cs__WebLogic_CMP_RDBMS_employeePermcmp_Iterator(__WL_cache.iterator(), this);
}
public Transaction getTransaction() { return __WL_createTx; }
public void setTransaction(Transaction newCreateTx) {
__WL_createTx = newCreateTx;
}
public boolean add(Object o) {
checkTransaction();
if (o==null)
throw new IllegalArgumentException();
if (!(o instanceof testejb.EmployeePermcmp))
throw new IllegalArgumentException(
"Attempted to add an object of type '" +
o.getClass().getName() +
"' to collection, but the type must be '" +
"testejb.EmployeePermcmp' instead.");
try {
EJBLocalObject eo = (EJBLocalObject)o;
testejb.EmployeePermcmp_1ny90w_Intf __WL_bean = (testejb.EmployeePermcmp_1ny90w_Intf)
__WL_bm.lookup(eo.getPrimaryKey());
int oldState = __WL_bean.__WL_getMethodState();
try {
__WL_bean.__WL_setMethodState(WLEnterpriseBean.STATE_BUSINESS_METHOD);
try {
__WL_bean.__WL_checkExistsOnMethod();
}
catch (NoSuchEntityException nsee) {
Loggable l = EJBLogger.logbeanDoesNotExistLoggable("EmployeePermcmp",eo.getPrimaryKey().toString());
throw new IllegalArgumentException(l.getMessage());
}
if (__WL_createPk.equals(__WL_bean.getEmployeeId())) {
return false;
}
else {
__WL_bean.setEmployeeBean_employeePermcmp(
(testejb.Employee)__WL_createEo);
return true;
}
} finally {
__WL_bean.__WL_setMethodState(oldState);
}
} 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 addAll(Collection __WL_collection) {
checkTransaction();
if (__WL_collection==null) return false;
Collection temp = new ArrayList();
temp.addAll(__WL_collection);
Iterator __WL_iter = temp.iterator();
boolean changed = false;
while (__WL_iter.hasNext()) {
changed |= add(__WL_iter.next());
}
return changed;
}
public void clear() {
clear(false);
}
public void clear(boolean ejbStore) {
checkTransaction();
if (__WL_cache==null) {
populateCache();
}
Collection cln = (Collection)((HashSet)__WL_cache).clone();
Iterator __WL_iter = cln.iterator();
while (__WL_iter.hasNext()) {
EloWrapper __WL_wrapper = (EloWrapper)__WL_iter.next();
remove(__WL_wrapper.getEJBLocalObject(), ejbStore);
}
}
public boolean contains(Object o) {
checkTransaction();
if (o==null)
return false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -