/*
 * IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
 * Template: Infrastructure9.0 [oneit.objstore.BusinessObjectTemplate.xsl]
 *   Vendor: Apache Software Foundation (Xalan XSLTC) (Version: 1.0)
 */

    
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";
    public static final String FIELD_Disabled = "Disabled";
    public static final String FIELD_ProductReference = "ProductReference";
    public static final String FIELD_UsageType = "UsageType";
    public static final String FIELD_LinkedPlanReference = "LinkedPlanReference";

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

    // 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 static final DefaultAttributeHelper<PaymentPlan> HELPER_Disabled = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_ProductReference = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<PaymentPlan, UsageType> HELPER_UsageType =  new EnumeratedAttributeHelper<PaymentPlan, UsageType> (UsageType.FACTORY_UsageType);
    private static final DefaultAttributeHelper<PaymentPlan> HELPER_LinkedPlanReference = 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 Boolean _Disabled;
    private String _ProductReference;
    private UsageType _UsageType;
    private String _LinkedPlanReference;
    

    // 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 LinkedHashMap ();

    // 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;
    private static final AttributeValidator[] FIELD_Disabled_Validators;
    private static final AttributeValidator[] FIELD_ProductReference_Validators;
    private static final AttributeValidator[] FIELD_UsageType_Validators;
    private static final AttributeValidator[] FIELD_LinkedPlanReference_Validators;
    

    // Arrays of AttributeDecorators for each attribute
    private static final AttributeDecorator<PaymentPlan, String>[] FIELD_StripeReference_Decorators;
    private static final AttributeDecorator<PaymentPlan, String>[] FIELD_PlanName_Decorators;
    private static final AttributeDecorator<PaymentPlan, String>[] FIELD_Description_Decorators;
    private static final AttributeDecorator<PaymentPlan, CurrencyType>[] FIELD_CurrencyType_Decorators;
    private static final AttributeDecorator<PaymentPlan, Double>[] FIELD_Amount_Decorators;
    private static final AttributeDecorator<PaymentPlan, Interval>[] FIELD_Interval_Decorators;
    private static final AttributeDecorator<PaymentPlan, Integer>[] FIELD_IntervalCount_Decorators;
    private static final AttributeDecorator<PaymentPlan, Integer>[] FIELD_TrialPeriodDays_Decorators;
    private static final AttributeDecorator<PaymentPlan, Integer>[] FIELD_ActiveJobCount_Decorators;
    private static final AttributeDecorator<PaymentPlan, Boolean>[] FIELD_Disabled_Decorators;
    private static final AttributeDecorator<PaymentPlan, String>[] FIELD_ProductReference_Decorators;
    private static final AttributeDecorator<PaymentPlan, UsageType>[] FIELD_UsageType_Decorators;
    private static final AttributeDecorator<PaymentPlan, String>[] FIELD_LinkedPlanReference_Decorators;
    
    
    // Arrays of SingleAssocDecorators for each attribute
    
    
    // Arrays of MultiAssocDecorators for each attribute
    

    // 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]);
            FIELD_Disabled_Validators = (AttributeValidator[])setupAttribMetaData_Disabled(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ProductReference_Validators = (AttributeValidator[])setupAttribMetaData_ProductReference(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_UsageType_Validators = (AttributeValidator[])setupAttribMetaData_UsageType(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_LinkedPlanReference_Validators = (AttributeValidator[])setupAttribMetaData_LinkedPlanReference(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_StripeReference_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_StripeReference).toArray (new AttributeDecorator[0]);
            FIELD_PlanName_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_PlanName).toArray (new AttributeDecorator[0]);
            FIELD_Description_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_Description).toArray (new AttributeDecorator[0]);
            FIELD_CurrencyType_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_CurrencyType).toArray (new AttributeDecorator[0]);
            FIELD_Amount_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_Amount).toArray (new AttributeDecorator[0]);
            FIELD_Interval_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_Interval).toArray (new AttributeDecorator[0]);
            FIELD_IntervalCount_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_IntervalCount).toArray (new AttributeDecorator[0]);
            FIELD_TrialPeriodDays_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_TrialPeriodDays).toArray (new AttributeDecorator[0]);
            FIELD_ActiveJobCount_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_ActiveJobCount).toArray (new AttributeDecorator[0]);
            FIELD_Disabled_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_Disabled).toArray (new AttributeDecorator[0]);
            FIELD_ProductReference_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_ProductReference).toArray (new AttributeDecorator[0]);
            FIELD_UsageType_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_UsageType).toArray (new AttributeDecorator[0]);
            FIELD_LinkedPlanReference_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_PaymentPlan, FIELD_LinkedPlanReference).toArray (new AttributeDecorator[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;
        }
    }

    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    private static List setupAttribMetaData_PlanName(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "plan_name");
        metaInfo.put ("name", "PlanName");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    private static List setupAttribMetaData_Description(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "description");
        metaInfo.put ("name", "Description");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        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;
    }
    
    private static List setupAttribMetaData_Disabled(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "disabled");
        metaInfo.put ("name", "Disabled");
        metaInfo.put ("type", "Boolean");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.Disabled:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_Disabled, Collections.unmodifiableMap (metaInfo));

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

        return validators;
    }
    
    private static List setupAttribMetaData_ProductReference(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "product_reference");
        metaInfo.put ("length", "100");
        metaInfo.put ("name", "ProductReference");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.ProductReference:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_ProductReference, Collections.unmodifiableMap (metaInfo));

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

        return validators;
    }
    
    private static List setupAttribMetaData_UsageType(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "usage_type");
        metaInfo.put ("name", "UsageType");
        metaInfo.put ("type", "UsageType");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.UsageType:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_UsageType, Collections.unmodifiableMap (metaInfo));

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

        return validators;
    }
    
    private static List setupAttribMetaData_LinkedPlanReference(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "linked_plan");
        metaInfo.put ("length", "100");
        metaInfo.put ("name", "LinkedPlanReference");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_payment_plan");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for PaymentPlan.LinkedPlanReference:", metaInfo);
        ATTRIBUTES_METADATA_PaymentPlan.put (FIELD_LinkedPlanReference, Collections.unmodifiableMap (metaInfo));

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

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


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

    


    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));
        _Disabled = (Boolean)(HELPER_Disabled.initialise (_Disabled));
        _ProductReference = (String)(HELPER_ProductReference.initialise (_ProductReference));
        _UsageType = (UsageType)(HELPER_UsageType.initialise (_UsageType));
        _LinkedPlanReference = (String)(HELPER_LinkedPlanReference.initialise (_LinkedPlanReference));
    }


    protected void _initialiseAssociations ()
    {
        super._initialiseAssociations ();

        
    }


    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        
        
        return this;
    }


    /**
     * Attribute StripeReference
     */
    public String getStripeReference ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_StripeReference_Decorators, (PaymentPlan)this, FIELD_StripeReference, _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
    {
        newStripeReference = AttributeDecoratorUtils.setValue (FIELD_StripeReference_Decorators, (PaymentPlan)this, FIELD_StripeReference, newStripeReference);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_StripeReference_Decorators, (PaymentPlan)this, FIELD_StripeReference ,getWriteability_StripeReference ()) != FieldWriteability.FALSE, "Field  StripeReference is not writeable");
            preStripeReferenceChange (newStripeReference);
            markFieldChange (FIELD_StripeReference);
            _StripeReference = newStripeReference;            
            postFieldChange (FIELD_StripeReference);
            postStripeReferenceChange ();
        }
    }

    /**
     * Attribute PlanName
     */
    public String getPlanName ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_PlanName_Decorators, (PaymentPlan)this, FIELD_PlanName, _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
    {
        newPlanName = AttributeDecoratorUtils.setValue (FIELD_PlanName_Decorators, (PaymentPlan)this, FIELD_PlanName, newPlanName);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_PlanName_Decorators, (PaymentPlan)this, FIELD_PlanName ,getWriteability_PlanName ()) != FieldWriteability.FALSE, "Field  PlanName is not writeable");
            prePlanNameChange (newPlanName);
            markFieldChange (FIELD_PlanName);
            _PlanName = newPlanName;            
            postFieldChange (FIELD_PlanName);
            postPlanNameChange ();
        }
    }

    /**
     * Attribute Description
     */
    public String getDescription ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Description_Decorators, (PaymentPlan)this, FIELD_Description, _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
    {
        newDescription = AttributeDecoratorUtils.setValue (FIELD_Description_Decorators, (PaymentPlan)this, FIELD_Description, newDescription);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Description_Decorators, (PaymentPlan)this, FIELD_Description ,getWriteability_Description ()) != FieldWriteability.FALSE, "Field  Description is not writeable");
            preDescriptionChange (newDescription);
            markFieldChange (FIELD_Description);
            _Description = newDescription;            
            postFieldChange (FIELD_Description);
            postDescriptionChange ();
        }
    }

    /**
     * Attribute CurrencyType
     */
    public CurrencyType getCurrencyType ()
    {
        assertValid();
        CurrencyType valToReturn = AttributeDecoratorUtils.getValue (FIELD_CurrencyType_Decorators, (PaymentPlan)this, FIELD_CurrencyType, _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
    {
        newCurrencyType = AttributeDecoratorUtils.setValue (FIELD_CurrencyType_Decorators, (PaymentPlan)this, FIELD_CurrencyType, newCurrencyType);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_CurrencyType_Decorators, (PaymentPlan)this, FIELD_CurrencyType ,getWriteability_CurrencyType ()) != FieldWriteability.FALSE, "Field  CurrencyType is not writeable");
            preCurrencyTypeChange (newCurrencyType);
            markFieldChange (FIELD_CurrencyType);
            _CurrencyType = newCurrencyType;            
            postFieldChange (FIELD_CurrencyType);
            postCurrencyTypeChange ();
        }
    }

    /**
     * Attribute Amount
     */
    public Double getAmount ()
    {
        assertValid();
        Double valToReturn = AttributeDecoratorUtils.getValue (FIELD_Amount_Decorators, (PaymentPlan)this, FIELD_Amount, _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
    {
        newAmount = AttributeDecoratorUtils.setValue (FIELD_Amount_Decorators, (PaymentPlan)this, FIELD_Amount, newAmount);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Amount_Decorators, (PaymentPlan)this, FIELD_Amount ,getWriteability_Amount ()) != FieldWriteability.FALSE, "Field  Amount is not writeable");
            preAmountChange (newAmount);
            markFieldChange (FIELD_Amount);
            _Amount = newAmount;            
            postFieldChange (FIELD_Amount);
            postAmountChange ();
        }
    }

    /**
     * Attribute Interval
     */
    public Interval getInterval ()
    {
        assertValid();
        Interval valToReturn = AttributeDecoratorUtils.getValue (FIELD_Interval_Decorators, (PaymentPlan)this, FIELD_Interval, _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
    {
        newInterval = AttributeDecoratorUtils.setValue (FIELD_Interval_Decorators, (PaymentPlan)this, FIELD_Interval, newInterval);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Interval_Decorators, (PaymentPlan)this, FIELD_Interval ,getWriteability_Interval ()) != FieldWriteability.FALSE, "Field  Interval is not writeable");
            preIntervalChange (newInterval);
            markFieldChange (FIELD_Interval);
            _Interval = newInterval;            
            postFieldChange (FIELD_Interval);
            postIntervalChange ();
        }
    }

    /**
     * Attribute IntervalCount
     */
    public Integer getIntervalCount ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_IntervalCount_Decorators, (PaymentPlan)this, FIELD_IntervalCount, _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
    {
        newIntervalCount = AttributeDecoratorUtils.setValue (FIELD_IntervalCount_Decorators, (PaymentPlan)this, FIELD_IntervalCount, newIntervalCount);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_IntervalCount_Decorators, (PaymentPlan)this, FIELD_IntervalCount ,getWriteability_IntervalCount ()) != FieldWriteability.FALSE, "Field  IntervalCount is not writeable");
            preIntervalCountChange (newIntervalCount);
            markFieldChange (FIELD_IntervalCount);
            _IntervalCount = newIntervalCount;            
            postFieldChange (FIELD_IntervalCount);
            postIntervalCountChange ();
        }
    }

    /**
     * Attribute TrialPeriodDays
     */
    public Integer getTrialPeriodDays ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_TrialPeriodDays_Decorators, (PaymentPlan)this, FIELD_TrialPeriodDays, _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
    {
        newTrialPeriodDays = AttributeDecoratorUtils.setValue (FIELD_TrialPeriodDays_Decorators, (PaymentPlan)this, FIELD_TrialPeriodDays, newTrialPeriodDays);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_TrialPeriodDays_Decorators, (PaymentPlan)this, FIELD_TrialPeriodDays ,getWriteability_TrialPeriodDays ()) != FieldWriteability.FALSE, "Field  TrialPeriodDays is not writeable");
            preTrialPeriodDaysChange (newTrialPeriodDays);
            markFieldChange (FIELD_TrialPeriodDays);
            _TrialPeriodDays = newTrialPeriodDays;            
            postFieldChange (FIELD_TrialPeriodDays);
            postTrialPeriodDaysChange ();
        }
    }

    /**
     * Attribute ActiveJobCount
     */
    public Integer getActiveJobCount ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_ActiveJobCount_Decorators, (PaymentPlan)this, FIELD_ActiveJobCount, _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
    {
        newActiveJobCount = AttributeDecoratorUtils.setValue (FIELD_ActiveJobCount_Decorators, (PaymentPlan)this, FIELD_ActiveJobCount, newActiveJobCount);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_ActiveJobCount_Decorators, (PaymentPlan)this, FIELD_ActiveJobCount ,getWriteability_ActiveJobCount ()) != FieldWriteability.FALSE, "Field  ActiveJobCount is not writeable");
            preActiveJobCountChange (newActiveJobCount);
            markFieldChange (FIELD_ActiveJobCount);
            _ActiveJobCount = newActiveJobCount;            
            postFieldChange (FIELD_ActiveJobCount);
            postActiveJobCountChange ();
        }
    }

    /**
     * Attribute Disabled
     */
    public Boolean getDisabled ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_Disabled_Decorators, (PaymentPlan)this, FIELD_Disabled, _Disabled);

        
        for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
        {
            valToReturn = bhd.getDisabled ((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 preDisabledChange (Boolean newDisabled) 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 postDisabledChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Disabled.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setDisabled (Boolean newDisabled) throws FieldException
    {
        newDisabled = AttributeDecoratorUtils.setValue (FIELD_Disabled_Decorators, (PaymentPlan)this, FIELD_Disabled, newDisabled);

        boolean oldAndNewIdentical = HELPER_Disabled.compare (_Disabled, newDisabled);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newDisabled = bhd.setDisabled ((PaymentPlan)this, newDisabled);
                oldAndNewIdentical = HELPER_Disabled.compare (_Disabled, newDisabled);
            }

            

            if (FIELD_Disabled_Validators.length > 0)
            {
                Object newDisabledObj = HELPER_Disabled.toObject (newDisabled);

                if (newDisabledObj != null)
                {
                    int     loopMax = FIELD_Disabled_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_Disabled);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_Disabled_Decorators, (PaymentPlan)this, FIELD_Disabled ,getWriteability_Disabled ()) != FieldWriteability.FALSE, "Field  Disabled is not writeable");
            preDisabledChange (newDisabled);
            markFieldChange (FIELD_Disabled);
            _Disabled = newDisabled;            
            postFieldChange (FIELD_Disabled);
            postDisabledChange ();
        }
    }

    /**
     * Attribute ProductReference
     */
    public String getProductReference ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_ProductReference_Decorators, (PaymentPlan)this, FIELD_ProductReference, _ProductReference);

        
        for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
        {
            valToReturn = bhd.getProductReference ((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 preProductReferenceChange (String newProductReference) 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 postProductReferenceChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ProductReference.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setProductReference (String newProductReference) throws FieldException
    {
        newProductReference = AttributeDecoratorUtils.setValue (FIELD_ProductReference_Decorators, (PaymentPlan)this, FIELD_ProductReference, newProductReference);

        boolean oldAndNewIdentical = HELPER_ProductReference.compare (_ProductReference, newProductReference);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newProductReference = bhd.setProductReference ((PaymentPlan)this, newProductReference);
                oldAndNewIdentical = HELPER_ProductReference.compare (_ProductReference, newProductReference);
            }

            

            if (FIELD_ProductReference_Validators.length > 0)
            {
                Object newProductReferenceObj = HELPER_ProductReference.toObject (newProductReference);

                if (newProductReferenceObj != null)
                {
                    int     loopMax = FIELD_ProductReference_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_ProductReference);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_ProductReference_Decorators, (PaymentPlan)this, FIELD_ProductReference ,getWriteability_ProductReference ()) != FieldWriteability.FALSE, "Field  ProductReference is not writeable");
            preProductReferenceChange (newProductReference);
            markFieldChange (FIELD_ProductReference);
            _ProductReference = newProductReference;            
            postFieldChange (FIELD_ProductReference);
            postProductReferenceChange ();
        }
    }

    /**
     * Attribute UsageType
     */
    public UsageType getUsageType ()
    {
        assertValid();
        UsageType valToReturn = AttributeDecoratorUtils.getValue (FIELD_UsageType_Decorators, (PaymentPlan)this, FIELD_UsageType, _UsageType);

        
        for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
        {
            valToReturn = bhd.getUsageType ((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 preUsageTypeChange (UsageType newUsageType) 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 postUsageTypeChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute UsageType.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setUsageType (UsageType newUsageType) throws FieldException
    {
        newUsageType = AttributeDecoratorUtils.setValue (FIELD_UsageType_Decorators, (PaymentPlan)this, FIELD_UsageType, newUsageType);

        boolean oldAndNewIdentical = HELPER_UsageType.compare (_UsageType, newUsageType);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newUsageType = bhd.setUsageType ((PaymentPlan)this, newUsageType);
                oldAndNewIdentical = HELPER_UsageType.compare (_UsageType, newUsageType);
            }

            

            if (FIELD_UsageType_Validators.length > 0)
            {
                Object newUsageTypeObj = HELPER_UsageType.toObject (newUsageType);

                if (newUsageTypeObj != null)
                {
                    int     loopMax = FIELD_UsageType_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_UsageType);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_UsageType_Decorators, (PaymentPlan)this, FIELD_UsageType ,getWriteability_UsageType ()) != FieldWriteability.FALSE, "Field  UsageType is not writeable");
            preUsageTypeChange (newUsageType);
            markFieldChange (FIELD_UsageType);
            _UsageType = newUsageType;            
            postFieldChange (FIELD_UsageType);
            postUsageTypeChange ();
        }
    }

    /**
     * Attribute LinkedPlanReference
     */
    public String getLinkedPlanReference ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_LinkedPlanReference_Decorators, (PaymentPlan)this, FIELD_LinkedPlanReference, _LinkedPlanReference);

        
        for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
        {
            valToReturn = bhd.getLinkedPlanReference ((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 preLinkedPlanReferenceChange (String newLinkedPlanReference) 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 postLinkedPlanReferenceChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute LinkedPlanReference.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setLinkedPlanReference (String newLinkedPlanReference) throws FieldException
    {
        newLinkedPlanReference = AttributeDecoratorUtils.setValue (FIELD_LinkedPlanReference_Decorators, (PaymentPlan)this, FIELD_LinkedPlanReference, newLinkedPlanReference);

        boolean oldAndNewIdentical = HELPER_LinkedPlanReference.compare (_LinkedPlanReference, newLinkedPlanReference);
        
        try
        {
            for (PaymentPlanBehaviourDecorator bhd : PaymentPlan_BehaviourDecorators)
            {
                newLinkedPlanReference = bhd.setLinkedPlanReference ((PaymentPlan)this, newLinkedPlanReference);
                oldAndNewIdentical = HELPER_LinkedPlanReference.compare (_LinkedPlanReference, newLinkedPlanReference);
            }

            

            if (FIELD_LinkedPlanReference_Validators.length > 0)
            {
                Object newLinkedPlanReferenceObj = HELPER_LinkedPlanReference.toObject (newLinkedPlanReference);

                if (newLinkedPlanReferenceObj != null)
                {
                    int     loopMax = FIELD_LinkedPlanReference_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_PaymentPlan.get (FIELD_LinkedPlanReference);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_LinkedPlanReference_Decorators, (PaymentPlan)this, FIELD_LinkedPlanReference ,getWriteability_LinkedPlanReference ()) != FieldWriteability.FALSE, "Field  LinkedPlanReference is not writeable");
            preLinkedPlanReferenceChange (newLinkedPlanReference);
            markFieldChange (FIELD_LinkedPlanReference);
            _LinkedPlanReference = newLinkedPlanReference;            
            postFieldChange (FIELD_LinkedPlanReference);
            postLinkedPlanReferenceChange ();
        }
    }



    /**
     * 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)); //
        tl_payment_planPSet.setAttrib (FIELD_Disabled, HELPER_Disabled.toObject (_Disabled)); //
        tl_payment_planPSet.setAttrib (FIELD_ProductReference, HELPER_ProductReference.toObject (_ProductReference)); //
        tl_payment_planPSet.setAttrib (FIELD_UsageType, HELPER_UsageType.toObject (_UsageType)); //
        tl_payment_planPSet.setAttrib (FIELD_LinkedPlanReference, HELPER_LinkedPlanReference.toObject (_LinkedPlanReference)); //
        
    }


    /**
     * 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))); //
        _Disabled = (Boolean)(HELPER_Disabled.fromObject (_Disabled, tl_payment_planPSet.getAttrib (FIELD_Disabled))); //
        _ProductReference = (String)(HELPER_ProductReference.fromObject (_ProductReference, tl_payment_planPSet.getAttrib (FIELD_ProductReference))); //
        _UsageType = (UsageType)(HELPER_UsageType.fromObject (_UsageType, tl_payment_planPSet.getAttrib (FIELD_UsageType))); //
        _LinkedPlanReference = (String)(HELPER_LinkedPlanReference.fromObject (_LinkedPlanReference, tl_payment_planPSet.getAttrib (FIELD_LinkedPlanReference))); //
        
    }


    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);
            }

            try
            {
                setDisabled (otherPaymentPlan.getDisabled ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setProductReference (otherPaymentPlan.getProductReference ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setUsageType (otherPaymentPlan.getUsageType ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setLinkedPlanReference (otherPaymentPlan.getLinkedPlanReference ());
            }
            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;
            _Disabled = sourcePaymentPlan._Disabled;
            _ProductReference = sourcePaymentPlan._ProductReference;
            _UsageType = sourcePaymentPlan._UsageType;
            _LinkedPlanReference = sourcePaymentPlan._LinkedPlanReference;
            
        }
    }


    /**
     * 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))); //
        _Disabled = (Boolean)(HELPER_Disabled.readExternal (_Disabled, vals.get(FIELD_Disabled))); //
        _ProductReference = (String)(HELPER_ProductReference.readExternal (_ProductReference, vals.get(FIELD_ProductReference))); //
        _UsageType = (UsageType)(HELPER_UsageType.readExternal (_UsageType, vals.get(FIELD_UsageType))); //
        _LinkedPlanReference = (String)(HELPER_LinkedPlanReference.readExternal (_LinkedPlanReference, vals.get(FIELD_LinkedPlanReference))); //
        
    }


    /**
     * 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));
        vals.put (FIELD_Disabled, HELPER_Disabled.writeExternal (_Disabled));
        vals.put (FIELD_ProductReference, HELPER_ProductReference.writeExternal (_ProductReference));
        vals.put (FIELD_UsageType, HELPER_UsageType.writeExternal (_UsageType));
        vals.put (FIELD_LinkedPlanReference, HELPER_LinkedPlanReference.writeExternal (_LinkedPlanReference));
        
    }


    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));
            }
            if (!HELPER_Disabled.compare(this._Disabled, otherPaymentPlan._Disabled))
            {
                listener.notifyFieldChange(this, other, FIELD_Disabled, HELPER_Disabled.toObject(this._Disabled), HELPER_Disabled.toObject(otherPaymentPlan._Disabled));
            }
            if (!HELPER_ProductReference.compare(this._ProductReference, otherPaymentPlan._ProductReference))
            {
                listener.notifyFieldChange(this, other, FIELD_ProductReference, HELPER_ProductReference.toObject(this._ProductReference), HELPER_ProductReference.toObject(otherPaymentPlan._ProductReference));
            }
            if (!HELPER_UsageType.compare(this._UsageType, otherPaymentPlan._UsageType))
            {
                listener.notifyFieldChange(this, other, FIELD_UsageType, HELPER_UsageType.toObject(this._UsageType), HELPER_UsageType.toObject(otherPaymentPlan._UsageType));
            }
            if (!HELPER_LinkedPlanReference.compare(this._LinkedPlanReference, otherPaymentPlan._LinkedPlanReference))
            {
                listener.notifyFieldChange(this, other, FIELD_LinkedPlanReference, HELPER_LinkedPlanReference.toObject(this._LinkedPlanReference), HELPER_LinkedPlanReference.toObject(otherPaymentPlan._LinkedPlanReference));
            }

            // 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()));
        visitor.visitField(this, FIELD_Disabled, HELPER_Disabled.toObject(getDisabled()));
        visitor.visitField(this, FIELD_ProductReference, HELPER_ProductReference.toObject(getProductReference()));
        visitor.visitField(this, FIELD_UsageType, HELPER_UsageType.toObject(getUsageType()));
        visitor.visitField(this, FIELD_LinkedPlanReference, HELPER_LinkedPlanReference.toObject(getLinkedPlanReference()));
        
    }


    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 if (attribName.equals (FIELD_Disabled))
        {
            return filter.matches (getDisabled ());
        }
        else if (attribName.equals (FIELD_ProductReference))
        {
            return filter.matches (getProductReference ());
        }
        else if (attribName.equals (FIELD_UsageType))
        {
            return filter.matches (getUsageType ());
        }
        else if (attribName.equals (FIELD_LinkedPlanReference))
        {
            return filter.matches (getLinkedPlanReference ());
        }
        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 SearchAll andDisabled (QueryFilter<Boolean> filter)
        {
            filter.addFilter (context, "tl_payment_plan.disabled", "Disabled");
            return this;
        }
            
        public SearchAll andProductReference (QueryFilter<String> filter)
        {
            filter.addFilter (context, "tl_payment_plan.product_reference", "ProductReference");
            return this;
        }
            
        public SearchAll andUsageType (QueryFilter<UsageType> filter)
        {
            filter.addFilter (context, "tl_payment_plan.usage_type", "UsageType");
            return this;
        }
            
        public SearchAll andLinkedPlanReference (QueryFilter<String> filter)
        {
            filter.addFilter (context, "tl_payment_plan.linked_plan", "LinkedPlanReference");
            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 static SearchMax SearchByMax () { return new SearchMax (); }

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

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

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

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

        
    public static PaymentPlan searchMax (ObjectTransaction transaction) throws StorageException
    {
        return SearchByMax ()
               .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 if (attribName.equals (FIELD_Disabled))
        {
            return HELPER_Disabled.toObject (getDisabled ());
        }
        else if (attribName.equals (FIELD_ProductReference))
        {
            return HELPER_ProductReference.toObject (getProductReference ());
        }
        else if (attribName.equals (FIELD_UsageType))
        {
            return HELPER_UsageType.toObject (getUsageType ());
        }
        else if (attribName.equals (FIELD_LinkedPlanReference))
        {
            return HELPER_LinkedPlanReference.toObject (getLinkedPlanReference ());
        }
        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 if (attribName.equals (FIELD_Disabled))
        {
            return HELPER_Disabled;
        }
        else if (attribName.equals (FIELD_ProductReference))
        {
            return HELPER_ProductReference;
        }
        else if (attribName.equals (FIELD_UsageType))
        {
            return HELPER_UsageType;
        }
        else if (attribName.equals (FIELD_LinkedPlanReference))
        {
            return HELPER_LinkedPlanReference;
        }
        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 if (attribName.equals (FIELD_Disabled))
        {
            setDisabled ((Boolean)(HELPER_Disabled.fromObject (_Disabled, attribValue)));            
        }
        else if (attribName.equals (FIELD_ProductReference))
        {
            setProductReference ((String)(HELPER_ProductReference.fromObject (_ProductReference, attribValue)));            
        }
        else if (attribName.equals (FIELD_UsageType))
        {
            setUsageType ((UsageType)(HELPER_UsageType.fromObject (_UsageType, attribValue)));            
        }
        else if (attribName.equals (FIELD_LinkedPlanReference))
        {
            setLinkedPlanReference ((String)(HELPER_LinkedPlanReference.fromObject (_LinkedPlanReference, attribValue)));            
        }
        else
        {
            super.setAttribute (attribName, attribValue);
        }
    }

    

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

    public boolean isReadable ()
    {
        return super.isReadable();
    }

    public boolean isReadable (String fieldName)
    {
        return super.isReadable(fieldName);
    }


    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 if (fieldName.equals (FIELD_Disabled))
        {
            return getWriteability_Disabled ();
        }
        else if (fieldName.equals (FIELD_ProductReference))
        {
            return getWriteability_ProductReference ();
        }
        else if (fieldName.equals (FIELD_UsageType))
        {
            return getWriteability_UsageType ();
        }
        else if (fieldName.equals (FIELD_LinkedPlanReference))
        {
            return getWriteability_LinkedPlanReference ();
        }
        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);
        }
        
        if (getWriteability_Disabled () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_Disabled);
        }
        
        if (getWriteability_ProductReference () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_ProductReference);
        }
        
        if (getWriteability_UsageType () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_UsageType);
        }
        
        if (getWriteability_LinkedPlanReference () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_LinkedPlanReference);
        }
        

        super.putUnwriteable (fields);
    }

    public String[] getAllTableNames()
    {
        return new String[] {"tl_payment_plan"};
    }
    
    public boolean isPolymorphic(String tableName)
    {
        return super.isPolymorphic(tableName);
    }


    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));
        result.add(HELPER_Disabled.getAttribObject (getClass (), _Disabled, false, FIELD_Disabled));
        result.add(HELPER_ProductReference.getAttribObject (getClass (), _ProductReference, false, FIELD_ProductReference));
        result.add(HELPER_UsageType.getAttribObject (getClass (), _UsageType, false, FIELD_UsageType));
        result.add(HELPER_LinkedPlanReference.getAttribObject (getClass (), _LinkedPlanReference, false, FIELD_LinkedPlanReference));

        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 copyAllAttributeMetadata (Map copyInto)
    {
        super.copyAllAttributeMetadata(copyInto);

        copyInto.putAll(ATTRIBUTES_METADATA_PaymentPlan);
    }
            

    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;
    }

    /**
     * Get the attribute Disabled
     */
    public Boolean getDisabled (PaymentPlan obj, Boolean original)
    {
        return original;
    }

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

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

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

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

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

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

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

    }

    @Override
    public ORMPipeLine pipes()
    {
        return new PaymentPlanPipeLineFactory<PaymentPlan, PaymentPlan> ((PaymentPlan)this);
    }

    @Override
    public ORMPipeLine pipes(Collection _items)
    {
        return pipesPaymentPlan(_items);
    }
      
    /**
     * 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 ();
            }                
            if (name.equals ("Disabled"))
            {
                return toDisabled ();
            }                
            if (name.equals ("ProductReference"))
            {
                return toProductReference ();
            }                
            if (name.equals ("UsageType"))
            {
                return toUsageType ();
            }                
            if (name.equals ("LinkedPlanReference"))
            {
                return toLinkedPlanReference ();
            }                
            
            
            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 CurrencyType.CurrencyTypePipeLineFactory<From, CurrencyType> toCurrencyType () 
        { 
            return new CurrencyType.CurrencyTypePipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_CurrencyType));
        }
        
        public PipeLine<From, Double> toAmount () { return pipe(new ORMAttributePipe<Me, Double>(FIELD_Amount));  }
        
        public Interval.IntervalPipeLineFactory<From, Interval> toInterval () 
        { 
            return new Interval.IntervalPipeLineFactory<> (this, new ORMAttributePipe<>(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 PipeLine<From, Boolean> toDisabled () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_Disabled));  }
        
        public PipeLine<From, String> toProductReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ProductReference));  }
        
        public UsageType.UsageTypePipeLineFactory<From, UsageType> toUsageType () 
        { 
            return new UsageType.UsageTypePipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_UsageType));
        }
        
        public PipeLine<From, String> toLinkedPlanReference () { return pipe(new ORMAttributePipe<Me, String>(FIELD_LinkedPlanReference));  }
    }
    
    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 ()
    {
    }


}

    
