/*
 * IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
 * Template: Infrastructure8.2 rev3 [oneit.objstore.BusinessObjectTemplate.xsl]
 *
 *   Version: 1.0
 *   Vendor: Apache Software Foundation (Xalan XSLTC)
 *   Vendor URL: http://xml.apache.org/xalan-j
 */


    package performa.orm;

import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.objstore.assocs.*;
import oneit.objstore.attributes.*;
import oneit.objstore.rdbms.filters.*;
import oneit.objstore.parser.*;
import oneit.objstore.validator.*;
import oneit.objstore.utils.*;
import oneit.utils.*;
import oneit.utils.filter.Filter;
import oneit.utils.transform.*;
import oneit.utils.parsers.FieldException;

import performa.orm.types.*;



public abstract class BasePaymentPlan extends BaseBusinessClass
{
    // Reference instance for the object
    public static final PaymentPlan REFERENCE_PaymentPlan = new PaymentPlan ();

    // Reference instance for the object
    public static final PaymentPlan DUMMY_PaymentPlan = new DummyPaymentPlan ();

    // Static constants corresponding to field names
    
    public static final String FIELD_StripeReference = "StripeReference";
    public static final String FIELD_PlanName = "PlanName";
    public static final String FIELD_Description = "Description";
    public static final String FIELD_CurrencyType = "CurrencyType";
    public static final String FIELD_Amount = "Amount";
    public static final String FIELD_Interval = "Interval";
    public static final String FIELD_IntervalCount = "IntervalCount";
    public static final String FIELD_TrialPeriodDays = "TrialPeriodDays";
    public static final String FIELD_ActiveJobCount = "ActiveJobCount";

    // Static constants corresponding to searches
    public static final String SEARCH_All = "All";
    

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_StripeReference = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_PlanName = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_Description = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<PaymentPlan, CurrencyType> HELPER_CurrencyType =  new EnumeratedAttributeHelper<PaymentPlan, CurrencyType> (CurrencyType.FACTORY_CurrencyType);
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_Amount = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<PaymentPlan, Interval> HELPER_Interval =  new EnumeratedAttributeHelper<PaymentPlan, Interval> (Interval.FACTORY_Interval);
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_IntervalCount = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_TrialPeriodDays = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_ActiveJobCount = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private String _StripeReference;
    private String _PlanName;
    private String _Description;
    private CurrencyType _CurrencyType;
    private Double _Amount;
    private Interval _Interval;
    private Integer _IntervalCount;
    private Integer _TrialPeriodDays;
    private Integer _ActiveJobCount;
    

    // Private attributes corresponding to single references
    

    // Private attributes corresponding to multiple references
    

    // Map of maps of metadata
    private static final Map ATTRIBUTES_METADATA_PaymentPlan = new HashMap ();

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_StripeReference_Validators;
    private static final AttributeValidator[] FIELD_PlanName_Validators;
    private static final AttributeValidator[] FIELD_Description_Validators;
    private static final AttributeValidator[] FIELD_CurrencyType_Validators;
    private static final AttributeValidator[] FIELD_Amount_Validators;
    private static final AttributeValidator[] FIELD_Interval_Validators;
    private static final AttributeValidator[] FIELD_IntervalCount_Validators;
    private static final AttributeValidator[] FIELD_TrialPeriodDays_Validators;
    private static final AttributeValidator[] FIELD_ActiveJobCount_Validators;
    

    // Arrays of behaviour decorators
    private static final PaymentPlanBehaviourDecorator[] PaymentPlan_BehaviourDecorators;
    
