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


    package performa.orm;

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

import performa.orm.types.*;



public abstract class BaseCandidateClassScore extends BaseBusinessClass
{
    // Reference instance for the object
    public static final CandidateClassScore REFERENCE_CandidateClassScore = new CandidateClassScore ();

    // Reference instance for the object
    public static final CandidateClassScore DUMMY_CandidateClassScore = new DummyCandidateClassScore ();

    // Static constants corresponding to field names
    
    public static final String FIELD_ClassScore = "ClassScore";
    public static final String FIELD_WghtdClassScore = "WghtdClassScore";
    public static final String FIELD_MaxWghtdClassScore = "MaxWghtdClassScore";
    public static final String FIELD_ColorCode = "ColorCode";
    public static final String FIELD_WghtdColorCode = "WghtdColorCode";
    public static final String FIELD_FactorClass = "FactorClass";
    public static final String SINGLEREFERENCE_TestAnalysis = "TestAnalysis";
    public static final String BACKREF_TestAnalysis = "";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<CandidateClassScore> HELPER_ClassScore = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CandidateClassScore> HELPER_WghtdClassScore = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CandidateClassScore> HELPER_MaxWghtdClassScore = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<CandidateClassScore, ColorCode> HELPER_ColorCode =  new EnumeratedAttributeHelper<CandidateClassScore, ColorCode> (ColorCode.FACTORY_ColorCode);
    private static final EnumeratedAttributeHelper<CandidateClassScore, ColorCode> HELPER_WghtdColorCode =  new EnumeratedAttributeHelper<CandidateClassScore, ColorCode> (ColorCode.FACTORY_ColorCode);
    private static final EnumeratedAttributeHelper<CandidateClassScore, FactorClass> HELPER_FactorClass =  new EnumeratedAttributeHelper<CandidateClassScore, FactorClass> (FactorClass.FACTORY_FactorClass);
    

    // Private attributes corresponding to business object data
    private Integer _ClassScore;
    private Integer _WghtdClassScore;
    private Integer _MaxWghtdClassScore;
    private ColorCode _ColorCode;
    private ColorCode _WghtdColorCode;
    private FactorClass _FactorClass;
    

    // Private attributes corresponding to single references
    private SingleAssociation<CandidateClassScore, TestAnalysis> _TestAnalysis;
    

    // Private attributes corresponding to multiple references
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_ClassScore_Validators;
    private static final AttributeValidator[] FIELD_WghtdClassScore_Validators;
    private static final AttributeValidator[] FIELD_MaxWghtdClassScore_Validators;
    private static final AttributeValidator[] FIELD_ColorCode_Validators;
    private static final AttributeValidator[] FIELD_WghtdColorCode_Validators;
    private static final AttributeValidator[] FIELD_FactorClass_Validators;
    

