JDOEJB20HelperImplpublic abstract class JDOEJB20HelperImpl extends JDOEJB11HelperImpl implements com.sun.jdo.spi.persistence.support.sqlstore.ejb.JDOEJB20Helper
Methods Summary |
---|
public abstract void | assertInstanceOfLocalInterfaceImpl(java.lang.Object o)Validates that this instance is of the correct implementation class
of a local interface type.
| protected void | assertInstanceOfLocalInterfaceImpl(java.lang.Object o, java.lang.String beanName)Validates that this instance is of the correct implementation class
of a local interface.
Throws IllegalArgumentException if the passed
argument is of a wrong type.
// We can't check if null is the correct type or not. So
// we let it succeed.
if (o == null)
return;
try {
CMPHelper.assertValidLocalObject(o, getContainer());
} catch (EJBException ex) {
String msg = I18NHelper.getMessage(messages, "EXC_WrongLocalInstance", // NOI18N
new Object[] {o.getClass().getName(), beanName,
ex.getMessage()});
logger.log(Logger.WARNING, msg);
throw new IllegalArgumentException(msg);
}
| public java.util.Collection | convertCollectionEJBLocalObjectToPC(java.util.Collection coll, com.sun.jdo.api.persistence.support.PersistenceManager pm, boolean validate)Converts Collection of EJBLocalObjects to a Collection of
persistence-capable instances.
Collection rc = new java.util.ArrayList();
Object o = null;
boolean debug = false;
for (java.util.Iterator it = coll.iterator(); it.hasNext();) {
o = convertEJBLocalObjectToPC((EJBLocalObject)it.next(), pm, validate);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB20HelperImpl.convertCollectionEJBLocalObjectToPC() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
| public java.util.Collection | convertCollectionPCToEJBLocalObject(java.util.Collection pcs, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts Collection of persistence-capable instances to a Collection of
EJBLocalObjects.
Collection rc = new java.util.ArrayList();
Object o = null;
boolean debug = false;
for (java.util.Iterator it = pcs.iterator(); it.hasNext();) {
o = convertPCToEJBLocalObject((Object)it.next(), pm);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB20HelperImpl.convertCollectionPCToEJBLocalObject() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
| public java.util.Set | convertCollectionPCToEJBLocalObjectSet(java.util.Collection pcs, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts Collection of persistence-capable instances to a Set of
EJBLocalObjects.
java.util.Set rc = new java.util.HashSet();
Object o = null;
boolean debug = false;
for (java.util.Iterator it = pcs.iterator(); it.hasNext();) {
o = convertPCToEJBLocalObject((Object)it.next(), pm);
if(logger.isLoggable(Logger.FINEST) ) {
logger.finest(
"\n---JDOEJB20HelperImpl.convertCollectionPCToEJBLocalObjectSet() adding: " + o);// NOI18N
}
rc.add(o);
}
return rc;
| public java.lang.Object | convertEJBLocalObjectToPC(javax.ejb.EJBLocalObject o, com.sun.jdo.api.persistence.support.PersistenceManager pm, boolean validate)Converts EJBLocalObject to persistence-capable instance.
Object key = null;
try {
key = o.getPrimaryKey();
} catch (Exception ex) {
EJBException e = new EJBException(I18NHelper.getMessage(messages,
"EXC_ConvertEJBObjectToPC", o.getClass().getName()), ex);// NOI18N
logger.throwing("JDOEJB20HelperImpl", "convertEJBLocalObjectToPC", e); // NOI18N
throw e;
}
return convertPrimaryKeyToPC(key, pm, validate);
| public javax.ejb.EJBLocalObject | convertPCToEJBLocalObject(java.lang.Object pc, com.sun.jdo.api.persistence.support.PersistenceManager pm)Converts persistence-capable instance to EJBLocalObject.
if (pc == null) return null;
Object jdoObjectId = pm.getObjectId(pc);
Object key = convertObjectIdToPrimaryKey(jdoObjectId);
try {
return CMPHelper.getEJBLocalObject(key, getContainer());
} catch (Exception ex) {
EJBException e = new EJBException(I18NHelper.getMessage(messages,
"EXC_ConvertPCToEJBLocalObject", key.toString()), ex);// NOI18N
logger.throwing("JDOEJB20HelperImpl", "convertPCToEJBLocalObject", e); // NOI18N
throw e;
}
| public javax.ejb.EJBLocalObject | convertPCToEJBLocalObject(java.lang.Object pc, com.sun.jdo.api.persistence.support.PersistenceManager pm, javax.ejb.EJBContext context)Converts persistence-capable instance to EJBLocalObject. Returns null if
the instance is already removed via cascade-delete operation.
if (pc == null) return null;
Object jdoObjectId = pm.getObjectId(pc);
Object key = convertObjectIdToPrimaryKey(jdoObjectId);
try {
return CMPHelper.getEJBLocalObject(key, getContainer(), context);
} catch (Exception ex) {
EJBException e = new EJBException(I18NHelper.getMessage(messages,
"EXC_ConvertPCToEJBLocalObjectCtx", key.toString()), ex);// NOI18N
logger.throwing("JDOEJB20HelperImpl", "convertPCToEJBLocalObjectCtx", e); // NOI18N
throw e;
}
|
|