Search in sources :

Example 16 with EJBLocalObject

use of javax.ejb.EJBLocalObject in project Payara by payara.

the class JDOEJB20HelperImpl method convertCollectionEJBLocalObjectToPC.

/**
 * Converts Collection of EJBLocalObjects to a Collection of
 * persistence-capable instances.
 * @param coll the Collection of EJBLocalObject instances to be converted.
 * @param pm the associated instance of PersistenceManager.
 * @param validate true if the existence of the instances is to be validated.
 * @return Collection of persistence-capable instance.
 * @throws IllegalArgumentException if validate is true and at least one instance does
 * not exist in the database or is deleted.
 */
public Collection convertCollectionEJBLocalObjectToPC(Collection coll, PersistenceManager pm, boolean validate) {
    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(// NOI18N
            "\n---JDOEJB20HelperImpl.convertCollectionEJBLocalObjectToPC() adding: " + o);
        }
        rc.add(o);
    }
    return rc;
}
Also used : Collection(java.util.Collection) EJBLocalObject(javax.ejb.EJBLocalObject) EJBLocalObject(javax.ejb.EJBLocalObject)

Example 17 with EJBLocalObject

use of javax.ejb.EJBLocalObject in project Payara by payara.

the class JDOEJB20HelperImpl method convertPCToEJBLocalObject.

/**
 * Converts persistence-capable instance to EJBLocalObject.
 * @param pc the persistence-capable instance to be converted as an Object.
 * @param pm the associated instance of PersistenceManager.
 * @return instance of EJBLocalObject.
 */
public EJBLocalObject convertPCToEJBLocalObject(Object pc, PersistenceManager pm) {
    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()), // NOI18N
        ex);
        // NOI18N
        logger.throwing("JDOEJB20HelperImpl", "convertPCToEJBLocalObject", e);
        throw e;
    }
}
Also used : EJBLocalObject(javax.ejb.EJBLocalObject) EJBException(javax.ejb.EJBException) EJBException(javax.ejb.EJBException)

Aggregations

EJBLocalObject (javax.ejb.EJBLocalObject)17 EJBObject (javax.ejb.EJBObject)6 EJBException (javax.ejb.EJBException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 EntityBean (javax.ejb.EntityBean)2 BeanContext (org.apache.openejb.BeanContext)2 EjbContainerUtil (com.sun.ejb.containers.EjbContainerUtil)1 Method (java.lang.reflect.Method)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 CreateException (javax.ejb.CreateException)1 FinderException (javax.ejb.FinderException)1 RemoveException (javax.ejb.RemoveException)1 NamingException (javax.naming.NamingException)1 EntityManager (javax.persistence.EntityManager)1 Query (javax.persistence.Query)1 InternalErrorException (org.apache.openejb.InternalErrorException)1 ThreadContext (org.apache.openejb.core.ThreadContext)1 CmpContainer (org.apache.openejb.core.cmp.CmpContainer)1