    // Arrays of behaviour decorators
    private static final CandidateClassScoreBehaviourDecorator[] CandidateClassScore_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_TestAnalysis = TestAnalysis.BACKREF_CandidateClassScores;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_TestAnalysis();
            FIELD_ClassScore_Validators = (AttributeValidator[])setupAttribMetaData_ClassScore(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_WghtdClassScore_Validators = (AttributeValidator[])setupAttribMetaData_WghtdClassScore(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_MaxWghtdClassScore_Validators = (AttributeValidator[])setupAttribMetaData_MaxWghtdClassScore(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ColorCode_Validators = (AttributeValidator[])setupAttribMetaData_ColorCode(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_WghtdColorCode_Validators = (AttributeValidator[])setupAttribMetaData_WghtdColorCode(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_FactorClass_Validators = (AttributeValidator[])setupAttribMetaData_FactorClass(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_CandidateClassScore.initialiseReference ();
            DUMMY_CandidateClassScore.initialiseReference ();
            CandidateClassScore_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(CandidateClassScore.class).toArray(new CandidateClassScoreBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

    
    // Meta Info setup
    private static void setupAssocMetaData_TestAnalysis()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "CandidateClassScores");
        metaInfo.put ("dbcol", "test_analysis_id");
        metaInfo.put ("name", "TestAnalysis");
        metaInfo.put ("type", "TestAnalysis");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.TestAnalysis:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (SINGLEREFERENCE_TestAnalysis, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static List setupAttribMetaData_ClassScore(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "class_score");
        metaInfo.put ("name", "ClassScore");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.ClassScore:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (FIELD_ClassScore, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "wghtd_class_score");
        metaInfo.put ("name", "WghtdClassScore");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.WghtdClassScore:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (FIELD_WghtdClassScore, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "max_wghtd_class_score");
        metaInfo.put ("name", "MaxWghtdClassScore");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.MaxWghtdClassScore:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (FIELD_MaxWghtdClassScore, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "color_code");
        metaInfo.put ("name", "ColorCode");
        metaInfo.put ("type", "ColorCode");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.ColorCode:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (FIELD_ColorCode, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "wghtd_color_code");
        metaInfo.put ("name", "WghtdColorCode");
        metaInfo.put ("type", "ColorCode");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.WghtdColorCode:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (FIELD_WghtdColorCode, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "factor_class");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "FactorClass");
        metaInfo.put ("type", "FactorClass");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CandidateClassScore.FactorClass:", metaInfo);
        ATTRIBUTES_METADATA_CandidateClassScore.put (FIELD_FactorClass, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _ClassScore = (Integer)(HELPER_ClassScore.initialise (_ClassScore));
        _WghtdClassScore = (Integer)(HELPER_WghtdClassScore.initialise (_WghtdClassScore));
        _MaxWghtdClassScore = (Integer)(HELPER_MaxWghtdClassScore.initialise (_MaxWghtdClassScore));
        _ColorCode = (ColorCode)(HELPER_ColorCode.initialise (_ColorCode));
        _WghtdColorCode = (ColorCode)(HELPER_WghtdColorCode.initialise (_WghtdColorCode));
        _FactorClass = (FactorClass)(HELPER_FactorClass.initialise (_FactorClass));
    }


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

        _TestAnalysis = new SingleAssociation<CandidateClassScore, TestAnalysis> (this, SINGLEREFERENCE_TestAnalysis, TestAnalysis.MULTIPLEREFERENCE_CandidateClassScores, TestAnalysis.REFERENCE_TestAnalysis, "tl_candidate_class_score");
        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _TestAnalysis = new SingleAssociation<CandidateClassScore, TestAnalysis> (this, SINGLEREFERENCE_TestAnalysis, TestAnalysis.MULTIPLEREFERENCE_CandidateClassScores, TestAnalysis.REFERENCE_TestAnalysis, "tl_candidate_class_score");
        
        
        return this;
    }

    

    /**
     * Get the attribute ClassScore
     */
    public Integer getClassScore ()
    {
        assertValid();
        Integer valToReturn = _ClassScore;

            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                valToReturn = bhd.getClassScore ((CandidateClassScore)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 preClassScoreChange (Integer newClassScore) 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 postClassScoreChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ClassScore.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setClassScore (Integer newClassScore) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ClassScore.compare (_ClassScore, newClassScore);
        
        try
        {
            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                newClassScore = bhd.setClassScore ((CandidateClassScore)this, newClassScore);
                oldAndNewIdentical = HELPER_ClassScore.compare (_ClassScore, newClassScore);
            }

            

            if (FIELD_ClassScore_Validators.length > 0)
            {
                Object newClassScoreObj = HELPER_ClassScore.toObject (newClassScore);

                if (newClassScoreObj != null)
                {
                    int     loopMax = FIELD_ClassScore_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CandidateClassScore.get (FIELD_ClassScore);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ClassScore () != FieldWriteability.FALSE, "Field  ClassScore is not writeable");
            preClassScoreChange (newClassScore);
            markFieldChange (FIELD_ClassScore);
            _ClassScore = newClassScore;            
            postFieldChange (FIELD_ClassScore);
            postClassScoreChange ();
        }
    }

    /**
     * Get the attribute WghtdClassScore
     */
    public Integer getWghtdClassScore ()
    {
        assertValid();
        Integer valToReturn = _WghtdClassScore;

            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                valToReturn = bhd.getWghtdClassScore ((CandidateClassScore)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 preWghtdClassScoreChange (Integer newWghtdClassScore) 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 postWghtdClassScoreChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute WghtdClassScore.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setWghtdClassScore (Integer newWghtdClassScore) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_WghtdClassScore.compare (_WghtdClassScore, newWghtdClassScore);
        
        try
        {
            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                newWghtdClassScore = bhd.setWghtdClassScore ((CandidateClassScore)this, newWghtdClassScore);
                oldAndNewIdentical = HELPER_WghtdClassScore.compare (_WghtdClassScore, newWghtdClassScore);
            }

            

            if (FIELD_WghtdClassScore_Validators.length > 0)
            {
                Object newWghtdClassScoreObj = HELPER_WghtdClassScore.toObject (newWghtdClassScore);

                if (newWghtdClassScoreObj != null)
                {
                    int     loopMax = FIELD_WghtdClassScore_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CandidateClassScore.get (FIELD_WghtdClassScore);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_WghtdClassScore () != FieldWriteability.FALSE, "Field  WghtdClassScore is not writeable");
            preWghtdClassScoreChange (newWghtdClassScore);
            markFieldChange (FIELD_WghtdClassScore);
            _WghtdClassScore = newWghtdClassScore;            
            postFieldChange (FIELD_WghtdClassScore);
            postWghtdClassScoreChange ();
        }
    }

    /**
     * Get the attribute MaxWghtdClassScore
     */
    public Integer getMaxWghtdClassScore ()
    {
        assertValid();
        Integer valToReturn = _MaxWghtdClassScore;

            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                valToReturn = bhd.getMaxWghtdClassScore ((CandidateClassScore)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 preMaxWghtdClassScoreChange (Integer newMaxWghtdClassScore) 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 postMaxWghtdClassScoreChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute MaxWghtdClassScore.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setMaxWghtdClassScore (Integer newMaxWghtdClassScore) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_MaxWghtdClassScore.compare (_MaxWghtdClassScore, newMaxWghtdClassScore);
        
        try
        {
            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                newMaxWghtdClassScore = bhd.setMaxWghtdClassScore ((CandidateClassScore)this, newMaxWghtdClassScore);
                oldAndNewIdentical = HELPER_MaxWghtdClassScore.compare (_MaxWghtdClassScore, newMaxWghtdClassScore);
            }

            

            if (FIELD_MaxWghtdClassScore_Validators.length > 0)
            {
                Object newMaxWghtdClassScoreObj = HELPER_MaxWghtdClassScore.toObject (newMaxWghtdClassScore);

                if (newMaxWghtdClassScoreObj != null)
                {
                    int     loopMax = FIELD_MaxWghtdClassScore_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CandidateClassScore.get (FIELD_MaxWghtdClassScore);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_MaxWghtdClassScore () != FieldWriteability.FALSE, "Field  MaxWghtdClassScore is not writeable");
            preMaxWghtdClassScoreChange (newMaxWghtdClassScore);
            markFieldChange (FIELD_MaxWghtdClassScore);
            _MaxWghtdClassScore = newMaxWghtdClassScore;            
            postFieldChange (FIELD_MaxWghtdClassScore);
            postMaxWghtdClassScoreChange ();
        }
    }

    /**
     * Get the attribute ColorCode
     */
    public ColorCode getColorCode ()
    {
        assertValid();
        ColorCode valToReturn = _ColorCode;

            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                valToReturn = bhd.getColorCode ((CandidateClassScore)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 preColorCodeChange (ColorCode newColorCode) 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 postColorCodeChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ColorCode.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setColorCode (ColorCode newColorCode) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ColorCode.compare (_ColorCode, newColorCode);
        
        try
        {
            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                newColorCode = bhd.setColorCode ((CandidateClassScore)this, newColorCode);
                oldAndNewIdentical = HELPER_ColorCode.compare (_ColorCode, newColorCode);
            }

            

            if (FIELD_ColorCode_Validators.length > 0)
            {
                Object newColorCodeObj = HELPER_ColorCode.toObject (newColorCode);

                if (newColorCodeObj != null)
                {
                    int     loopMax = FIELD_ColorCode_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CandidateClassScore.get (FIELD_ColorCode);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ColorCode () != FieldWriteability.FALSE, "Field  ColorCode is not writeable");
            preColorCodeChange (newColorCode);
            markFieldChange (FIELD_ColorCode);
            _ColorCode = newColorCode;            
            postFieldChange (FIELD_ColorCode);
            postColorCodeChange ();
        }
    }

    /**
     * Get the attribute WghtdColorCode
     */
    public ColorCode getWghtdColorCode ()
    {
        assertValid();
        ColorCode valToReturn = _WghtdColorCode;

            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                valToReturn = bhd.getWghtdColorCode ((CandidateClassScore)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 preWghtdColorCodeChange (ColorCode newWghtdColorCode) 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 postWghtdColorCodeChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute WghtdColorCode.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setWghtdColorCode (ColorCode newWghtdColorCode) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_WghtdColorCode.compare (_WghtdColorCode, newWghtdColorCode);
        
        try
        {
            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                newWghtdColorCode = bhd.setWghtdColorCode ((CandidateClassScore)this, newWghtdColorCode);
                oldAndNewIdentical = HELPER_WghtdColorCode.compare (_WghtdColorCode, newWghtdColorCode);
            }

            

            if (FIELD_WghtdColorCode_Validators.length > 0)
            {
                Object newWghtdColorCodeObj = HELPER_WghtdColorCode.toObject (newWghtdColorCode);

                if (newWghtdColorCodeObj != null)
                {
                    int     loopMax = FIELD_WghtdColorCode_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CandidateClassScore.get (FIELD_WghtdColorCode);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_WghtdColorCode () != FieldWriteability.FALSE, "Field  WghtdColorCode is not writeable");
            preWghtdColorCodeChange (newWghtdColorCode);
            markFieldChange (FIELD_WghtdColorCode);
            _WghtdColorCode = newWghtdColorCode;            
            postFieldChange (FIELD_WghtdColorCode);
            postWghtdColorCodeChange ();
        }
    }

    /**
     * Get the attribute FactorClass
     */
    public FactorClass getFactorClass ()
    {
        assertValid();
        FactorClass valToReturn = _FactorClass;

            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                valToReturn = bhd.getFactorClass ((CandidateClassScore)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 preFactorClassChange (FactorClass newFactorClass) 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 postFactorClassChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute FactorClass.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setFactorClass (FactorClass newFactorClass) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_FactorClass.compare (_FactorClass, newFactorClass);
        
        try
        {
            for (CandidateClassScoreBehaviourDecorator bhd : CandidateClassScore_BehaviourDecorators)
            {
                newFactorClass = bhd.setFactorClass ((CandidateClassScore)this, newFactorClass);
                oldAndNewIdentical = HELPER_FactorClass.compare (_FactorClass, newFactorClass);
            }

            BusinessObjectParser.assertFieldCondition (newFactorClass != null, this, FIELD_FactorClass, "mandatory");
            

            if (FIELD_FactorClass_Validators.length > 0)
            {
                Object newFactorClassObj = HELPER_FactorClass.toObject (newFactorClass);

                if (newFactorClassObj != null)
                {
                    int     loopMax = FIELD_FactorClass_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CandidateClassScore.get (FIELD_FactorClass);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_FactorClass () != FieldWriteability.FALSE, "Field  FactorClass is not writeable");
            preFactorClassChange (newFactorClass);
            markFieldChange (FIELD_FactorClass);
            _FactorClass = newFactorClass;            
            postFieldChange (FIELD_FactorClass);
            postFactorClassChange ();
        }
    }



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

        
        result.add("TestAnalysis");
        

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


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


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


    public Long getSingleAssocID (String assocName) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_TestAnalysis))
        {
            return getTestAnalysisID ();
        }
        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 if (assocName.equals (SINGLEREFERENCE_TestAnalysis))
        {
            setTestAnalysis ((TestAnalysis)(newValue));
        }
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



    /**
     * Get the reference TestAnalysis
     */
    public TestAnalysis getTestAnalysis () throws StorageException
    {
        assertValid();
        
        try
        {
            return (TestAnalysis)(_TestAnalysis.get ());
        }
        catch (ClassCastException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CandidateClassScore:", this.getObjectID (), ", was trying to get TestAnalysis:",  getTestAnalysisID ());
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _TestAnalysis.get ().getClass ());
            throw e;
        }
    }


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public TestAnalysis getTestAnalysis (Get getType) throws StorageException
    {
        assertValid();
        return _TestAnalysis.get(getType);
    }


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getTestAnalysisID ()
    {
        assertValid();
        
        if (_TestAnalysis == null)
        {
            return null;
        }
        else
        {
            return _TestAnalysis.getID ();
        }
    }

    /**
     * Called prior to the assoc 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 preTestAnalysisChange (TestAnalysis newTestAnalysis) throws FieldException
    {
    }


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



    
    public FieldWriteability getWriteability_TestAnalysis ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    /**
     * Set the reference TestAnalysis.  Checks to ensure a new value
     * has been supplied.  If so, marks the reference as altered and sets it.
     */
    public void setTestAnalysis (TestAnalysis newTestAnalysis) throws StorageException, FieldException
    {
        

        if (_TestAnalysis.wouldReferencedChange (newTestAnalysis))
        {
            assertValid();
            Debug.assertion (getWriteability_TestAnalysis () != FieldWriteability.FALSE, "Assoc TestAnalysis is not writeable");
            preTestAnalysisChange (newTestAnalysis);
            TestAnalysis oldTestAnalysis = getTestAnalysis ();

                    if (oldTestAnalysis != null)
                    {
                        // This is to stop validation from triggering when we are removed
                        _TestAnalysis.set (null);
                        oldTestAnalysis.removeFromCandidateClassScores ((CandidateClassScore)(this));
                    }

                    _TestAnalysis.set (newTestAnalysis);

                    if (newTestAnalysis != null)
                    {
                        newTestAnalysis.addToCandidateClassScores ((CandidateClassScore)(this));
                    }
                
            postTestAnalysisChange ();
        }
    }

    /**
     * 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 
        {
            // Ensure we are removed from any loaded multi-associations that aren't mandatory
            if (_TestAnalysis.isLoaded () || getTransaction ().isObjectLoaded (_TestAnalysis.getReferencedType (), getTestAnalysisID ()))
            {
                TestAnalysis  referenced = getTestAnalysis ();

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null CandidateClassScores from ", getObjectID (), " to ", referenced.getObjectID ());
                    _TestAnalysis.set (null);
                    referenced.removeFromCandidateClassScores ((CandidateClassScore)this);
                }
            }
        
        }
        catch (Exception e)
        {
            throw NestedException.wrap(e);
        }

        super.onDelete ();
    }


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


    public CandidateClassScore referenceInstance ()
    {
        return REFERENCE_CandidateClassScore;
    }


    public CandidateClassScore getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getCandidateClassScoreByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_CandidateClassScore;
    }


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





    /**
     * 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_candidate_class_scorePSet = allSets.getPersistentSet (myID, "tl_candidate_class_score", myPSetStatus);

        tl_candidate_class_scorePSet.setAttrib (FIELD_ObjectID, myID);
        tl_candidate_class_scorePSet.setAttrib (FIELD_ClassScore, HELPER_ClassScore.toObject (_ClassScore)); //
        tl_candidate_class_scorePSet.setAttrib (FIELD_WghtdClassScore, HELPER_WghtdClassScore.toObject (_WghtdClassScore)); //
        tl_candidate_class_scorePSet.setAttrib (FIELD_MaxWghtdClassScore, HELPER_MaxWghtdClassScore.toObject (_MaxWghtdClassScore)); //
        tl_candidate_class_scorePSet.setAttrib (FIELD_ColorCode, HELPER_ColorCode.toObject (_ColorCode)); //
        tl_candidate_class_scorePSet.setAttrib (FIELD_WghtdColorCode, HELPER_WghtdColorCode.toObject (_WghtdColorCode)); //
        tl_candidate_class_scorePSet.setAttrib (FIELD_FactorClass, HELPER_FactorClass.toObject (_FactorClass)); //
        _TestAnalysis.getPersistentSets (allSets);
        
    }


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

        
        PersistentSet   tl_candidate_class_scorePSet = allSets.getPersistentSet (objectID, "tl_candidate_class_score");

        _ClassScore = (Integer)(HELPER_ClassScore.fromObject (_ClassScore, tl_candidate_class_scorePSet.getAttrib (FIELD_ClassScore))); //
        _WghtdClassScore = (Integer)(HELPER_WghtdClassScore.fromObject (_WghtdClassScore, tl_candidate_class_scorePSet.getAttrib (FIELD_WghtdClassScore))); //
        _MaxWghtdClassScore = (Integer)(HELPER_MaxWghtdClassScore.fromObject (_MaxWghtdClassScore, tl_candidate_class_scorePSet.getAttrib (FIELD_MaxWghtdClassScore))); //
        _ColorCode = (ColorCode)(HELPER_ColorCode.fromObject (_ColorCode, tl_candidate_class_scorePSet.getAttrib (FIELD_ColorCode))); //
        _WghtdColorCode = (ColorCode)(HELPER_WghtdColorCode.fromObject (_WghtdColorCode, tl_candidate_class_scorePSet.getAttrib (FIELD_WghtdColorCode))); //
        _FactorClass = (FactorClass)(HELPER_FactorClass.fromObject (_FactorClass, tl_candidate_class_scorePSet.getAttrib (FIELD_FactorClass))); //
        _TestAnalysis.setFromPersistentSets (objectID, allSets);
        
    }





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

        if (other instanceof CandidateClassScore)
        {
            CandidateClassScore otherCandidateClassScore = (CandidateClassScore)other;
            
            try
            {
                setClassScore (otherCandidateClassScore.getClassScore ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setWghtdClassScore (otherCandidateClassScore.getWghtdClassScore ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setMaxWghtdClassScore (otherCandidateClassScore.getMaxWghtdClassScore ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setColorCode (otherCandidateClassScore.getColorCode ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setWghtdColorCode (otherCandidateClassScore.getWghtdColorCode ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setFactorClass (otherCandidateClassScore.getFactorClass ());
            }
            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 BaseCandidateClassScore)
        {
            BaseCandidateClassScore sourceCandidateClassScore = (BaseCandidateClassScore)(source);

            _ClassScore = sourceCandidateClassScore._ClassScore;
            _WghtdClassScore = sourceCandidateClassScore._WghtdClassScore;
            _MaxWghtdClassScore = sourceCandidateClassScore._MaxWghtdClassScore;
            _ColorCode = sourceCandidateClassScore._ColorCode;
            _WghtdColorCode = sourceCandidateClassScore._WghtdColorCode;
            _FactorClass = sourceCandidateClassScore._FactorClass;
            
        }
    }


    /**
     * 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 BaseCandidateClassScore)
        {
            BaseCandidateClassScore sourceCandidateClassScore = (BaseCandidateClassScore)(source);

            _TestAnalysis.copyFrom (sourceCandidateClassScore._TestAnalysis, linkToGhosts);
            
        }
    }


    /**
     * 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 BaseCandidateClassScore)
        {
            BaseCandidateClassScore sourceCandidateClassScore = (BaseCandidateClassScore)(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);

        _ClassScore = (Integer)(HELPER_ClassScore.readExternal (_ClassScore, vals.get(FIELD_ClassScore))); //
        _WghtdClassScore = (Integer)(HELPER_WghtdClassScore.readExternal (_WghtdClassScore, vals.get(FIELD_WghtdClassScore))); //
        _MaxWghtdClassScore = (Integer)(HELPER_MaxWghtdClassScore.readExternal (_MaxWghtdClassScore, vals.get(FIELD_MaxWghtdClassScore))); //
        _ColorCode = (ColorCode)(HELPER_ColorCode.readExternal (_ColorCode, vals.get(FIELD_ColorCode))); //
        _WghtdColorCode = (ColorCode)(HELPER_WghtdColorCode.readExternal (_WghtdColorCode, vals.get(FIELD_WghtdColorCode))); //
        _FactorClass = (FactorClass)(HELPER_FactorClass.readExternal (_FactorClass, vals.get(FIELD_FactorClass))); //
        _TestAnalysis.readExternalData(vals.get(SINGLEREFERENCE_TestAnalysis));
        
    }


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

        vals.put (FIELD_ClassScore, HELPER_ClassScore.writeExternal (_ClassScore));
        vals.put (FIELD_WghtdClassScore, HELPER_WghtdClassScore.writeExternal (_WghtdClassScore));
        vals.put (FIELD_MaxWghtdClassScore, HELPER_MaxWghtdClassScore.writeExternal (_MaxWghtdClassScore));
        vals.put (FIELD_ColorCode, HELPER_ColorCode.writeExternal (_ColorCode));
        vals.put (FIELD_WghtdColorCode, HELPER_WghtdColorCode.writeExternal (_WghtdColorCode));
        vals.put (FIELD_FactorClass, HELPER_FactorClass.writeExternal (_FactorClass));
        vals.put (SINGLEREFERENCE_TestAnalysis, _TestAnalysis.writeExternalData());
        
    }


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

        if (other instanceof BaseCandidateClassScore)
        {
            BaseCandidateClassScore otherCandidateClassScore = (BaseCandidateClassScore)(other);

            
            if (!HELPER_ClassScore.compare(this._ClassScore, otherCandidateClassScore._ClassScore))
            {
                listener.notifyFieldChange(this, other, FIELD_ClassScore, HELPER_ClassScore.toObject(this._ClassScore), HELPER_ClassScore.toObject(otherCandidateClassScore._ClassScore));
            }
            if (!HELPER_WghtdClassScore.compare(this._WghtdClassScore, otherCandidateClassScore._WghtdClassScore))
            {
                listener.notifyFieldChange(this, other, FIELD_WghtdClassScore, HELPER_WghtdClassScore.toObject(this._WghtdClassScore), HELPER_WghtdClassScore.toObject(otherCandidateClassScore._WghtdClassScore));
            }
            if (!HELPER_MaxWghtdClassScore.compare(this._MaxWghtdClassScore, otherCandidateClassScore._MaxWghtdClassScore))
            {
                listener.notifyFieldChange(this, other, FIELD_MaxWghtdClassScore, HELPER_MaxWghtdClassScore.toObject(this._MaxWghtdClassScore), HELPER_MaxWghtdClassScore.toObject(otherCandidateClassScore._MaxWghtdClassScore));
            }
            if (!HELPER_ColorCode.compare(this._ColorCode, otherCandidateClassScore._ColorCode))
            {
                listener.notifyFieldChange(this, other, FIELD_ColorCode, HELPER_ColorCode.toObject(this._ColorCode), HELPER_ColorCode.toObject(otherCandidateClassScore._ColorCode));
            }
            if (!HELPER_WghtdColorCode.compare(this._WghtdColorCode, otherCandidateClassScore._WghtdColorCode))
            {
                listener.notifyFieldChange(this, other, FIELD_WghtdColorCode, HELPER_WghtdColorCode.toObject(this._WghtdColorCode), HELPER_WghtdColorCode.toObject(otherCandidateClassScore._WghtdColorCode));
            }
            if (!HELPER_FactorClass.compare(this._FactorClass, otherCandidateClassScore._FactorClass))
            {
                listener.notifyFieldChange(this, other, FIELD_FactorClass, HELPER_FactorClass.toObject(this._FactorClass), HELPER_FactorClass.toObject(otherCandidateClassScore._FactorClass));
            }

            // Compare single assocs
            _TestAnalysis.compare (otherCandidateClassScore._TestAnalysis, listener);
            

            // 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_ClassScore, HELPER_ClassScore.toObject(getClassScore()));
        visitor.visitField(this, FIELD_WghtdClassScore, HELPER_WghtdClassScore.toObject(getWghtdClassScore()));
        visitor.visitField(this, FIELD_MaxWghtdClassScore, HELPER_MaxWghtdClassScore.toObject(getMaxWghtdClassScore()));
        visitor.visitField(this, FIELD_ColorCode, HELPER_ColorCode.toObject(getColorCode()));
        visitor.visitField(this, FIELD_WghtdColorCode, HELPER_WghtdColorCode.toObject(getWghtdColorCode()));
        visitor.visitField(this, FIELD_FactorClass, HELPER_FactorClass.toObject(getFactorClass()));
        visitor.visitAssociation (_TestAnalysis);
        
    }


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

        if (scope.includes (_TestAnalysis))
        {
            visitor.visit (_TestAnalysis);
        }
        
    }


    public static CandidateClassScore createCandidateClassScore (ObjectTransaction transaction) throws StorageException
    {
        CandidateClassScore     result = new CandidateClassScore ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static CandidateClassScore getCandidateClassScoreByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (CandidateClassScore)(transaction.getObjectByID (REFERENCE_CandidateClassScore, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ClassScore))
        {
            return filter.matches (getClassScore ());
        }
        else if (attribName.equals (FIELD_WghtdClassScore))
        {
            return filter.matches (getWghtdClassScore ());
        }
        else if (attribName.equals (FIELD_MaxWghtdClassScore))
        {
            return filter.matches (getMaxWghtdClassScore ());
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            return filter.matches (getColorCode ());
        }
        else if (attribName.equals (FIELD_WghtdColorCode))
        {
            return filter.matches (getWghtdColorCode ());
        }
        else if (attribName.equals (FIELD_FactorClass))
        {
            return filter.matches (getFactorClass ());
        }
        else if (attribName.equals (SINGLEREFERENCE_TestAnalysis))
        {
            return filter.matches (getTestAnalysis ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
            public SearchAll andClassScore (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.class_score", "ClassScore");
                return this;
            }
            
            public SearchAll andWghtdClassScore (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.wghtd_class_score", "WghtdClassScore");
                return this;
            }
            
            public SearchAll andMaxWghtdClassScore (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.max_wghtd_class_score", "MaxWghtdClassScore");
                return this;
            }
            
            public SearchAll andColorCode (QueryFilter<ColorCode> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.color_code", "ColorCode");
                return this;
            }
            
            public SearchAll andWghtdColorCode (QueryFilter<ColorCode> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.wghtd_color_code", "WghtdColorCode");
                return this;
            }
            
            public SearchAll andFactorClass (QueryFilter<FactorClass> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.factor_class", "FactorClass");
                return this;
            }
            
            public SearchAll andTestAnalysis (QueryFilter<TestAnalysis> filter)
            {
                filter.addFilter (context, "tl_candidate_class_score.test_analysis_id", "TestAnalysis");
                return this;
            }
            
                public CandidateClassScore[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_CandidateClassScore, SEARCH_All, criteria);
            Set<CandidateClassScore>   typedResults = new LinkedHashSet <CandidateClassScore> ();
            for (BaseBusinessClass bbcResult : results)
            {
                CandidateClassScore aResult = (CandidateClassScore)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CandidateClassScore[0]);
                            
        }
    }

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



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ClassScore))
        {
            return HELPER_ClassScore.toObject (getClassScore ());
        }
        else if (attribName.equals (FIELD_WghtdClassScore))
        {
            return HELPER_WghtdClassScore.toObject (getWghtdClassScore ());
        }
        else if (attribName.equals (FIELD_MaxWghtdClassScore))
        {
            return HELPER_MaxWghtdClassScore.toObject (getMaxWghtdClassScore ());
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            return HELPER_ColorCode.toObject (getColorCode ());
        }
        else if (attribName.equals (FIELD_WghtdColorCode))
        {
            return HELPER_WghtdColorCode.toObject (getWghtdColorCode ());
        }
        else if (attribName.equals (FIELD_FactorClass))
        {
            return HELPER_FactorClass.toObject (getFactorClass ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ClassScore))
        {
            return HELPER_ClassScore;
        }
        else if (attribName.equals (FIELD_WghtdClassScore))
        {
            return HELPER_WghtdClassScore;
        }
        else if (attribName.equals (FIELD_MaxWghtdClassScore))
        {
            return HELPER_MaxWghtdClassScore;
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            return HELPER_ColorCode;
        }
        else if (attribName.equals (FIELD_WghtdColorCode))
        {
            return HELPER_WghtdColorCode;
        }
        else if (attribName.equals (FIELD_FactorClass))
        {
            return HELPER_FactorClass;
        }
        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_ClassScore))
        {
            setClassScore ((Integer)(HELPER_ClassScore.fromObject (_ClassScore, attribValue)));            
        }
        else if (attribName.equals (FIELD_WghtdClassScore))
        {
            setWghtdClassScore ((Integer)(HELPER_WghtdClassScore.fromObject (_WghtdClassScore, attribValue)));            
        }
        else if (attribName.equals (FIELD_MaxWghtdClassScore))
        {
            setMaxWghtdClassScore ((Integer)(HELPER_MaxWghtdClassScore.fromObject (_MaxWghtdClassScore, attribValue)));            
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            setColorCode ((ColorCode)(HELPER_ColorCode.fromObject (_ColorCode, attribValue)));            
        }
        else if (attribName.equals (FIELD_WghtdColorCode))
        {
            setWghtdColorCode ((ColorCode)(HELPER_WghtdColorCode.fromObject (_WghtdColorCode, attribValue)));            
        }
        else if (attribName.equals (FIELD_FactorClass))
        {
            setFactorClass ((FactorClass)(HELPER_FactorClass.fromObject (_FactorClass, attribValue)));            
        }
        else
        {
            super.setAttribute (attribName, attribValue);
        }
    }



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


    public FieldWriteability getWriteable (String fieldName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (fieldName.equals (FIELD_ClassScore))
        {
            return getWriteability_ClassScore ();
        }
        else if (fieldName.equals (FIELD_WghtdClassScore))
        {
            return getWriteability_WghtdClassScore ();
        }
        else if (fieldName.equals (FIELD_MaxWghtdClassScore))
        {
            return getWriteability_MaxWghtdClassScore ();
        }
        else if (fieldName.equals (FIELD_ColorCode))
        {
            return getWriteability_ColorCode ();
        }
        else if (fieldName.equals (FIELD_WghtdColorCode))
        {
            return getWriteability_WghtdColorCode ();
        }
        else if (fieldName.equals (FIELD_FactorClass))
        {
            return getWriteability_FactorClass ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_TestAnalysis))
        {
            return getWriteability_TestAnalysis ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_ClassScore () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ClassScore);
            }
        
            if (getWriteability_WghtdClassScore () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_WghtdClassScore);
            }
        
            if (getWriteability_MaxWghtdClassScore () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_MaxWghtdClassScore);
            }
        
            if (getWriteability_ColorCode () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ColorCode);
            }
        
            if (getWriteability_WghtdColorCode () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_WghtdColorCode);
            }
        
            if (getWriteability_FactorClass () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_FactorClass);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_ClassScore.getAttribObject (getClass (), _ClassScore, false, FIELD_ClassScore));
        result.add(HELPER_WghtdClassScore.getAttribObject (getClass (), _WghtdClassScore, false, FIELD_WghtdClassScore));
        result.add(HELPER_MaxWghtdClassScore.getAttribObject (getClass (), _MaxWghtdClassScore, false, FIELD_MaxWghtdClassScore));
        result.add(HELPER_ColorCode.getAttribObject (getClass (), _ColorCode, false, FIELD_ColorCode));
        result.add(HELPER_WghtdColorCode.getAttribObject (getClass (), _WghtdColorCode, false, FIELD_WghtdColorCode));
        result.add(HELPER_FactorClass.getAttribObject (getClass (), _FactorClass, true, FIELD_FactorClass));

        return result;
    }


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


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

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

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

    public static class CandidateClassScoreBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<CandidateClassScore>
    {

    /**
     * Get the attribute ClassScore
     */
    public Integer getClassScore (CandidateClassScore obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ClassScore.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setClassScore (CandidateClassScore obj, Integer newClassScore) throws FieldException
    {
        return newClassScore;
    }

    /**
     * Get the attribute WghtdClassScore
     */
    public Integer getWghtdClassScore (CandidateClassScore obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute WghtdClassScore.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setWghtdClassScore (CandidateClassScore obj, Integer newWghtdClassScore) throws FieldException
    {
        return newWghtdClassScore;
    }

    /**
     * Get the attribute MaxWghtdClassScore
     */
    public Integer getMaxWghtdClassScore (CandidateClassScore obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute MaxWghtdClassScore.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setMaxWghtdClassScore (CandidateClassScore obj, Integer newMaxWghtdClassScore) throws FieldException
    {
        return newMaxWghtdClassScore;
    }

    /**
     * Get the attribute ColorCode
     */
    public ColorCode getColorCode (CandidateClassScore obj, ColorCode original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ColorCode.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public ColorCode setColorCode (CandidateClassScore obj, ColorCode newColorCode) throws FieldException
    {
        return newColorCode;
    }

    /**
     * Get the attribute WghtdColorCode
     */
    public ColorCode getWghtdColorCode (CandidateClassScore obj, ColorCode original)
    {
        return original;
    }

    /**
     * Change the value set for attribute WghtdColorCode.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public ColorCode setWghtdColorCode (CandidateClassScore obj, ColorCode newWghtdColorCode) throws FieldException
    {
        return newWghtdColorCode;
    }

    /**
     * Get the attribute FactorClass
     */
    public FactorClass getFactorClass (CandidateClassScore obj, FactorClass original)
    {
        return original;
    }

    /**
     * Change the value set for attribute FactorClass.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public FactorClass setFactorClass (CandidateClassScore obj, FactorClass newFactorClass) throws FieldException
    {
        return newFactorClass;
    }

    }

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

        public CandidateClassScorePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("ClassScore"))
            {
                return toClassScore ();
            }                
            if (name.equals ("WghtdClassScore"))
            {
                return toWghtdClassScore ();
            }                
            if (name.equals ("MaxWghtdClassScore"))
            {
                return toMaxWghtdClassScore ();
            }                
            if (name.equals ("ColorCode"))
            {
                return toColorCode ();
            }                
            if (name.equals ("WghtdColorCode"))
            {
                return toWghtdColorCode ();
            }                
            if (name.equals ("FactorClass"))
            {
                return toFactorClass ();
            }                
            if (name.equals ("TestAnalysis"))
            {
                return toTestAnalysis ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Integer> toClassScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_ClassScore));  }
        
        public PipeLine<From, Integer> toWghtdClassScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_WghtdClassScore));  }
        
        public PipeLine<From, Integer> toMaxWghtdClassScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_MaxWghtdClassScore));  }
        
        public PipeLine<From, ColorCode> toColorCode () { return pipe(new ORMAttributePipe<Me, ColorCode>(FIELD_ColorCode));  }
        
        public PipeLine<From, ColorCode> toWghtdColorCode () { return pipe(new ORMAttributePipe<Me, ColorCode>(FIELD_WghtdColorCode));  }
        
        public PipeLine<From, FactorClass> toFactorClass () { return pipe(new ORMAttributePipe<Me, FactorClass>(FIELD_FactorClass));  }
        public TestAnalysis.TestAnalysisPipeLineFactory<From, TestAnalysis> toTestAnalysis () { return toTestAnalysis (Filter.ALL); }

        public TestAnalysis.TestAnalysisPipeLineFactory<From, TestAnalysis> toTestAnalysis (Filter<TestAnalysis> filter) 
        { 
            return TestAnalysis.REFERENCE_TestAnalysis.new TestAnalysisPipeLineFactory<From, TestAnalysis> (this, new ORMSingleAssocPipe<Me, TestAnalysis>(SINGLEREFERENCE_TestAnalysis, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


    public TestAnalysis getTestAnalysis () throws StorageException
    {
        return (TestAnalysis)(TestAnalysis.DUMMY_TestAnalysis);
    }


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getTestAnalysisID ()
    {
        return TestAnalysis.DUMMY_TestAnalysis.getObjectID();
    }

}

    
