Interface JDOEJB11Helper

  • All Known Subinterfaces:
    JDOEJB20Helper
    All Known Implementing Classes:
    JDOEJB11HelperImpl, JDOEJB20HelperImpl

    public interface JDOEJB11Helper
    This is the helper interface for conversion of persistence-capable instances to and from EJB objects of type: EJBObject, PrimaryKey, and Collections of those. This interface is generic for CMP1.1 and CMP2.0.
    Author:
    Marina Vatkina
    • Method Detail

      • convertPCToEJBObject

        jakarta.ejb.EJBObject convertPCToEJBObject​(Object pc,
                                                   PersistenceManager pm)
        Converts persistence-capable instance to EJBObject.
        Parameters:
        pc - the persistence-capable instance to be converted as an Object.
        pm - the associated instance of PersistenceManager.
        Returns:
        instance of EJBObject.
      • convertEJBObjectToPC

        Object convertEJBObjectToPC​(jakarta.ejb.EJBObject o,
                                    PersistenceManager pm,
                                    boolean validate)
        Converts EJBObject to persistence-capable instance.
        Parameters:
        o - the EJBObject instance to be converted.
        pm - the associated instance of PersistenceManager.
        validate - true if the existence of the instance is to be validated.
        Returns:
        persistence-capable instance.
        Throws:
        IllegalArgumentException - if validate is true and instance does not exist in the database or is deleted.
      • convertCollectionPCToEJBObject

        Collection convertCollectionPCToEJBObject​(Collection pcs,
                                                  PersistenceManager pm)
        Converts Collection of persistence-capable instances to a Collection of EJBObjects.
        Parameters:
        pcs - the Collection of persistence-capable instance to be converted.
        pm - the associated instance of PersistenceManager.
        Returns:
        Collection of EJBObjects.
      • convertCollectionPCToEJBObjectSet

        Set convertCollectionPCToEJBObjectSet​(Collection pcs,
                                              PersistenceManager pm)
        Converts Collection of persistence-capable instances to a Set of EJBObjects.
        Parameters:
        pcs - the Collection of persistence-capable instance to be converted.
        pm - the associated instance of PersistenceManager.
        Returns:
        Set of EJBObjects.
      • convertCollectionEJBObjectToPC

        Collection convertCollectionEJBObjectToPC​(Collection coll,
                                                  PersistenceManager pm,
                                                  boolean validate)
        Converts Collection of EJBObjects to a Collection of persistence-capable instances.
        Parameters:
        coll - the Collection of EJBObject instances to be converted.
        pm - the associated instance of PersistenceManager.
        validate - true if the existence of the instances is to be validated.
        Returns:
        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.
      • convertPCToPrimaryKey

        Object convertPCToPrimaryKey​(Object pc,
                                     PersistenceManager pm)
        Converts persistence-capable instance to an instance of the PrimaryKey Class.
        Parameters:
        pc - the persistence-capable instance to be converted as an Object.
        pm - the associated instance of PersistenceManager.
        Returns:
        instance of the PrimaryKey Class.
      • convertCollectionPCToPrimaryKey

        Collection convertCollectionPCToPrimaryKey​(Collection pcs,
                                                   PersistenceManager pm)
        Converts Collection of persistence-capable instances to a Collection of the PrimaryKey Class instances.
        Parameters:
        pcs - Collection of the persistence-capable instances.
        pm - the associated instance of PersistenceManager.
        Returns:
        Collection of the PrimaryKey Class instances.
      • convertObjectIdToPrimaryKey

        Object convertObjectIdToPrimaryKey​(Object objectId)
        Converts Object Id of a persistence-capable instance to an instance of the PrimaryKey Class.
        Parameters:
        objectId - the Object Id to be converted.
        Returns:
        instance of the PrimaryKey Class.
      • convertPrimaryKeyToObjectId

        Object convertPrimaryKeyToObjectId​(Object key)
        Converts instance of a PrimaryKey Class to an instance of the Object Id of a corresponding persistence-capable Class.
        Parameters:
        key - the PrimaryKey instance to be converted.
        Returns:
        instance of the Object Id.
      • convertCollectionObjectIdToPrimaryKey

        Collection convertCollectionObjectIdToPrimaryKey​(Collection oids)
        Converts Collection of Object Id's of persistence-capable instances to a Collection of of the PrimaryKey instances.
        Parameters:
        oids - Collection of the Object Id to be converted.
        Returns:
        Collection of of the PrimaryKey Class instances.
      • convertCollectionPrimaryKeyToObjectId

        Collection convertCollectionPrimaryKeyToObjectId​(Collection key)
        Converts Collection of PrimaryKey instances to a Collection of Object Id's of a corresponding persistence-capable Class.
        Parameters:
        key - Collection of the PrimaryKey instances to be converted.
        Returns:
        Collection of the Object Id's.
      • getPCClass

        Class getPCClass()
        Returns the class object of the corresponding persistence-capable class of the concrete bean class.
        Returns:
        the pc class object
      • writeSerializableObjectToByteArray

        byte[] writeSerializableObjectToByteArray​(Serializable serializableObject)
        Serializes serializableObject into a byte array
        Parameters:
        serializableObject - Instance of a Serializable Object
        Returns:
        serializableObject serialized into a byte array
      • readSerializableObjectFromByteArray

        Serializable readSerializableObjectFromByteArray​(byte[] byteArray)
        Constructs a Serializable object from byteArray. It is expected that byteArray was constructed using a previous call to writeSerializableObjectToByteArray
        Parameters:
        byteArray - Array of byte obtained from a call to writeSerializableObjectToByteArray
        Returns:
        A Serializable object contructed from byteArray
        See Also:
        writeSerializableObjectToByteArray(Serializable)
      • getContainer

        Object getContainer()
        Returns Container object associated with the corresponding concrete bean class.
        Returns:
        a Container object.
      • assertInstanceOfRemoteInterfaceImpl

        void assertInstanceOfRemoteInterfaceImpl​(Object o)
        Validates that this instance is of the correct implementation class of a remote interface type.
        Parameters:
        o - the instance to validate.
        Throws:
        IllegalArgumentException - if validation fails.
      • getNumericConverter

        NumericConverter getNumericConverter()
        Return NumericConverter for conversion from Number to BigDecimal or BigInteger for this bean type. It is responsible for passing the correct policy value to the NumericConverterFactory.
        Returns:
        NumericConverter for given object policy