package controls;

import java.beans.BeanDescriptor;
import java.beans.EventSetDescriptor;
import java.beans.IntrospectionException;
import java.beans.MethodDescriptor;
import java.beans.ParameterDescriptor;
import java.beans.PropertyDescriptor;
import java.beans.PropertyEditor;
import java.lang.reflect.Method;
import java.util.HashMap;

import org.apache.beehive.controls.api.ControlException;
import org.apache.beehive.controls.runtime.bean.BeanPersistenceDelegate;
import org.apache.beehive.controls.runtime.packaging.ControlEventSetDescriptor;

@SuppressWarnings("all")
public class AppTaskControlIIBeanBeanInfo
extends com.bea.control.TaskControlBeanBeanInfo
{
    static final Method _getApprovalPendingStepMethod;
    static final Method _getApplicationApprovedStepMethod;
    static final Method _setApplicationCaseIdMethod;
    static final Method _createMethod;
    static final Method _setApplicationInfoMethod;
    static final Method _getApplicationCaseIdMethod;
    static final Method _getCurrentStepMethod;
    static final Method _getApplicationInfoMethod;
    static final Method _NewExternalApplicationMethod;
    static final Method _getApplicationRejectedStepMethod;
    static final Method _CustomCallback_onApplicationApprovedStepEvent;
    static final Method _CustomCallback_onApprovalPendingStepEvent;
    static final Method _CustomCallback_onApplicationRejectedStepEvent;
    
    //
    // This HashMap will map from a Method to the array of names for parameters of the
    // method.  This is necessary because parameter name data isn't carried along in the
    // class file, but if available can enable ease of use by referencing parameters by
    // the declared name (vs. by index).
    //
    // This map should be read-only after its initialization in the static block, hence
    // using a plain HashMap is thread-safe.
    //
    static HashMap<Method, String []> _methodParamMap = new HashMap<Method, String []>();
    
    static
    {
        try
        {
            _getApprovalPendingStepMethod = controls.AppTaskControlII.class.getMethod("getApprovalPendingStep", new Class [] {});
            _methodParamMap.put(_getApprovalPendingStepMethod, new String [] {  });
            _getApplicationApprovedStepMethod = controls.AppTaskControlII.class.getMethod("getApplicationApprovedStep", new Class [] {});
            _methodParamMap.put(_getApplicationApprovedStepMethod, new String [] {  });
            _setApplicationCaseIdMethod = controls.AppTaskControlII.class.getMethod("setApplicationCaseId", new Class [] {java.lang.String.class});
            _methodParamMap.put(_setApplicationCaseIdMethod, new String [] { "value" });
            _createMethod = controls.AppTaskControlII.class.getMethod("create", new Class [] {});
            _methodParamMap.put(_createMethod, new String [] {  });
            _setApplicationInfoMethod = controls.AppTaskControlII.class.getMethod("setApplicationInfo", new Class [] {org.openuri.temp.exampleApp.application.InternalApplicationDocument.class});
            _methodParamMap.put(_setApplicationInfoMethod, new String [] { "value" });
            _getApplicationCaseIdMethod = controls.AppTaskControlII.class.getMethod("getApplicationCaseId", new Class [] {});
            _methodParamMap.put(_getApplicationCaseIdMethod, new String [] {  });
            _getCurrentStepMethod = controls.AppTaskControlII.class.getMethod("getCurrentStep", new Class [] {});
            _methodParamMap.put(_getCurrentStepMethod, new String [] {  });
            _getApplicationInfoMethod = controls.AppTaskControlII.class.getMethod("getApplicationInfo", new Class [] {});
            _methodParamMap.put(_getApplicationInfoMethod, new String [] {  });
            _NewExternalApplicationMethod = controls.AppTaskControlII.class.getMethod("NewExternalApplication", new Class [] {java.lang.String.class, org.openuri.temp.exampleApp.application.InternalApplicationDocument.class});
            _methodParamMap.put(_NewExternalApplicationMethod, new String [] { "taskName", "ApplicationInfo" });
            _getApplicationRejectedStepMethod = controls.AppTaskControlII.class.getMethod("getApplicationRejectedStep", new Class [] {});
            _methodParamMap.put(_getApplicationRejectedStepMethod, new String [] {  });
            _CustomCallback_onApplicationApprovedStepEvent = controls.AppTaskControlII.CustomCallback.class.getMethod("onApplicationApprovedStep", new Class [] {controls.AppTaskControlII.ApplicationApproved.class});
            _methodParamMap.put(_CustomCallback_onApplicationApprovedStepEvent, new String [] { "step" });
            _CustomCallback_onApprovalPendingStepEvent = controls.AppTaskControlII.CustomCallback.class.getMethod("onApprovalPendingStep", new Class [] {controls.AppTaskControlII.ApprovalPending.class});
            _methodParamMap.put(_CustomCallback_onApprovalPendingStepEvent, new String [] { "step" });
            _CustomCallback_onApplicationRejectedStepEvent = controls.AppTaskControlII.CustomCallback.class.getMethod("onApplicationRejectedStep", new Class [] {controls.AppTaskControlII.ApplicationRejected.class});
            _methodParamMap.put(_CustomCallback_onApplicationRejectedStepEvent, new String [] { "step" });
        }
        catch (NoSuchMethodException __bc_nsme)
        {
            throw new ExceptionInInitializerError(__bc_nsme);
        }
    }
    
    /**
    * Default null-arg constructor used to create a new BeanInfo instance
    */
    public AppTaskControlIIBeanBeanInfo()
    {
        super(controls.AppTaskControlIIBean.class);
    }
    
    /**
    * Protected constructor used if this BeanInfo class is extended.
    */
    protected AppTaskControlIIBeanBeanInfo(Class beanClass)
    {
        super(beanClass);
    }
    
    // java.beans.BeanInfo.getBeanDescriptor
    public BeanDescriptor getBeanDescriptor()
    {
        BeanDescriptor bd = new BeanDescriptor(controls.AppTaskControlIIBean.class);
        bd.setName( "AppTaskControlIIBean" );
        bd.setDisplayName( "AppTaskControlIIBean" );
        
        //
        // The org.apache.beehive.controls.runtime.bean.BeanPersistenceDelegate class
        // implements the XMLDecode delegation model for all Control JavaBean types. It
        // provides optimized XML persistance based upon the Control runtime architecture.
        // The 'persistenceDelegate' attribute of a BeanDescriptor is used by XMLEncoder to
        // locate a delegate for a particular JavaBean type.
        //
        bd.setValue("persistenceDelegate", new BeanPersistenceDelegate());
        
        return bd;
    }
    
    /**
    * Stores MethodDescriptor descriptors for this bean and its superclasses into
    * an array, starting at the specified index
    */
    protected void initMethodDescriptors(MethodDescriptor [] methodDescriptors, int index)
    throws java.beans.IntrospectionException
    {
        String [] __bc_paramNames;
        ParameterDescriptor [] __bc_paramDescriptors;
        MethodDescriptor md;
        
        //
        // Declare MethodDescriptor for getApprovalPendingStep()
        //
        __bc_paramNames = _methodParamMap.get(_getApprovalPendingStepMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_getApprovalPendingStepMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for getApplicationApprovedStep()
        //
        __bc_paramNames = _methodParamMap.get(_getApplicationApprovedStepMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_getApplicationApprovedStepMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for setApplicationCaseId(value)
        //
        __bc_paramNames = _methodParamMap.get(_setApplicationCaseIdMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_setApplicationCaseIdMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for create()
        //
        __bc_paramNames = _methodParamMap.get(_createMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_createMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for setApplicationInfo(value)
        //
        __bc_paramNames = _methodParamMap.get(_setApplicationInfoMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_setApplicationInfoMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for getApplicationCaseId()
        //
        __bc_paramNames = _methodParamMap.get(_getApplicationCaseIdMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_getApplicationCaseIdMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for getCurrentStep()
        //
        __bc_paramNames = _methodParamMap.get(_getCurrentStepMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_getCurrentStepMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for getApplicationInfo()
        //
        __bc_paramNames = _methodParamMap.get(_getApplicationInfoMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_getApplicationInfoMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for NewExternalApplication(taskName, ApplicationInfo)
        //
        __bc_paramNames = _methodParamMap.get(_NewExternalApplicationMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_NewExternalApplicationMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for getApplicationRejectedStep()
        //
        __bc_paramNames = _methodParamMap.get(_getApplicationRejectedStepMethod);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int j = 0; j < __bc_paramNames.length; j++)
        {
            __bc_paramDescriptors[j] = new ParameterDescriptor();
            __bc_paramDescriptors[j].setName(__bc_paramNames[j]);
            __bc_paramDescriptors[j].setDisplayName(__bc_paramNames[j]);
        }
        md = new MethodDescriptor(_getApplicationRejectedStepMethod, __bc_paramDescriptors);
        methodDescriptors[index++] = md;
        
        
        //
        // Add method descriptors from parent BeanInfo
        //
        super.initMethodDescriptors(methodDescriptors, index);
    }
    
    public MethodDescriptor [] getMethodDescriptors()
    {
        MethodDescriptor [] __bc_methodDescriptors = new MethodDescriptor[21];
        try
        {
            initMethodDescriptors(__bc_methodDescriptors, 0);
        }
        catch (java.beans.IntrospectionException __bc_ie)
        {
            throw new ControlException("Unable to create MethodDescriptor", __bc_ie);
        }
        return __bc_methodDescriptors;
    }
    
    /**
    * Stores PropertyDescriptor descriptors for this bean and its superclasses into
    * an array, starting at the specified index
    */
    protected void initPropertyDescriptors(PropertyDescriptor [] propDescriptors, int index)
    throws java.beans.IntrospectionException
    {
        PropertyDescriptor pd;
        
        pd = new PropertyDescriptor( "controlImplementation" , controls.AppTaskControlIIBean.class, "getControlImplementation", "setControlImplementation");
        propDescriptors[index++] = pd;
        
        //
        // add property descriptors for any getter/setters defined in control interface
        //
        pd = new PropertyDescriptor( "approvalPendingStep" , controls.AppTaskControlIIBean.class, "getApprovalPendingStep", null);
        propDescriptors[index++] = pd;
        pd = new PropertyDescriptor( "applicationInfo" , controls.AppTaskControlIIBean.class, "getApplicationInfo", "setApplicationInfo");
        propDescriptors[index++] = pd;
        pd = new PropertyDescriptor( "applicationRejectedStep" , controls.AppTaskControlIIBean.class, "getApplicationRejectedStep", null);
        propDescriptors[index++] = pd;
        pd = new PropertyDescriptor( "currentStep" , controls.AppTaskControlIIBean.class, "getCurrentStep", null);
        propDescriptors[index++] = pd;
        pd = new PropertyDescriptor( "applicationCaseId" , controls.AppTaskControlIIBean.class, "getApplicationCaseId", "setApplicationCaseId");
        propDescriptors[index++] = pd;
        pd = new PropertyDescriptor( "applicationApprovedStep" , controls.AppTaskControlIIBean.class, "getApplicationApprovedStep", null);
        propDescriptors[index++] = pd;
        
        //
        // Add property descriptors from parent BeanInfo
        //
        super.initPropertyDescriptors(propDescriptors, index);
    }
    
    // java.beans.BeanInfo.getPropertyDescriptors
    public PropertyDescriptor [] getPropertyDescriptors()
    {
        PropertyDescriptor [] __bc_propDescriptors = new PropertyDescriptor[15];
        try
        {
            initPropertyDescriptors(__bc_propDescriptors, 0);
        }
        catch (java.beans.IntrospectionException __bc_ie)
        {
            throw new ControlException("Unable to create PropertyDescriptor", __bc_ie);
        }
        return __bc_propDescriptors;
    }
    
    //
    // Adds the EventDescriptors for CustomCallback to the EventDescriptor array, starting
    // at index
    //
    protected void initCustomCallbackEvents(MethodDescriptor [] eventDescriptors, int index)
    {
        String [] __bc_paramNames;
        ParameterDescriptor [] __bc_paramDescriptors;
        MethodDescriptor md;
        
        //
        // Build a method descriptor for each event method in the event set
        //
        
        //
        // Declare MethodDescriptor for onApplicationApprovedStep(step)
        //
        __bc_paramNames = _methodParamMap.get(_CustomCallback_onApplicationApprovedStepEvent);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int k = 0; k < __bc_paramNames.length; k++)
        {
            __bc_paramDescriptors[k] = new ParameterDescriptor();
            __bc_paramDescriptors[k].setName(__bc_paramNames[k]);
            __bc_paramDescriptors[k].setDisplayName(__bc_paramNames[k]);
        }
        md = new MethodDescriptor(_CustomCallback_onApplicationApprovedStepEvent, __bc_paramDescriptors);
        eventDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for onApprovalPendingStep(step)
        //
        __bc_paramNames = _methodParamMap.get(_CustomCallback_onApprovalPendingStepEvent);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int k = 0; k < __bc_paramNames.length; k++)
        {
            __bc_paramDescriptors[k] = new ParameterDescriptor();
            __bc_paramDescriptors[k].setName(__bc_paramNames[k]);
            __bc_paramDescriptors[k].setDisplayName(__bc_paramNames[k]);
        }
        md = new MethodDescriptor(_CustomCallback_onApprovalPendingStepEvent, __bc_paramDescriptors);
        eventDescriptors[index++] = md;
        
        //
        // Declare MethodDescriptor for onApplicationRejectedStep(step)
        //
        __bc_paramNames = _methodParamMap.get(_CustomCallback_onApplicationRejectedStepEvent);
        __bc_paramDescriptors = new ParameterDescriptor[__bc_paramNames.length];
        for (int k = 0; k < __bc_paramNames.length; k++)
        {
            __bc_paramDescriptors[k] = new ParameterDescriptor();
            __bc_paramDescriptors[k].setName(__bc_paramNames[k]);
            __bc_paramDescriptors[k].setDisplayName(__bc_paramNames[k]);
        }
        md = new MethodDescriptor(_CustomCallback_onApplicationRejectedStepEvent, __bc_paramDescriptors);
        eventDescriptors[index++] = md;
        
        //
        // Add events from the parent EventSet
        //
        initCallbackEvents(eventDescriptors, index);
    }
    
    
    protected void initEventSetDescriptors(EventSetDescriptor [] eventSetDescriptors, int index)
    throws java.beans.IntrospectionException
    {
        MethodDescriptor [] __bc_eventDescriptors;
        EventSetDescriptor __bc_esd;
        Method __bc_addListener, __bc_removeListener, __bc_getListeners;
        Class __bc_eventIntf;
        
        __bc_eventIntf = controls.AppTaskControlII.CustomCallback.class;
        
        //
        // Find the add/remove listener methods
        //
        try
        {
            __bc_addListener =
            controls.AppTaskControlIIBean.class.getDeclaredMethod("addCustomCallbackListener",
            new Class [] { __bc_eventIntf });
            __bc_removeListener =
            controls.AppTaskControlIIBean.class.getDeclaredMethod("removeCustomCallbackListener",
            new Class [] { __bc_eventIntf });
            __bc_getListeners =
            controls.AppTaskControlIIBean.class.getDeclaredMethod("getCustomCallbackListeners",
            new Class [] {});
        }
        catch (NoSuchMethodException __bc_nsme)
        {
            // This is moderately lame, but there is no checked exception declared for this
            // method.  This could only happen as a result of a mismatch between bean class
            // and introspector codegen.
            throw new ControlException("Unable to locate listener method", __bc_nsme);
        }
        
        //
        // Build the MethodDescriptor array contain all event set events
        //
        __bc_eventDescriptors = new MethodDescriptor[3];
        initCustomCallbackEvents(__bc_eventDescriptors, 0);
        
        try
        {
            __bc_esd = new ControlEventSetDescriptor(localizeString("customCallback"),
            __bc_eventIntf, __bc_eventDescriptors, __bc_addListener, __bc_removeListener, __bc_getListeners);
            __bc_esd.setUnicast(false);
        }
        catch (IntrospectionException __bc_ie)
        {
            throw new ControlException("Unable to create EventDescriptor", __bc_ie);
        }
        eventSetDescriptors[index++] = __bc_esd;
        
        
        //
        // Add event set descriptors from parent BeanInfo
        //
        super.initEventSetDescriptors(eventSetDescriptors, index);
    }
    
    // java.beans.BeanInfo.getEventSetDescriptors
    public EventSetDescriptor [] getEventSetDescriptors()
    {
        EventSetDescriptor [] __bc_eventSetDescriptors = new EventSetDescriptor[2];
        try
        {
            initEventSetDescriptors(__bc_eventSetDescriptors, 0);
        }
        catch (java.beans.IntrospectionException __bc_ie)
        {
            throw new ControlException("Unable to create EventSetDescriptor", __bc_ie);
        }
        return __bc_eventSetDescriptors;
    }
}