    static
    {
        try
        {
            
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            FIELD_StripeReference_Validators = (AttributeValidator[])setupAttribMetaData_StripeReference(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_PlanName_Validators = (AttributeValidator[])setupAttribMetaData_PlanName(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Description_Validators = (AttributeValidator[])setupAttribMetaData_Description(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_CurrencyType_Validators = (AttributeValidator[])setupAttribMetaData_CurrencyType(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Amount_Validators = (AttributeValidator[])setupAttribMetaData_Amount(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Interval_Validators = (AttributeValidator[])setupAttribMetaData_Interval(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IntervalCount_Validators = (AttributeValidator[])setupAttribMetaData_IntervalCount(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_TrialPeriodDays_Validators = (AttributeValidator[])setupAttribMetaData_TrialPeriodDays(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ActiveJobCount_Validators = (AttributeValidator[])setupAttribMetaData_ActiveJobCount(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_PaymentPlan.initialiseReference ();
            DUMMY_PaymentPlan.initialiseReference ();
            PaymentPlan_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(PaymentPlan.class).toArray(new PaymentPlanBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

    
    // Meta Info setup
    private static List setupAttribMetaData_StripeReference(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "stripe_reference");
        metaInfo.put ("length", "100");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "StripeReference");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.StripeReference:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_StripeReference, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "StripeReference", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.StripeReference:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_PlanName(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "plan_name");
        metaInfo.put ("name", "PlanName");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.PlanName:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_PlanName, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "PlanName", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.PlanName:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_Description(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "description");
        metaInfo.put ("name", "Description");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.Description:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_Description, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "Description", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.Description:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_CurrencyType(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "currency_type");
        metaInfo.put ("defaultValue", "CurrencyType.AUD");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "CurrencyType");
        metaInfo.put ("type", "CurrencyType");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.CurrencyType:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_CurrencyType, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "CurrencyType", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.CurrencyType:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_Amount(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        
        metaInfo.putAll ((Map)ConfigMgr.getConfigObject ("CONFIG.SUBTYPE_ATTRIBS", "Currency", new HashMap ()));
        metaInfo.put ("dbcol", "amount");
        metaInfo.put ("Formatter", "Currency");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "Amount");
        metaInfo.put ("SubType", "Currency");
        metaInfo.put ("type", "Double");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.Amount:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_Amount, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "Amount", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.Amount:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_Interval(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "interval");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "Interval");
        metaInfo.put ("type", "Interval");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.Interval:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_Interval, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "Interval", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.Interval:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_IntervalCount(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "interval_count");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "IntervalCount");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.IntervalCount:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_IntervalCount, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "IntervalCount", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.IntervalCount:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_TrialPeriodDays(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "trial_period_days");
        metaInfo.put ("name", "TrialPeriodDays");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.TrialPeriodDays:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_TrialPeriodDays, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "TrialPeriodDays", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.TrialPeriodDays:", validators);        

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_ActiveJobCount(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "active_job_count");
        metaInfo.put ("name", "ActiveJobCount");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.ActiveJobCount:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_ActiveJobCount, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(PaymentPlan.class, "ActiveJobCount", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for PaymentPlan.ActiveJobCount:", validators);        

        return validators;
    }
    
    // END OF STATIC METADATA DEFINITION    
    
    
    
    // This constructor should not be called
    protected BasePaymentPlan ()
    {
    }


    protected BBCBehaviourDecorator[] getBehaviours()
    {
        return PaymentPlan_BehaviourDecorators;
    }
    
    


    


    // Initialise the attributes
    protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
    {
        super._initialiseNewObjAttributes (transaction);

        
        _StripeReference = (String)(HELPER_StripeReference.initialise (_StripeReference));
        _PlanName = (String)(HELPER_PlanName.initialise (_PlanName));
        _Description = (String)(HELPER_Description.initialise (_Description));
        _CurrencyType = (CurrencyType)(CurrencyType.AUD);
        _Amount = (Double)(HELPER_Amount.initialise (_Amount));
        _Interval = (Interval)(HELPER_Interval.initialise (_Interval));
        _IntervalCount = (Integer)(HELPER_IntervalCount.initialise (_IntervalCount));
        _TrialPeriodDays = (Integer)(HELPER_TrialPeriodDays.initialise (_TrialPeriodDays));
        _ActiveJobCount = (Integer)(HELPER_ActiveJobCount.initialise (_ActiveJobCount));
    }


    // Initialise the associations
    protected void _initialiseAssociations ()
    {
        super._initialiseAssociations ();

        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        
        
        return this;
    }

    

    /**
     * Get the attribute StripeReference
     */
    public String getStripeReference ()
    {
        assertValid();
        String valToReturn = _StripeReference;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getStripeReference ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preStripeReferenceChange (String newStripeReference) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postStripeReferenceChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_StripeReference ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute StripeReference.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setStripeReference (String newStripeReference) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_StripeReference.compare (_StripeReference, newStripeReference);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newStripeReference = bhd.setStripeReference ((PaymentPlan)this, newStripeReference);
                oldAndNewIdentical = HELPER_StripeReference.compare (_StripeReference, newStripeReference);
            }

            BusinessObjectParser.assertFieldCondition (newStripeReference != null, this, FIELD_StripeReference, "mandatory");
            

            if (FIELD_StripeReference_Validators.length > 0)
            {
                Object newStripeReferenceObj = HELPER_StripeReference.toObject (newStripeReference);

                if (newStripeReferenceObj != null)
                {
                    int     loopMax = FIELD_StripeReference_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_StripeReference);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_StripeReference_Validators[v].checkAttribute (this, FIELD_StripeReference, metadata, newStripeReferenceObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_StripeReference () != FieldWriteability.FALSE, "Field  StripeReference is not writeable");
            preStripeReferenceChange (newStripeReference);
            markFieldChange (FIELD_StripeReference);
            _StripeReference = newStripeReference;            
            postFieldChange (FIELD_StripeReference);
            postStripeReferenceChange ();
        }
    }

    /**
     * Get the attribute PlanName
     */
    public String getPlanName ()
    {
        assertValid();
        String valToReturn = _PlanName;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getPlanName ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void prePlanNameChange (String newPlanName) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postPlanNameChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_PlanName ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute PlanName.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setPlanName (String newPlanName) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_PlanName.compare (_PlanName, newPlanName);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newPlanName = bhd.setPlanName ((PaymentPlan)this, newPlanName);
                oldAndNewIdentical = HELPER_PlanName.compare (_PlanName, newPlanName);
            }

            

            if (FIELD_PlanName_Validators.length > 0)
            {
                Object newPlanNameObj = HELPER_PlanName.toObject (newPlanName);

                if (newPlanNameObj != null)
                {
                    int     loopMax = FIELD_PlanName_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_PlanName);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_PlanName_Validators[v].checkAttribute (this, FIELD_PlanName, metadata, newPlanNameObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_PlanName () != FieldWriteability.FALSE, "Field  PlanName is not writeable");
            prePlanNameChange (newPlanName);
            markFieldChange (FIELD_PlanName);
            _PlanName = newPlanName;            
            postFieldChange (FIELD_PlanName);
            postPlanNameChange ();
        }
    }

    /**
     * Get the attribute Description
     */
    public String getDescription ()
    {
        assertValid();
        String valToReturn = _Description;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getDescription ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preDescriptionChange (String newDescription) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postDescriptionChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_Description ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute Description.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setDescription (String newDescription) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newDescription = bhd.setDescription ((PaymentPlan)this, newDescription);
                oldAndNewIdentical = HELPER_Description.compare (_Description, newDescription);
            }

            

            if (FIELD_Description_Validators.length > 0)
            {
                Object newDescriptionObj = HELPER_Description.toObject (newDescription);

                if (newDescriptionObj != null)
                {
                    int     loopMax = FIELD_Description_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_Description);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_Description_Validators[v].checkAttribute (this, FIELD_Description, metadata, newDescriptionObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Description () != FieldWriteability.FALSE, "Field  Description is not writeable");
            preDescriptionChange (newDescription);
            markFieldChange (FIELD_Description);
            _Description = newDescription;            
            postFieldChange (FIELD_Description);
            postDescriptionChange ();
        }
    }

    /**
     * Get the attribute CurrencyType
     */
    public CurrencyType getCurrencyType ()
    {
        assertValid();
        CurrencyType valToReturn = _CurrencyType;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getCurrencyType ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preCurrencyTypeChange (CurrencyType newCurrencyType) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postCurrencyTypeChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_CurrencyType ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute CurrencyType.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setCurrencyType (CurrencyType newCurrencyType) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_CurrencyType.compare (_CurrencyType, newCurrencyType);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newCurrencyType = bhd.setCurrencyType ((PaymentPlan)this, newCurrencyType);
                oldAndNewIdentical = HELPER_CurrencyType.compare (_CurrencyType, newCurrencyType);
            }

            BusinessObjectParser.assertFieldCondition (newCurrencyType != null, this, FIELD_CurrencyType, "mandatory");
            

            if (FIELD_CurrencyType_Validators.length > 0)
            {
                Object newCurrencyTypeObj = HELPER_CurrencyType.toObject (newCurrencyType);

                if (newCurrencyTypeObj != null)
                {
                    int     loopMax = FIELD_CurrencyType_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_CurrencyType);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_CurrencyType_Validators[v].checkAttribute (this, FIELD_CurrencyType, metadata, newCurrencyTypeObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_CurrencyType () != FieldWriteability.FALSE, "Field  CurrencyType is not writeable");
            preCurrencyTypeChange (newCurrencyType);
            markFieldChange (FIELD_CurrencyType);
            _CurrencyType = newCurrencyType;            
            postFieldChange (FIELD_CurrencyType);
            postCurrencyTypeChange ();
        }
    }

    /**
     * Get the attribute Amount
     */
    public Double getAmount ()
    {
        assertValid();
        Double valToReturn = _Amount;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getAmount ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preAmountChange (Double newAmount) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postAmountChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_Amount ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute Amount.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setAmount (Double newAmount) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Amount.compare (_Amount, newAmount);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newAmount = bhd.setAmount ((PaymentPlan)this, newAmount);
                oldAndNewIdentical = HELPER_Amount.compare (_Amount, newAmount);
            }

            BusinessObjectParser.assertFieldCondition (newAmount != null, this, FIELD_Amount, "mandatory");
            

            if (FIELD_Amount_Validators.length > 0)
            {
                Object newAmountObj = HELPER_Amount.toObject (newAmount);

                if (newAmountObj != null)
                {
                    int     loopMax = FIELD_Amount_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_Amount);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_Amount_Validators[v].checkAttribute (this, FIELD_Amount, metadata, newAmountObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Amount () != FieldWriteability.FALSE, "Field  Amount is not writeable");
            preAmountChange (newAmount);
            markFieldChange (FIELD_Amount);
            _Amount = newAmount;            
            postFieldChange (FIELD_Amount);
            postAmountChange ();
        }
    }

    /**
     * Get the attribute Interval
     */
    public Interval getInterval ()
    {
        assertValid();
        Interval valToReturn = _Interval;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getInterval ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preIntervalChange (Interval newInterval) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postIntervalChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_Interval ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute Interval.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setInterval (Interval newInterval) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Interval.compare (_Interval, newInterval);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newInterval = bhd.setInterval ((PaymentPlan)this, newInterval);
                oldAndNewIdentical = HELPER_Interval.compare (_Interval, newInterval);
            }

            BusinessObjectParser.assertFieldCondition (newInterval != null, this, FIELD_Interval, "mandatory");
            

            if (FIELD_Interval_Validators.length > 0)
            {
                Object newIntervalObj = HELPER_Interval.toObject (newInterval);

                if (newIntervalObj != null)
                {
                    int     loopMax = FIELD_Interval_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_Interval);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_Interval_Validators[v].checkAttribute (this, FIELD_Interval, metadata, newIntervalObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Interval () != FieldWriteability.FALSE, "Field  Interval is not writeable");
            preIntervalChange (newInterval);
            markFieldChange (FIELD_Interval);
            _Interval = newInterval;            
            postFieldChange (FIELD_Interval);
            postIntervalChange ();
        }
    }

    /**
     * Get the attribute IntervalCount
     */
    public Integer getIntervalCount ()
    {
        assertValid();
        Integer valToReturn = _IntervalCount;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getIntervalCount ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preIntervalCountChange (Integer newIntervalCount) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postIntervalCountChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_IntervalCount ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute IntervalCount.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIntervalCount (Integer newIntervalCount) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_IntervalCount.compare (_IntervalCount, newIntervalCount);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newIntervalCount = bhd.setIntervalCount ((PaymentPlan)this, newIntervalCount);
                oldAndNewIdentical = HELPER_IntervalCount.compare (_IntervalCount, newIntervalCount);
            }

            BusinessObjectParser.assertFieldCondition (newIntervalCount != null, this, FIELD_IntervalCount, "mandatory");
            

            if (FIELD_IntervalCount_Validators.length > 0)
            {
                Object newIntervalCountObj = HELPER_IntervalCount.toObject (newIntervalCount);

                if (newIntervalCountObj != null)
                {
                    int     loopMax = FIELD_IntervalCount_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_IntervalCount);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_IntervalCount_Validators[v].checkAttribute (this, FIELD_IntervalCount, metadata, newIntervalCountObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_IntervalCount () != FieldWriteability.FALSE, "Field  IntervalCount is not writeable");
            preIntervalCountChange (newIntervalCount);
            markFieldChange (FIELD_IntervalCount);
            _IntervalCount = newIntervalCount;            
            postFieldChange (FIELD_IntervalCount);
            postIntervalCountChange ();
        }
    }

    /**
     * Get the attribute TrialPeriodDays
     */
    public Integer getTrialPeriodDays ()
    {
        assertValid();
        Integer valToReturn = _TrialPeriodDays;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getTrialPeriodDays ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preTrialPeriodDaysChange (Integer newTrialPeriodDays) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postTrialPeriodDaysChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_TrialPeriodDays ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute TrialPeriodDays.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setTrialPeriodDays (Integer newTrialPeriodDays) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_TrialPeriodDays.compare (_TrialPeriodDays, newTrialPeriodDays);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newTrialPeriodDays = bhd.setTrialPeriodDays ((PaymentPlan)this, newTrialPeriodDays);
                oldAndNewIdentical = HELPER_TrialPeriodDays.compare (_TrialPeriodDays, newTrialPeriodDays);
            }

            

            if (FIELD_TrialPeriodDays_Validators.length > 0)
            {
                Object newTrialPeriodDaysObj = HELPER_TrialPeriodDays.toObject (newTrialPeriodDays);

                if (newTrialPeriodDaysObj != null)
                {
                    int     loopMax = FIELD_TrialPeriodDays_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_TrialPeriodDays);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_TrialPeriodDays_Validators[v].checkAttribute (this, FIELD_TrialPeriodDays, metadata, newTrialPeriodDaysObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_TrialPeriodDays () != FieldWriteability.FALSE, "Field  TrialPeriodDays is not writeable");
            preTrialPeriodDaysChange (newTrialPeriodDays);
            markFieldChange (FIELD_TrialPeriodDays);
            _TrialPeriodDays = newTrialPeriodDays;            
            postFieldChange (FIELD_TrialPeriodDays);
            postTrialPeriodDaysChange ();
        }
    }

