
package ebxml.publicprivate;

import java.lang.reflect.Field;
import org.apache.beehive.controls.api.ControlException;
import org.apache.beehive.controls.api.bean.Controls;
import org.apache.beehive.controls.api.versioning.VersionRequired;
import org.apache.beehive.controls.api.context.ControlBeanContext;
import org.apache.beehive.controls.runtime.bean.EventAdaptor;
import org.apache.beehive.controls.runtime.bean.AdaptorPersistenceDelegate;

@SuppressWarnings("all")
public class PublicBuyerClientInitializer
extends org.apache.beehive.controls.runtime.bean.ClientInitializer
{
    static final Field _roundtripSellerControlField;
    static
    {
        try
        {
            _roundtripSellerControlField = ebxml.publicprivate.PublicBuyer.class.getDeclaredField("roundtripSellerControl");
            _roundtripSellerControlField.setAccessible(true);
        }
        catch (NoSuchFieldException __bc_nsfe)
        {
            throw new ExceptionInInitializerError(__bc_nsfe);
        }
    }
    
    public static class RoundtripSellerControlCallbackEventAdaptor 
    implements ebxml.roundtrip.RoundtripSellerControl.Callback, 
    EventAdaptor, java.io.Serializable
    {
        private static final long serialVersionUID = 1L;
        
        ebxml.publicprivate.PublicBuyer __bc_client;
        
        public RoundtripSellerControlCallbackEventAdaptor(ebxml.publicprivate.PublicBuyer client) { __bc_client = client; }
        
        public Object getClient() { return __bc_client; }
        
        public void onAck(weblogic.wsee.jws.wlw.schemas.soap11.EnvelopeDocument ack) 
        {
        }
        public void onError(weblogic.wsee.jws.wlw.schemas.soap11.EnvelopeDocument error) 
        {
        }
        public void onInvoice(com.bea.tutorial.invoice.InvoiceDocument payload) 
        {
            __bc_client.roundtripSellerControl_onInvoice(payload);
        }
        
    }
    
    
    
    private static void initializeFields(ControlBeanContext cbc,
    ebxml.publicprivate.PublicBuyer client)
    {
        try
        {
            String __bc_id;
            //
            // Initialize any nested controls used by the client
            //
            __bc_id = "roundtripSellerControl";
            ebxml.roundtrip.RoundtripSellerControlBean _roundtripSellerControl = (cbc == null ? null : (ebxml.roundtrip.RoundtripSellerControlBean)cbc.getBean(__bc_id));
            if (_roundtripSellerControl == null)
            _roundtripSellerControl = (ebxml.roundtrip.RoundtripSellerControlBean) Controls.instantiate(ebxml.roundtrip.RoundtripSellerControlBean.class, getAnnotationMap(cbc, _roundtripSellerControlField), cbc, __bc_id );
            _roundtripSellerControl.addCallbackListener(new RoundtripSellerControlCallbackEventAdaptor(client));
            
            
            _roundtripSellerControlField.set(client, _roundtripSellerControl);
        }
        catch (RuntimeException __bc_re) { throw __bc_re; }
        catch (Exception __bc_e)
        {
            __bc_e.printStackTrace();
            throw new ControlException("Initializer failure", __bc_e);
        }
    }
    
    public static void initialize(ControlBeanContext cbc, ebxml.publicprivate.PublicBuyer client)
    {
        
        initializeFields( cbc, client );
    }
}