    /**
     * Get the attribute ActiveJobCount
     */
    public Integer getActiveJobCount ()
    {
        assertValid();
        Integer valToReturn = _ActiveJobCount;

            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                valToReturn = bhd.getActiveJobCount ((PaymentPlan)this, valToReturn);
            }
            
            return valToReturn;
        
    }


    /**
     * Called prior to the attribute changing.  Subclasses need not call super.  If a field exception
     * is thrown, the attribute change will fail.  The new value is different to the old value.
     */
    protected void preActiveJobCountChange (Integer newActiveJobCount) throws FieldException
    {
    }


    /**
     * Called after the attribute changes.
     * If a field exception is thrown, the value is still changed, however it 
     * may lead to the TX being rolled back
     */
    protected void postActiveJobCountChange () throws FieldException
    {
    }

    
    public FieldWriteability getWriteability_ActiveJobCount ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }

    /**
     * Set the attribute ActiveJobCount.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setActiveJobCount (Integer newActiveJobCount) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ActiveJobCount.compare (_ActiveJobCount, newActiveJobCount);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newActiveJobCount = bhd.setActiveJobCount ((PaymentPlan)this, newActiveJobCount);
                oldAndNewIdentical = HELPER_ActiveJobCount.compare (_ActiveJobCount, newActiveJobCount);
            }

            

            if (FIELD_ActiveJobCount_Validators.length > 0)
            {
                Object newActiveJobCountObj = HELPER_ActiveJobCount.toObject (newActiveJobCount);

                if (newActiveJobCountObj != null)
                {
                    int     loopMax = FIELD_ActiveJobCount_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_ActiveJobCount);

                    for (int v = 0 ; v < loopMax ; ++v)
                    {
                        FIELD_ActiveJobCount_Validators[v].checkAttribute (this, FIELD_ActiveJobCount, metadata, newActiveJobCountObj);
                    }
                }
            }
        }
        catch (FieldException e)
        {
            if (!oldAndNewIdentical)
            {
                e.setWouldModify ();
            }
            
            throw e;
        }

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ActiveJobCount () != FieldWriteability.FALSE, "Field  ActiveJobCount is not writeable");
            preActiveJobCountChange (newActiveJobCount);
            markFieldChange (FIELD_ActiveJobCount);
            _ActiveJobCount = newActiveJobCount;            
            postFieldChange (FIELD_ActiveJobCount);
            postActiveJobCountChange ();
        }
    }



    /**
     * A list of multi assoc names e.g. list of strings.
     */
    public List<String> getSingleAssocs()
    {
        List result = super.getSingleAssocs ();

        

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssocReferenceInstance (assocName);
        }
    }


    public String getSingleAssocBackReference(String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssocBackReference (assocName);
        }
    }
    
    
    public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssoc (assocName);
        }
    }


    public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssoc (assocName, getType);
        }
    }


    public Long getSingleAssocID (String assocName) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssocID (assocName);
        }
    }


    public void setSingleAssoc (String assocName, BaseBusinessClass newValue) throws StorageException, FieldException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



    /**
     * A list of multi assoc names e.g. list of strings.
     */
    public List<String> getMultiAssocs()
    {
        List result = super.getMultiAssocs ();

        

        return result;
    }


    /**
     * Get the reference instance for the multi assoc name.
     */
    public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
    {
        

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {
        

        return super.getMultiAssocBackReference(attribName);
    }


    /**
     * Get the assoc count for the multi assoc name.
     */
    public int getMultiAssocCount(String attribName) throws StorageException
    {
        

        return super.getMultiAssocCount(attribName);
    }


    /**
     * Get the assoc at a particular index
     */
    public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
    {
        

        return super.getMultiAssocAt(attribName, index);
    }


    /**
     * Add to a multi assoc by attribute name
     */
    public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
    {
        

        super.addToMultiAssoc(attribName, newElement);
    }

    /**
     * Remove from a multi assoc by attribute name
     */
    public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
    {
        

        super.removeFromMultiAssoc(attribName, oldElement);
    }


    protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
    {
        

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {
        

        return super.__isMultiAssocLoaded(attribName);
    }

    



    public void onDelete ()
    {
        try 
        {
        }
        catch (Exception e)
        {
            throw NestedException.wrap(e);
        }

        super.onDelete ();
    }


    public PaymentPlan newInstance ()
    {
        return new PaymentPlan ();
    }


    public PaymentPlan referenceInstance ()
    {
        return REFERENCE_PaymentPlan;
    }


    public PaymentPlan getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getPaymentPlanByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_PaymentPlan;
    }


    public String getBaseSetName ()
    {
        return "tl_payment_plan";
    }





    /**
     * This is where an object returns the Persistent sets that will
     * store it into the database.
     * The should be entered into allSets
     */
    public void getPersistentSets (PersistentSetCollection allSets)
    {
        ObjectStatus        myStatus = getStatus ();
        PersistentSetStatus myPSetStatus = myStatus.getPSetStatus();
        ObjectID            myID = getID();

        super.getPersistentSets (allSets);

        
        PersistentSet   tl_payment_planPSet = allSets.getPersistentSet (myID, "tl_payment_plan", myPSetStatus);

        tl_payment_planPSet.setAttrib (FIELD_ObjectID, myID);
        tl_payment_planPSet.setAttrib (FIELD_StripeReference, HELPER_StripeReference.toObject (_StripeReference)); //
        tl_payment_planPSet.setAttrib (FIELD_PlanName, HELPER_PlanName.toObject (_PlanName)); //
        tl_payment_planPSet.setAttrib (FIELD_Description, HELPER_Description.toObject (_Description)); //
        tl_payment_planPSet.setAttrib (FIELD_CurrencyType, HELPER_CurrencyType.toObject (_CurrencyType)); //
        tl_payment_planPSet.setAttrib (FIELD_Amount, HELPER_Amount.toObject (_Amount)); //
        tl_payment_planPSet.setAttrib (FIELD_Interval, HELPER_Interval.toObject (_Interval)); //
        tl_payment_planPSet.setAttrib (FIELD_IntervalCount, HELPER_IntervalCount.toObject (_IntervalCount)); //
        tl_payment_planPSet.setAttrib (FIELD_TrialPeriodDays, HELPER_TrialPeriodDays.toObject (_TrialPeriodDays)); //
        tl_payment_planPSet.setAttrib (FIELD_ActiveJobCount, HELPER_ActiveJobCount.toObject (_ActiveJobCount)); //
        
    }


    /**
     * Sets the objects state based on Persistent sets.
     */
    public void setFromPersistentSets (ObjectID objectID, PersistentSetCollection allSets)
    {
        super.setFromPersistentSets (objectID, allSets);

        
        PersistentSet   tl_payment_planPSet = allSets.getPersistentSet (objectID, "tl_payment_plan");

        _StripeReference = (String)(HELPER_StripeReference.fromObject (_StripeReference, tl_payment_planPSet.getAttrib (FIELD_StripeReference))); //
        _PlanName = (String)(HELPER_PlanName.fromObject (_PlanName, tl_payment_planPSet.getAttrib (FIELD_PlanName))); //
        _Description = (String)(HELPER_Description.fromObject (_Description, tl_payment_planPSet.getAttrib (FIELD_Description))); //
        _CurrencyType = (CurrencyType)(HELPER_CurrencyType.fromObject (_CurrencyType, tl_payment_planPSet.getAttrib (FIELD_CurrencyType))); //
        _Amount = (Double)(HELPER_Amount.fromObject (_Amount, tl_payment_planPSet.getAttrib (FIELD_Amount))); //
        _Interval = (Interval)(HELPER_Interval.fromObject (_Interval, tl_payment_planPSet.getAttrib (FIELD_Interval))); //
        _IntervalCount = (Integer)(HELPER_IntervalCount.fromObject (_IntervalCount, tl_payment_planPSet.getAttrib (FIELD_IntervalCount))); //
        _TrialPeriodDays = (Integer)(HELPER_TrialPeriodDays.fromObject (_TrialPeriodDays, tl_payment_planPSet.getAttrib (FIELD_TrialPeriodDays))); //
        _ActiveJobCount = (Integer)(HELPER_ActiveJobCount.fromObject (_ActiveJobCount, tl_payment_planPSet.getAttrib (FIELD_ActiveJobCount))); //
        
    }





    public void setAttributesFrom (BaseBusinessClass other, MultiException e)
    {
        super.setAttributesFrom (other, e);

        if (other instanceof PaymentPlan)
        {
            PaymentPlan otherPaymentPlan = (PaymentPlan)other;
            
            try
            {
                setStripeReference (otherPaymentPlan.getStripeReference ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setPlanName (otherPaymentPlan.getPlanName ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setDescription (otherPaymentPlan.getDescription ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setCurrencyType (otherPaymentPlan.getCurrencyType ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setAmount (otherPaymentPlan.getAmount ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setInterval (otherPaymentPlan.getInterval ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setIntervalCount (otherPaymentPlan.getIntervalCount ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setTrialPeriodDays (otherPaymentPlan.getTrialPeriodDays ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setActiveJobCount (otherPaymentPlan.getActiveJobCount ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
        }
    }


    /**
     * Set the attributes in this to copies of the attributes in source.
     */
    public void copyAttributesFrom (BaseBusinessClass source)
    {
        super.copyAttributesFrom (source);

        if (source instanceof BasePaymentPlan)
        {
            BasePaymentPlan sourcePaymentPlan = (BasePaymentPlan)(source);

            _StripeReference = sourcePaymentPlan._StripeReference;
            _PlanName = sourcePaymentPlan._PlanName;
            _Description = sourcePaymentPlan._Description;
            _CurrencyType = sourcePaymentPlan._CurrencyType;
            _Amount = sourcePaymentPlan._Amount;
            _Interval = sourcePaymentPlan._Interval;
            _IntervalCount = sourcePaymentPlan._IntervalCount;
            _TrialPeriodDays = sourcePaymentPlan._TrialPeriodDays;
            _ActiveJobCount = sourcePaymentPlan._ActiveJobCount;
            
        }
    }


    /**
     * Set the associations in this to copies of the attributes in source.
     */
    public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
    {
        super.copySingleAssociationsFrom (source, linkToGhosts);

        if (source instanceof BasePaymentPlan)
        {
            BasePaymentPlan sourcePaymentPlan = (BasePaymentPlan)(source);

            
        }
    }


    /**
     * Set the associations in this to copies of the attributes in source.
     */
    public void copyAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
    {
        super.copyAssociationsFrom (source, linkToGhosts);

        if (source instanceof BasePaymentPlan)
        {
            BasePaymentPlan sourcePaymentPlan = (BasePaymentPlan)(source);

            
        }
    }


    public void validate (ValidationContext context)
    {
        super.validate (context);

        
    }


    /**
     * Subclasses must override this to read in their attributes
     */
    protected void readExternalData(Map<String, Object> vals) throws IOException, ClassNotFoundException
    {
        super.readExternalData(vals);

        _StripeReference = (String)(HELPER_StripeReference.readExternal (_StripeReference, vals.get(FIELD_StripeReference))); //
        _PlanName = (String)(HELPER_PlanName.readExternal (_PlanName, vals.get(FIELD_PlanName))); //
        _Description = (String)(HELPER_Description.readExternal (_Description, vals.get(FIELD_Description))); //
        _CurrencyType = (CurrencyType)(HELPER_CurrencyType.readExternal (_CurrencyType, vals.get(FIELD_CurrencyType))); //
        _Amount = (Double)(HELPER_Amount.readExternal (_Amount, vals.get(FIELD_Amount))); //
        _Interval = (Interval)(HELPER_Interval.readExternal (_Interval, vals.get(FIELD_Interval))); //
        _IntervalCount = (Integer)(HELPER_IntervalCount.readExternal (_IntervalCount, vals.get(FIELD_IntervalCount))); //
        _TrialPeriodDays = (Integer)(HELPER_TrialPeriodDays.readExternal (_TrialPeriodDays, vals.get(FIELD_TrialPeriodDays))); //
        _ActiveJobCount = (Integer)(HELPER_ActiveJobCount.readExternal (_ActiveJobCount, vals.get(FIELD_ActiveJobCount))); //
        
    }


    /**
     * Subclasses must override this to write out their attributes
     */
    protected void writeExternalData(Map<String, Object> vals) throws IOException
    {
        super.writeExternalData(vals);

        vals.put (FIELD_StripeReference, HELPER_StripeReference.writeExternal (_StripeReference));
        vals.put (FIELD_PlanName, HELPER_PlanName.writeExternal (_PlanName));
        vals.put (FIELD_Description, HELPER_Description.writeExternal (_Description));
        vals.put (FIELD_CurrencyType, HELPER_CurrencyType.writeExternal (_CurrencyType));
        vals.put (FIELD_Amount, HELPER_Amount.writeExternal (_Amount));
        vals.put (FIELD_Interval, HELPER_Interval.writeExternal (_Interval));
        vals.put (FIELD_IntervalCount, HELPER_IntervalCount.writeExternal (_IntervalCount));
        vals.put (FIELD_TrialPeriodDays, HELPER_TrialPeriodDays.writeExternal (_TrialPeriodDays));
        vals.put (FIELD_ActiveJobCount, HELPER_ActiveJobCount.writeExternal (_ActiveJobCount));
        
    }


    public void compare (BaseBusinessClass other, AttributeChangeListener listener) throws StorageException
    {
        super.compare (other, listener);

        if (other instanceof BasePaymentPlan)
        {
            BasePaymentPlan otherPaymentPlan = (BasePaymentPlan)(other);

            
            if (!HELPER_StripeReference.compare(this._StripeReference, otherPaymentPlan._StripeReference))
            {
                listener.notifyFieldChange(this, other, FIELD_StripeReference, HELPER_StripeReference.toObject(this._StripeReference), HELPER_StripeReference.toObject(otherPaymentPlan._StripeReference));
            }
            if (!HELPER_PlanName.compare(this._PlanName, otherPaymentPlan._PlanName))
            {
                listener.notifyFieldChange(this, other, FIELD_PlanName, HELPER_PlanName.toObject(this._PlanName), HELPER_PlanName.toObject(otherPaymentPlan._PlanName));
            }
            if (!HELPER_Description.compare(this._Description, otherPaymentPlan._Description))
            {
                listener.notifyFieldChange(this, other, FIELD_Description, HELPER_Description.toObject(this._Description), HELPER_Description.toObject(otherPaymentPlan._Description));
            }
            if (!HELPER_CurrencyType.compare(this._CurrencyType, otherPaymentPlan._CurrencyType))
            {
                listener.notifyFieldChange(this, other, FIELD_CurrencyType, HELPER_CurrencyType.toObject(this._CurrencyType), HELPER_CurrencyType.toObject(otherPaymentPlan._CurrencyType));
            }
            if (!HELPER_Amount.compare(this._Amount, otherPaymentPlan._Amount))
            {
                listener.notifyFieldChange(this, other, FIELD_Amount, HELPER_Amount.toObject(this._Amount), HELPER_Amount.toObject(otherPaymentPlan._Amount));
            }
            if (!HELPER_Interval.compare(this._Interval, otherPaymentPlan._Interval))
            {
                listener.notifyFieldChange(this, other, FIELD_Interval, HELPER_Interval.toObject(this._Interval), HELPER_Interval.toObject(otherPaymentPlan._Interval));
            }
            if (!HELPER_IntervalCount.compare(this._IntervalCount, otherPaymentPlan._IntervalCount))
            {
                listener.notifyFieldChange(this, other, FIELD_IntervalCount, HELPER_IntervalCount.toObject(this._IntervalCount), HELPER_IntervalCount.toObject(otherPaymentPlan._IntervalCount));
            }
            if (!HELPER_TrialPeriodDays.compare(this._TrialPeriodDays, otherPaymentPlan._TrialPeriodDays))
            {
                listener.notifyFieldChange(this, other, FIELD_TrialPeriodDays, HELPER_TrialPeriodDays.toObject(this._TrialPeriodDays), HELPER_TrialPeriodDays.toObject(otherPaymentPlan._TrialPeriodDays));
            }
            if (!HELPER_ActiveJobCount.compare(this._ActiveJobCount, otherPaymentPlan._ActiveJobCount))
            {
                listener.notifyFieldChange(this, other, FIELD_ActiveJobCount, HELPER_ActiveJobCount.toObject(this._ActiveJobCount), HELPER_ActiveJobCount.toObject(otherPaymentPlan._ActiveJobCount));
            }

            // Compare single assocs
            

            // Compare multiple assocs
            
        }
    }


    public void visitTransients (AttributeVisitor visitor) throws StorageException
    {
        super.visitAttributes (visitor);

        
    }


    public void visitAttributes (AttributeVisitor visitor) throws StorageException
    {
        super.visitAttributes (visitor);

        visitor.visitField(this, FIELD_StripeReference, HELPER_StripeReference.toObject(getStripeReference()));
        visitor.visitField(this, FIELD_PlanName, HELPER_PlanName.toObject(getPlanName()));
        visitor.visitField(this, FIELD_Description, HELPER_Description.toObject(getDescription()));
        visitor.visitField(this, FIELD_CurrencyType, HELPER_CurrencyType.toObject(getCurrencyType()));
        visitor.visitField(this, FIELD_Amount, HELPER_Amount.toObject(getAmount()));
        visitor.visitField(this, FIELD_Interval, HELPER_Interval.toObject(getInterval()));
        visitor.visitField(this, FIELD_IntervalCount, HELPER_IntervalCount.toObject(getIntervalCount()));
        visitor.visitField(this, FIELD_TrialPeriodDays, HELPER_TrialPeriodDays.toObject(getTrialPeriodDays()));
        visitor.visitField(this, FIELD_ActiveJobCount, HELPER_ActiveJobCount.toObject(getActiveJobCount()));
        
    }


    public void visitAssociations (AssociationVisitor visitor, AssociatedScope scope) throws StorageException
    {
        super.visitAssociations (visitor, scope);

        
    }


    public static PaymentPlan createPaymentPlan (ObjectTransaction transaction) throws StorageException
    {
        PaymentPlan     result = new PaymentPlan ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static PaymentPlan getPaymentPlanByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (PaymentPlan)(transaction.getObjectByID (REFERENCE_PaymentPlan, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_StripeReference))
        {
            return filter.matches (getStripeReference ());
        }
        else if (attribName.equals (FIELD_PlanName))
        {
            return filter.matches (getPlanName ());
        }
        else if (attribName.equals (FIELD_Description))
        {
            return filter.matches (getDescription ());
        }
        else if (attribName.equals (FIELD_CurrencyType))
        {
            return filter.matches (getCurrencyType ());
        }
        else if (attribName.equals (FIELD_Amount))
        {
            return filter.matches (getAmount ());
        }
        else if (attribName.equals (FIELD_Interval))
        {
            return filter.matches (getInterval ());
        }
        else if (attribName.equals (FIELD_IntervalCount))
        {
            return filter.matches (getIntervalCount ());
        }
        else if (attribName.equals (FIELD_TrialPeriodDays))
        {
            return filter.matches (getTrialPeriodDays ());
        }
        else if (attribName.equals (FIELD_ActiveJobCount))
        {
            return filter.matches (getActiveJobCount ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


    public static SearchAll SearchByAll () { return new SearchAll (); }

    public static class SearchAll extends SearchObject<PaymentPlan>
    {
        
            public SearchAll andObjectID (QueryFilter<Long> filter)
            {
                filter.addFilter (context, "tl_payment_plan.object_id", FIELD_ObjectID);
                return this;
            }

            public SearchAll andObjectCreated (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "tl_payment_plan.object_created_date", FIELD_ObjectCreated);
                return this;
            }

            public SearchAll andObjectLastModified (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "tl_payment_plan.object_last_updated_date", FIELD_ObjectLastModified);
                return this;
            }

            
            public SearchAll andStripeReference (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_payment_plan.stripe_reference", "StripeReference");
                return this;
            }
            
            public SearchAll andPlanName (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_payment_plan.plan_name", "PlanName");
                return this;
            }
            
            public SearchAll andDescription (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_payment_plan.description", "Description");
                return this;
            }
            
            public SearchAll andCurrencyType (QueryFilter<CurrencyType> filter)
            {
                filter.addFilter (context, "tl_payment_plan.currency_type", "CurrencyType");
                return this;
            }
            
            public SearchAll andAmount (QueryFilter<Double> filter)
            {
                filter.addFilter (context, "tl_payment_plan.amount", "Amount");
                return this;
            }
            
            public SearchAll andInterval (QueryFilter<Interval> filter)
            {
                filter.addFilter (context, "tl_payment_plan.interval", "Interval");
                return this;
            }
            
            public SearchAll andIntervalCount (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_payment_plan.interval_count", "IntervalCount");
                return this;
            }
            
            public SearchAll andTrialPeriodDays (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_payment_plan.trial_period_days", "TrialPeriodDays");
                return this;
            }
            
            public SearchAll andActiveJobCount (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_payment_plan.active_job_count", "ActiveJobCount");
                return this;
            }
            
                public PaymentPlan[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_PaymentPlan, SEARCH_All, criteria);
            Set<PaymentPlan>   typedResults = new LinkedHashSet <PaymentPlan> ();
            for (BaseBusinessClass bbcResult : results)
            {
                PaymentPlan aResult = (PaymentPlan)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new PaymentPlan[0]);
                            
        }
    }

        
                public static PaymentPlan[]
             searchAll (ObjectTransaction transaction) throws StorageException
        {
            return SearchByAll ()
            .search (transaction);
        }



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_StripeReference))
        {
            return HELPER_StripeReference.toObject (getStripeReference ());
        }
        else if (attribName.equals (FIELD_PlanName))
        {
            return HELPER_PlanName.toObject (getPlanName ());
        }
        else if (attribName.equals (FIELD_Description))
        {
            return HELPER_Description.toObject (getDescription ());
        }
        else if (attribName.equals (FIELD_CurrencyType))
        {
            return HELPER_CurrencyType.toObject (getCurrencyType ());
        }
        else if (attribName.equals (FIELD_Amount))
        {
            return HELPER_Amount.toObject (getAmount ());
        }
        else if (attribName.equals (FIELD_Interval))
        {
            return HELPER_Interval.toObject (getInterval ());
        }
        else if (attribName.equals (FIELD_IntervalCount))
        {
            return HELPER_IntervalCount.toObject (getIntervalCount ());
        }
        else if (attribName.equals (FIELD_TrialPeriodDays))
        {
            return HELPER_TrialPeriodDays.toObject (getTrialPeriodDays ());
        }
        else if (attribName.equals (FIELD_ActiveJobCount))
        {
            return HELPER_ActiveJobCount.toObject (getActiveJobCount ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_StripeReference))
        {
            return HELPER_StripeReference;
        }
        else if (attribName.equals (FIELD_PlanName))
        {
            return HELPER_PlanName;
        }
        else if (attribName.equals (FIELD_Description))
        {
            return HELPER_Description;
        }
        else if (attribName.equals (FIELD_CurrencyType))
        {
            return HELPER_CurrencyType;
        }
        else if (attribName.equals (FIELD_Amount))
        {
            return HELPER_Amount;
        }
        else if (attribName.equals (FIELD_Interval))
        {
            return HELPER_Interval;
        }
        else if (attribName.equals (FIELD_IntervalCount))
        {
            return HELPER_IntervalCount;
        }
        else if (attribName.equals (FIELD_TrialPeriodDays))
        {
            return HELPER_TrialPeriodDays;
        }
        else if (attribName.equals (FIELD_ActiveJobCount))
        {
            return HELPER_ActiveJobCount;
        }
        else
        {
            return super.getAttributeHelper (attribName);
        }
    }


    public void setAttribute (String attribName, Object attribValue) throws FieldException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_StripeReference))
        {
            setStripeReference ((String)(HELPER_StripeReference.fromObject (_StripeReference, attribValue)));            
        }
        else if (attribName.equals (FIELD_PlanName))
        {
            setPlanName ((String)(HELPER_PlanName.fromObject (_PlanName, attribValue)));            
        }
        else if (attribName.equals (FIELD_Description))
        {
            setDescription ((String)(HELPER_Description.fromObject (_Description, attribValue)));            
        }
        else if (attribName.equals (FIELD_CurrencyType))
        {
            setCurrencyType ((CurrencyType)(HELPER_CurrencyType.fromObject (_CurrencyType, attribValue)));            
        }
        else if (attribName.equals (FIELD_Amount))
        {
            setAmount ((Double)(HELPER_Amount.fromObject (_Amount, attribValue)));            
        }
        else if (attribName.equals (FIELD_Interval))
        {
            setInterval ((Interval)(HELPER_Interval.fromObject (_Interval, attribValue)));            
        }
        else if (attribName.equals (FIELD_IntervalCount))
        {
            setIntervalCount ((Integer)(HELPER_IntervalCount.fromObject (_IntervalCount, attribValue)));            
        }
        else if (attribName.equals (FIELD_TrialPeriodDays))
        {
            setTrialPeriodDays ((Integer)(HELPER_TrialPeriodDays.fromObject (_TrialPeriodDays, attribValue)));            
        }
        else if (attribName.equals (FIELD_ActiveJobCount))
        {
            setActiveJobCount ((Integer)(HELPER_ActiveJobCount.fromObject (_ActiveJobCount, attribValue)));            
        }
        else
        {
            super.setAttribute (attribName, attribValue);
        }
    }



    public boolean isWriteable (String fieldName)
    {
        return getWriteable (fieldName) == FieldWriteability.TRUE;
    }


    public FieldWriteability getWriteable (String fieldName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (fieldName.equals (FIELD_StripeReference))
        {
            return getWriteability_StripeReference ();
        }
        else if (fieldName.equals (FIELD_PlanName))
        {
            return getWriteability_PlanName ();
        }
        else if (fieldName.equals (FIELD_Description))
        {
            return getWriteability_Description ();
        }
        else if (fieldName.equals (FIELD_CurrencyType))
        {
            return getWriteability_CurrencyType ();
        }
        else if (fieldName.equals (FIELD_Amount))
        {
            return getWriteability_Amount ();
        }
        else if (fieldName.equals (FIELD_Interval))
        {
            return getWriteability_Interval ();
        }
        else if (fieldName.equals (FIELD_IntervalCount))
        {
            return getWriteability_IntervalCount ();
        }
        else if (fieldName.equals (FIELD_TrialPeriodDays))
        {
            return getWriteability_TrialPeriodDays ();
        }
        else if (fieldName.equals (FIELD_ActiveJobCount))
        {
            return getWriteability_ActiveJobCount ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_StripeReference () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_StripeReference);
            }
        
            if (getWriteability_PlanName () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_PlanName);
            }
        
            if (getWriteability_Description () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Description);
            }
        
            if (getWriteability_CurrencyType () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_CurrencyType);
            }
        
            if (getWriteability_Amount () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Amount);
            }
        
            if (getWriteability_Interval () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Interval);
            }
        
            if (getWriteability_IntervalCount () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IntervalCount);
            }
        
            if (getWriteability_TrialPeriodDays () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_TrialPeriodDays);
            }
        
            if (getWriteability_ActiveJobCount () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ActiveJobCount);
            }
        

        super.putUnwriteable (fields);
    }

    public List<AbstractAttribute> getAttributes ()
    {
        List result = super.getAttributes ();

        
        result.add(HELPER_StripeReference.getAttribObject (getClass (), _StripeReference, true, FIELD_StripeReference));
        result.add(HELPER_PlanName.getAttribObject (getClass (), _PlanName, false, FIELD_PlanName));
        result.add(HELPER_Description.getAttribObject (getClass (), _Description, false, FIELD_Description));
        result.add(HELPER_CurrencyType.getAttribObject (getClass (), _CurrencyType, true, FIELD_CurrencyType));
        result.add(HELPER_Amount.getAttribObject (getClass (), _Amount, true, FIELD_Amount));
        result.add(HELPER_Interval.getAttribObject (getClass (), _Interval, true, FIELD_Interval));
        result.add(HELPER_IntervalCount.getAttribObject (getClass (), _IntervalCount, true, FIELD_IntervalCount));
        result.add(HELPER_TrialPeriodDays.getAttribObject (getClass (), _TrialPeriodDays, false, FIELD_TrialPeriodDays));
        result.add(HELPER_ActiveJobCount.getAttribObject (getClass (), _ActiveJobCount, false, FIELD_ActiveJobCount));

        return result;
    }


    public Map getAttributeMetadata (String attribute)
    {
        if (ATTRIBUTES_METADATA_PaymentPlan.containsKey (attribute))
        {
            return (Map)ATTRIBUTES_METADATA_PaymentPlan.get (attribute);
        }
        else
        {
            return super.getAttributeMetadata (attribute);
        }
    }


    public Object getAttributeMetadata (String attribute, String metadata)
    {
        if (ATTRIBUTES_METADATA_PaymentPlan.containsKey (attribute))
        {
            return ((Map)ATTRIBUTES_METADATA_PaymentPlan.get (attribute)).get(metadata);
        }
        else
        {
            return super.getAttributeMetadata (attribute, metadata);
        }
    }

    public void preCommit (boolean willBeStored) throws Exception
    {
        super.preCommit(willBeStored);
        
        if(willBeStored)
        {
        
        }
    }

    public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
    {
        
        
        return super.getBinaryContentHandler(attribName);
    }

    public static class PaymentPlanBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<PaymentPlan>
    {

    /**
     * Get the attribute StripeReference
     */
    public String getStripeReference (PaymentPlan obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute StripeReference.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setStripeReference (PaymentPlan obj, String newStripeReference) throws FieldException
    {
        return newStripeReference;
    }

    /**
     * Get the attribute PlanName
     */
    public String getPlanName (PaymentPlan obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute PlanName.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setPlanName (PaymentPlan obj, String newPlanName) throws FieldException
    {
        return newPlanName;
    }

    /**
     * Get the attribute Description
     */
    public String getDescription (PaymentPlan obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Description.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setDescription (PaymentPlan obj, String newDescription) throws FieldException
    {
        return newDescription;
    }

    /**
     * Get the attribute CurrencyType
     */
    public CurrencyType getCurrencyType (PaymentPlan obj, CurrencyType original)
    {
        return original;
    }

    /**
     * Change the value set for attribute CurrencyType.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public CurrencyType setCurrencyType (PaymentPlan obj, CurrencyType newCurrencyType) throws FieldException
    {
        return newCurrencyType;
    }

    /**
     * Get the attribute Amount
     */
    public Double getAmount (PaymentPlan obj, Double original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Amount.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Double setAmount (PaymentPlan obj, Double newAmount) throws FieldException
    {
        return newAmount;
    }

    /**
     * Get the attribute Interval
     */
    public Interval getInterval (PaymentPlan obj, Interval original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Interval.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Interval setInterval (PaymentPlan obj, Interval newInterval) throws FieldException
    {
        return newInterval;
    }

    /**
     * Get the attribute IntervalCount
     */
    public Integer getIntervalCount (PaymentPlan obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IntervalCount.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setIntervalCount (PaymentPlan obj, Integer newIntervalCount) throws FieldException
    {
        return newIntervalCount;
    }

    /**
     * Get the attribute TrialPeriodDays
     */
    public Integer getTrialPeriodDays (PaymentPlan obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute TrialPeriodDays.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setTrialPeriodDays (PaymentPlan obj, Integer newTrialPeriodDays) throws FieldException
    {
        return newTrialPeriodDays;
    }

    /**
     * Get the attribute ActiveJobCount
     */
    public Integer getActiveJobCount (PaymentPlan obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ActiveJobCount.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setActiveJobCount (PaymentPlan obj, Integer newActiveJobCount) throws FieldException
    {
        return newActiveJobCount;
    }

    }

    
    public ORMPipeLine pipes()
    {
        return new PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> ((PaymentPlan)this);
    }
      
    /**
     * Use this instead of pipes() to get rid of type casting.
     */  
    public PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> pipelinePaymentPlan()
    {
        return (PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan>) pipes();
    }
    
    public static PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> pipesPaymentPlan(Collection<PaymentPlan> items)
    {
        return REFERENCE_PaymentPlan.new PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> (items);
    }
    
    public static PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> pipesPaymentPlan(PaymentPlan[] _items)
    {
        return pipesPaymentPlan(Arrays.asList (_items));
    }
    
    public static PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> pipesPaymentPlan()
    {
        return pipesPaymentPlan((Collection)null);
    }
    
    
    public class PaymentPlanPipeLineFactory<From extends BaseBusinessClass, Me extends PaymentPlan> extends BaseBusinessClass.ORMPipeLine<From, Me>    
    {
        public <Prev> PaymentPlanPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public PaymentPlanPipeLineFactory (From seed)
        {
            super(seed);
        }

        public PaymentPlanPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("StripeReference"))
            {
                return toStripeReference ();
            }                
            if (name.equals ("PlanName"))
            {
                return toPlanName ();
            }                
            if (name.equals ("Description"))
            {
                return toDescription ();
            }                
            if (name.equals ("CurrencyType"))
            {
                return toCurrencyType ();
            }                
            if (name.equals ("Amount"))
            {
                return toAmount ();
            }                
            if (name.equals ("Interval"))
            {
                return toInterval ();
            }                
            if (name.equals ("IntervalCount"))
            {
                return toIntervalCount ();
            }                
            if (name.equals ("TrialPeriodDays"))
            {
                return toTrialPeriodDays ();
            }                
            if (name.equals ("ActiveJobCount"))
            {
                return toActiveJobCount ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, String> toStripeReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_StripeReference));  }
        
        public PipeLine<From, String> toPlanName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_PlanName));  }
        
        public PipeLine<From, String> toDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Description));  }
        
        public PipeLine<From, CurrencyType> toCurrencyType () { return pipe(new ORMAttributePipe<Me, CurrencyType>(FIELD_CurrencyType));  }
        
        public PipeLine<From, Double> toAmount () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_Amount));  }
        
        public PipeLine<From, Interval> toInterval () { return pipe(new ORMAttributePipe<Me, Interval>(FIELD_Interval));  }
        
        public PipeLine<From, Integer> toIntervalCount () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_IntervalCount));  }
        
        public PipeLine<From, Integer> toTrialPeriodDays () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_TrialPeriodDays));  }
        
        public PipeLine<From, Integer> toActiveJobCount () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_ActiveJobCount));  }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

class DummyPaymentPlan extends PaymentPlan
{
    // Default constructor primarily to support Externalisable
    public DummyPaymentPlan()
    {
        super();
    }

    public void assertValid ()
    {
    }


}

    
