/*
 * 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 BaseFactorScore extends BaseBusinessClass
{
    // Reference instance for the object
    public static final FactorScore REFERENCE_FactorScore = new FactorScore ();

    // Reference instance for the object
    public static final FactorScore DUMMY_FactorScore = new DummyFactorScore ();

    // Static constants corresponding to field names
    
    public static final String FIELD_Score = "Score";
    public static final String FIELD_ColorRank = "ColorRank";
    public static final String FIELD_WghtdScore = "WghtdScore";
    public static final String FIELD_ColorCode = "ColorCode";
    public static final String SINGLEREFERENCE_TestAnalysis = "TestAnalysis";
    public static final String BACKREF_TestAnalysis = "";
    public static final String SINGLEREFERENCE_Factor = "Factor";
    public static final String SINGLEREFERENCE_Level = "Level";
    public static final String SINGLEREFERENCE_Narrative = "Narrative";
    public static final String BACKREF_Narrative = "";
    public static final String SINGLEREFERENCE_Candidate = "Candidate";
    public static final String BACKREF_Candidate = "";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<FactorScore> HELPER_Score = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<FactorScore> HELPER_ColorRank = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<FactorScore> HELPER_WghtdScore = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<FactorScore, ColorCode> HELPER_ColorCode =  new EnumeratedAttributeHelper<FactorScore, ColorCode> (ColorCode.FACTORY_ColorCode);
    

    // Private attributes corresponding to business object data
    private Integer _Score;
    private Integer _ColorRank;
    private Integer _WghtdScore;
    private ColorCode _ColorCode;
    

    // Private attributes corresponding to single references
    private SingleAssociation<FactorScore, TestAnalysis> _TestAnalysis;
    private SingleAssociation<FactorScore, Factor> _Factor;
    private SingleAssociation<FactorScore, Level> _Level;
    private SingleAssociation<FactorScore, Narrative> _Narrative;
    private SingleAssociation<FactorScore, Candidate> _Candidate;
    

    // Private attributes corresponding to multiple references
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_ColorCode_Validators;
    private static final AttributeValidator[] FIELD_Score_Validators;
    private static final AttributeValidator[] FIELD_ColorRank_Validators;
    private static final AttributeValidator[] FIELD_WghtdScore_Validators;
    

    // Arrays of behaviour decorators
    private static final FactorScoreBehaviourDecorator[] FactorScore_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_TestAnalysis = TestAnalysis.BACKREF_FactorScores;
            String tmp_Narrative = Narrative.BACKREF_FactorScores;
            String tmp_Candidate = Candidate.BACKREF_FactorScores;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_TestAnalysis();
            setupAssocMetaData_Factor();
            setupAssocMetaData_Level();
            setupAssocMetaData_Narrative();
            setupAssocMetaData_Candidate();
            FIELD_ColorCode_Validators = (AttributeValidator[])setupAttribMetaData_ColorCode(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Score_Validators = (AttributeValidator[])setupAttribMetaData_Score(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ColorRank_Validators = (AttributeValidator[])setupAttribMetaData_ColorRank(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_WghtdScore_Validators = (AttributeValidator[])setupAttribMetaData_WghtdScore(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_FactorScore.initialiseReference ();
            DUMMY_FactorScore.initialiseReference ();
            FactorScore_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(FactorScore.class).toArray(new FactorScoreBehaviourDecorator[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", "FactorScores");
        metaInfo.put ("dbcol", "test_analysis_id");
        metaInfo.put ("name", "TestAnalysis");
        metaInfo.put ("type", "TestAnalysis");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.TestAnalysis:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (SINGLEREFERENCE_TestAnalysis, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Factor()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "factor_number");
        metaInfo.put ("name", "Factor");
        metaInfo.put ("type", "Factor");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.Factor:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (SINGLEREFERENCE_Factor, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Level()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "level_number");
        metaInfo.put ("name", "Level");
        metaInfo.put ("type", "Level");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.Level:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (SINGLEREFERENCE_Level, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Narrative()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "FactorScores");
        metaInfo.put ("dbcol", "narrative_id");
        metaInfo.put ("name", "Narrative");
        metaInfo.put ("type", "Narrative");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.Narrative:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (SINGLEREFERENCE_Narrative, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Candidate()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "FactorScores");
        metaInfo.put ("dbcol", "candidate_id");
        metaInfo.put ("name", "Candidate");
        metaInfo.put ("type", "Candidate");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.Candidate:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (SINGLEREFERENCE_Candidate, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static List setupAttribMetaData_ColorCode(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

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

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

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

        metaInfo.put ("dbcol", "score_number");
        metaInfo.put ("name", "Score");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.Score:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (FIELD_Score, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "color_rank");
        metaInfo.put ("name", "ColorRank");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.ColorRank:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (FIELD_ColorRank, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "wghtd_score");
        metaInfo.put ("name", "WghtdScore");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for FactorScore.WghtdScore:", metaInfo);
        ATTRIBUTES_METADATA_FactorScore.put (FIELD_WghtdScore, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _Score = (Integer)(HELPER_Score.initialise (_Score));
        _ColorRank = (Integer)(HELPER_ColorRank.initialise (_ColorRank));
        _WghtdScore = (Integer)(HELPER_WghtdScore.initialise (_WghtdScore));
        _ColorCode = (ColorCode)(HELPER_ColorCode.initialise (_ColorCode));
    }


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

        _TestAnalysis = new SingleAssociation<FactorScore, TestAnalysis> (this, SINGLEREFERENCE_TestAnalysis, TestAnalysis.MULTIPLEREFERENCE_FactorScores, TestAnalysis.REFERENCE_TestAnalysis, "tl_score");
        _Factor = new SingleAssociation<FactorScore, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "tl_score");
        _Level = new SingleAssociation<FactorScore, Level> (this, SINGLEREFERENCE_Level, null, Level.REFERENCE_Level, "tl_score");
        _Narrative = new SingleAssociation<FactorScore, Narrative> (this, SINGLEREFERENCE_Narrative, Narrative.MULTIPLEREFERENCE_FactorScores, Narrative.REFERENCE_Narrative, "tl_score");
        _Candidate = new SingleAssociation<FactorScore, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_FactorScores, Candidate.REFERENCE_Candidate, "tl_score");
        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _TestAnalysis = new SingleAssociation<FactorScore, TestAnalysis> (this, SINGLEREFERENCE_TestAnalysis, TestAnalysis.MULTIPLEREFERENCE_FactorScores, TestAnalysis.REFERENCE_TestAnalysis, "tl_score");
        _Factor = new SingleAssociation<FactorScore, Factor> (this, SINGLEREFERENCE_Factor, null, Factor.REFERENCE_Factor, "tl_score");
        _Level = new SingleAssociation<FactorScore, Level> (this, SINGLEREFERENCE_Level, null, Level.REFERENCE_Level, "tl_score");
        _Narrative = new SingleAssociation<FactorScore, Narrative> (this, SINGLEREFERENCE_Narrative, Narrative.MULTIPLEREFERENCE_FactorScores, Narrative.REFERENCE_Narrative, "tl_score");
        _Candidate = new SingleAssociation<FactorScore, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_FactorScores, Candidate.REFERENCE_Candidate, "tl_score");
        
        
        return this;
    }

    

    /**
     * Get the attribute Score
     */
    public Integer getScore ()
    {
        assertValid();
        Integer valToReturn = _Score;

            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                valToReturn = bhd.getScore ((FactorScore)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 preScoreChange (Integer newScore) 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 postScoreChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Score.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setScore (Integer newScore) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Score.compare (_Score, newScore);
        
        try
        {
            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                newScore = bhd.setScore ((FactorScore)this, newScore);
                oldAndNewIdentical = HELPER_Score.compare (_Score, newScore);
            }

            

            if (FIELD_Score_Validators.length > 0)
            {
                Object newScoreObj = HELPER_Score.toObject (newScore);

                if (newScoreObj != null)
                {
                    int     loopMax = FIELD_Score_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_FactorScore.get (FIELD_Score);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Score () != FieldWriteability.FALSE, "Field  Score is not writeable");
            preScoreChange (newScore);
            markFieldChange (FIELD_Score);
            _Score = newScore;            
            postFieldChange (FIELD_Score);
            postScoreChange ();
        }
    }

    /**
     * Get the attribute ColorRank
     */
    public Integer getColorRank ()
    {
        assertValid();
        Integer valToReturn = _ColorRank;

            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                valToReturn = bhd.getColorRank ((FactorScore)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 preColorRankChange (Integer newColorRank) 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 postColorRankChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ColorRank.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setColorRank (Integer newColorRank) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ColorRank.compare (_ColorRank, newColorRank);
        
        try
        {
            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                newColorRank = bhd.setColorRank ((FactorScore)this, newColorRank);
                oldAndNewIdentical = HELPER_ColorRank.compare (_ColorRank, newColorRank);
            }

            

            if (FIELD_ColorRank_Validators.length > 0)
            {
                Object newColorRankObj = HELPER_ColorRank.toObject (newColorRank);

                if (newColorRankObj != null)
                {
                    int     loopMax = FIELD_ColorRank_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_FactorScore.get (FIELD_ColorRank);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ColorRank () != FieldWriteability.FALSE, "Field  ColorRank is not writeable");
            preColorRankChange (newColorRank);
            markFieldChange (FIELD_ColorRank);
            _ColorRank = newColorRank;            
            postFieldChange (FIELD_ColorRank);
            postColorRankChange ();
        }
    }

    /**
     * Get the attribute WghtdScore
     */
    public Integer getWghtdScore ()
    {
        assertValid();
        Integer valToReturn = _WghtdScore;

            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                valToReturn = bhd.getWghtdScore ((FactorScore)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 preWghtdScoreChange (Integer newWghtdScore) 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 postWghtdScoreChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute WghtdScore.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setWghtdScore (Integer newWghtdScore) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_WghtdScore.compare (_WghtdScore, newWghtdScore);
        
        try
        {
            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                newWghtdScore = bhd.setWghtdScore ((FactorScore)this, newWghtdScore);
                oldAndNewIdentical = HELPER_WghtdScore.compare (_WghtdScore, newWghtdScore);
            }

            

            if (FIELD_WghtdScore_Validators.length > 0)
            {
                Object newWghtdScoreObj = HELPER_WghtdScore.toObject (newWghtdScore);

                if (newWghtdScoreObj != null)
                {
                    int     loopMax = FIELD_WghtdScore_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_FactorScore.get (FIELD_WghtdScore);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_WghtdScore () != FieldWriteability.FALSE, "Field  WghtdScore is not writeable");
            preWghtdScoreChange (newWghtdScore);
            markFieldChange (FIELD_WghtdScore);
            _WghtdScore = newWghtdScore;            
            postFieldChange (FIELD_WghtdScore);
            postWghtdScoreChange ();
        }
    }

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

            for (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                valToReturn = bhd.getColorCode ((FactorScore)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 (FactorScoreBehaviourDecorator bhd : FactorScore_BehaviourDecorators)
            {
                newColorCode = bhd.setColorCode ((FactorScore)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_FactorScore.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 ();
        }
    }



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

        
        result.add("TestAnalysis");
        
        result.add("Factor");
        
        result.add("Level");
        
        result.add("Narrative");
        
        result.add("Candidate");
        

        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 if (assocName.equals (SINGLEREFERENCE_Factor))
        {
            return _Factor.getReferencedType ();
        }else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            return _Level.getReferencedType ();
        }else if (assocName.equals (SINGLEREFERENCE_Narrative))
        {
            return _Narrative.getReferencedType ();
        }else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            return _Candidate.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_FactorScores ;
        }else if (assocName.equals (SINGLEREFERENCE_Factor))
        {
            return null ;
        }else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            return null ;
        }else if (assocName.equals (SINGLEREFERENCE_Narrative))
        {
            return Narrative.MULTIPLEREFERENCE_FactorScores ;
        }else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            return Candidate.MULTIPLEREFERENCE_FactorScores ;
        }
        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 if (assocName.equals (SINGLEREFERENCE_Factor))
        {
            return getFactor ();
        }else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            return getLevel ();
        }else if (assocName.equals (SINGLEREFERENCE_Narrative))
        {
            return getNarrative ();
        }else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            return getCandidate ();
        }
        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 if (assocName.equals (SINGLEREFERENCE_Factor))
        {
            return getFactor (getType);
        }else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            return getLevel (getType);
        }else if (assocName.equals (SINGLEREFERENCE_Narrative))
        {
            return getNarrative (getType);
        }else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            return getCandidate (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 if (assocName.equals (SINGLEREFERENCE_Factor))
        {
            return getFactorID ();
        }else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            return getLevelID ();
        }else if (assocName.equals (SINGLEREFERENCE_Narrative))
        {
            return getNarrativeID ();
        }else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            return getCandidateID ();
        }
        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 if (assocName.equals (SINGLEREFERENCE_Factor))
        {
            setFactor ((Factor)(newValue));
        }else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            setLevel ((Level)(newValue));
        }else if (assocName.equals (SINGLEREFERENCE_Narrative))
        {
            setNarrative ((Narrative)(newValue));
        }else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            setCandidate ((Candidate)(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 FactorScore:", 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.removeFromFactorScores ((FactorScore)(this));
                    }

                    _TestAnalysis.set (newTestAnalysis);

                    if (newTestAnalysis != null)
                    {
                        newTestAnalysis.addToFactorScores ((FactorScore)(this));
                    }
                
            postTestAnalysisChange ();
        }
    }

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getFactorID ()
    {
        assertValid();
        
        if (_Factor == null)
        {
            return null;
        }
        else
        {
            return _Factor.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 preFactorChange (Factor newFactor) 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 postFactorChange () throws FieldException
    {
    }



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

        if (_Factor.wouldReferencedChange (newFactor))
        {
            assertValid();
            Debug.assertion (getWriteability_Factor () != FieldWriteability.FALSE, "Assoc Factor is not writeable");
            preFactorChange (newFactor);
            
                    _Factor.set (newFactor);
                
            postFactorChange ();
        }
    }

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getLevelID ()
    {
        assertValid();
        
        if (_Level == null)
        {
            return null;
        }
        else
        {
            return _Level.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 preLevelChange (Level newLevel) 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 postLevelChange () throws FieldException
    {
    }



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

        if (_Level.wouldReferencedChange (newLevel))
        {
            assertValid();
            Debug.assertion (getWriteability_Level () != FieldWriteability.FALSE, "Assoc Level is not writeable");
            preLevelChange (newLevel);
            
                    _Level.set (newLevel);
                
            postLevelChange ();
        }
    }

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getNarrativeID ()
    {
        assertValid();
        
        if (_Narrative == null)
        {
            return null;
        }
        else
        {
            return _Narrative.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 preNarrativeChange (Narrative newNarrative) 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 postNarrativeChange () throws FieldException
    {
    }



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

        if (_Narrative.wouldReferencedChange (newNarrative))
        {
            assertValid();
            Debug.assertion (getWriteability_Narrative () != FieldWriteability.FALSE, "Assoc Narrative is not writeable");
            preNarrativeChange (newNarrative);
            Narrative oldNarrative = getNarrative ();

                    if (oldNarrative != null)
                    {
                        // This is to stop validation from triggering when we are removed
                        _Narrative.set (null);
                        oldNarrative.removeFromFactorScores ((FactorScore)(this));
                    }

                    _Narrative.set (newNarrative);

                    if (newNarrative != null)
                    {
                        newNarrative.addToFactorScores ((FactorScore)(this));
                    }
                
            postNarrativeChange ();
        }
    }

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getCandidateID ()
    {
        assertValid();
        
        if (_Candidate == null)
        {
            return null;
        }
        else
        {
            return _Candidate.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 preCandidateChange (Candidate newCandidate) 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 postCandidateChange () throws FieldException
    {
    }



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

        if (_Candidate.wouldReferencedChange (newCandidate))
        {
            assertValid();
            Debug.assertion (getWriteability_Candidate () != FieldWriteability.FALSE, "Assoc Candidate is not writeable");
            preCandidateChange (newCandidate);
            Candidate oldCandidate = getCandidate ();

                    if (oldCandidate != null)
                    {
                        // This is to stop validation from triggering when we are removed
                        _Candidate.set (null);
                        oldCandidate.removeFromFactorScores ((FactorScore)(this));
                    }

                    _Candidate.set (newCandidate);

                    if (newCandidate != null)
                    {
                        newCandidate.addToFactorScores ((FactorScore)(this));
                    }
                
            postCandidateChange ();
        }
    }

    /**
     * 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 FactorScores from ", getObjectID (), " to ", referenced.getObjectID ());
                    _TestAnalysis.set (null);
                    referenced.removeFromFactorScores ((FactorScore)this);
                }
            }
        
            // Ensure we are removed from any loaded multi-associations that aren't mandatory
            if (_Narrative.isLoaded () || getTransaction ().isObjectLoaded (_Narrative.getReferencedType (), getNarrativeID ()))
            {
                Narrative  referenced = getNarrative ();

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null FactorScores from ", getObjectID (), " to ", referenced.getObjectID ());
                    _Narrative.set (null);
                    referenced.removeFromFactorScores ((FactorScore)this);
                }
            }
        
            // Ensure we are removed from any loaded multi-associations that aren't mandatory
            if (_Candidate.isLoaded () || getTransaction ().isObjectLoaded (_Candidate.getReferencedType (), getCandidateID ()))
            {
                Candidate  referenced = getCandidate ();

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

        super.onDelete ();
    }


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


    public FactorScore referenceInstance ()
    {
        return REFERENCE_FactorScore;
    }


    public FactorScore getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getFactorScoreByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_FactorScore;
    }


    public String getBaseSetName ()
    {
        return "tl_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_scorePSet = allSets.getPersistentSet (myID, "tl_score", myPSetStatus);

        tl_scorePSet.setAttrib (FIELD_ObjectID, myID);
        tl_scorePSet.setAttrib (FIELD_Score, HELPER_Score.toObject (_Score)); //
        tl_scorePSet.setAttrib (FIELD_ColorRank, HELPER_ColorRank.toObject (_ColorRank)); //
        tl_scorePSet.setAttrib (FIELD_WghtdScore, HELPER_WghtdScore.toObject (_WghtdScore)); //
        _TestAnalysis.getPersistentSets (allSets);
        _Factor.getPersistentSets (allSets);
        _Level.getPersistentSets (allSets);
        _Narrative.getPersistentSets (allSets);
        _Candidate.getPersistentSets (allSets);
        
    }


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

        
        PersistentSet   tl_scorePSet = allSets.getPersistentSet (objectID, "tl_score");

        _Score = (Integer)(HELPER_Score.fromObject (_Score, tl_scorePSet.getAttrib (FIELD_Score))); //
        _ColorRank = (Integer)(HELPER_ColorRank.fromObject (_ColorRank, tl_scorePSet.getAttrib (FIELD_ColorRank))); //
        _WghtdScore = (Integer)(HELPER_WghtdScore.fromObject (_WghtdScore, tl_scorePSet.getAttrib (FIELD_WghtdScore))); //
        _TestAnalysis.setFromPersistentSets (objectID, allSets);
        _Factor.setFromPersistentSets (objectID, allSets);
        _Level.setFromPersistentSets (objectID, allSets);
        _Narrative.setFromPersistentSets (objectID, allSets);
        _Candidate.setFromPersistentSets (objectID, allSets);
        
    }





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

        if (other instanceof FactorScore)
        {
            FactorScore otherFactorScore = (FactorScore)other;
            
            try
            {
                setScore (otherFactorScore.getScore ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setColorRank (otherFactorScore.getColorRank ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setWghtdScore (otherFactorScore.getWghtdScore ());
            }
            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 BaseFactorScore)
        {
            BaseFactorScore sourceFactorScore = (BaseFactorScore)(source);

            _Score = sourceFactorScore._Score;
            _ColorRank = sourceFactorScore._ColorRank;
            _WghtdScore = sourceFactorScore._WghtdScore;
            _ColorCode = sourceFactorScore._ColorCode;
            
        }
    }


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

            _TestAnalysis.copyFrom (sourceFactorScore._TestAnalysis, linkToGhosts);
            _Factor.copyFrom (sourceFactorScore._Factor, linkToGhosts);
            _Level.copyFrom (sourceFactorScore._Level, linkToGhosts);
            _Narrative.copyFrom (sourceFactorScore._Narrative, linkToGhosts);
            _Candidate.copyFrom (sourceFactorScore._Candidate, 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 BaseFactorScore)
        {
            BaseFactorScore sourceFactorScore = (BaseFactorScore)(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);

        _Score = (Integer)(HELPER_Score.readExternal (_Score, vals.get(FIELD_Score))); //
        _ColorRank = (Integer)(HELPER_ColorRank.readExternal (_ColorRank, vals.get(FIELD_ColorRank))); //
        _WghtdScore = (Integer)(HELPER_WghtdScore.readExternal (_WghtdScore, vals.get(FIELD_WghtdScore))); //
        _ColorCode = (ColorCode)(HELPER_ColorCode.readExternal (_ColorCode, vals.get(FIELD_ColorCode))); //
        _TestAnalysis.readExternalData(vals.get(SINGLEREFERENCE_TestAnalysis));
        _Factor.readExternalData(vals.get(SINGLEREFERENCE_Factor));
        _Level.readExternalData(vals.get(SINGLEREFERENCE_Level));
        _Narrative.readExternalData(vals.get(SINGLEREFERENCE_Narrative));
        _Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
        
    }


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

        vals.put (FIELD_Score, HELPER_Score.writeExternal (_Score));
        vals.put (FIELD_ColorRank, HELPER_ColorRank.writeExternal (_ColorRank));
        vals.put (FIELD_WghtdScore, HELPER_WghtdScore.writeExternal (_WghtdScore));
        vals.put (FIELD_ColorCode, HELPER_ColorCode.writeExternal (_ColorCode));
        vals.put (SINGLEREFERENCE_TestAnalysis, _TestAnalysis.writeExternalData());
        vals.put (SINGLEREFERENCE_Factor, _Factor.writeExternalData());
        vals.put (SINGLEREFERENCE_Level, _Level.writeExternalData());
        vals.put (SINGLEREFERENCE_Narrative, _Narrative.writeExternalData());
        vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
        
    }


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

        if (other instanceof BaseFactorScore)
        {
            BaseFactorScore otherFactorScore = (BaseFactorScore)(other);

            
            if (!HELPER_Score.compare(this._Score, otherFactorScore._Score))
            {
                listener.notifyFieldChange(this, other, FIELD_Score, HELPER_Score.toObject(this._Score), HELPER_Score.toObject(otherFactorScore._Score));
            }
            if (!HELPER_ColorRank.compare(this._ColorRank, otherFactorScore._ColorRank))
            {
                listener.notifyFieldChange(this, other, FIELD_ColorRank, HELPER_ColorRank.toObject(this._ColorRank), HELPER_ColorRank.toObject(otherFactorScore._ColorRank));
            }
            if (!HELPER_WghtdScore.compare(this._WghtdScore, otherFactorScore._WghtdScore))
            {
                listener.notifyFieldChange(this, other, FIELD_WghtdScore, HELPER_WghtdScore.toObject(this._WghtdScore), HELPER_WghtdScore.toObject(otherFactorScore._WghtdScore));
            }

            // Compare single assocs
            _TestAnalysis.compare (otherFactorScore._TestAnalysis, listener);
            _Factor.compare (otherFactorScore._Factor, listener);
            _Level.compare (otherFactorScore._Level, listener);
            _Narrative.compare (otherFactorScore._Narrative, listener);
            _Candidate.compare (otherFactorScore._Candidate, listener);
            

            // Compare multiple assocs
            
        }
    }


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

        visitor.visitField(this, FIELD_ColorCode, HELPER_ColorCode.toObject(getColorCode()));
        
    }


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

        visitor.visitField(this, FIELD_Score, HELPER_Score.toObject(getScore()));
        visitor.visitField(this, FIELD_ColorRank, HELPER_ColorRank.toObject(getColorRank()));
        visitor.visitField(this, FIELD_WghtdScore, HELPER_WghtdScore.toObject(getWghtdScore()));
        visitor.visitAssociation (_TestAnalysis);
        visitor.visitAssociation (_Factor);
        visitor.visitAssociation (_Level);
        visitor.visitAssociation (_Narrative);
        visitor.visitAssociation (_Candidate);
        
    }


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

        if (scope.includes (_TestAnalysis))
        {
            visitor.visit (_TestAnalysis);
        }
        if (scope.includes (_Factor))
        {
            visitor.visit (_Factor);
        }
        if (scope.includes (_Level))
        {
            visitor.visit (_Level);
        }
        if (scope.includes (_Narrative))
        {
            visitor.visit (_Narrative);
        }
        if (scope.includes (_Candidate))
        {
            visitor.visit (_Candidate);
        }
        
    }


    public static FactorScore createFactorScore (ObjectTransaction transaction) throws StorageException
    {
        FactorScore     result = new FactorScore ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static FactorScore getFactorScoreByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (FactorScore)(transaction.getObjectByID (REFERENCE_FactorScore, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_Score))
        {
            return filter.matches (getScore ());
        }
        else if (attribName.equals (FIELD_ColorRank))
        {
            return filter.matches (getColorRank ());
        }
        else if (attribName.equals (FIELD_WghtdScore))
        {
            return filter.matches (getWghtdScore ());
        }
        else if (attribName.equals (SINGLEREFERENCE_TestAnalysis))
        {
            return filter.matches (getTestAnalysis ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Factor))
        {
            return filter.matches (getFactor ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Level))
        {
            return filter.matches (getLevel ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Narrative))
        {
            return filter.matches (getNarrative ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Candidate))
        {
            return filter.matches (getCandidate ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
            public SearchAll andScore (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_score.score_number", "Score");
                return this;
            }
            
            public SearchAll andColorRank (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_score.color_rank", "ColorRank");
                return this;
            }
            
            public SearchAll andWghtdScore (QueryFilter<Integer> filter)
            {
                filter.addFilter (context, "tl_score.wghtd_score", "WghtdScore");
                return this;
            }
            
            public SearchAll andTestAnalysis (QueryFilter<TestAnalysis> filter)
            {
                filter.addFilter (context, "tl_score.test_analysis_id", "TestAnalysis");
                return this;
            }
            
            public SearchAll andFactor (QueryFilter<Factor> filter)
            {
                filter.addFilter (context, "tl_score.factor_number", "Factor");
                return this;
            }
            
            public SearchAll andLevel (QueryFilter<Level> filter)
            {
                filter.addFilter (context, "tl_score.level_number", "Level");
                return this;
            }
            
            public SearchAll andNarrative (QueryFilter<Narrative> filter)
            {
                filter.addFilter (context, "tl_score.narrative_id", "Narrative");
                return this;
            }
            
            public SearchAll andCandidate (QueryFilter<Candidate> filter)
            {
                filter.addFilter (context, "tl_score.candidate_id", "Candidate");
                return this;
            }
            
                public FactorScore[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_FactorScore, SEARCH_All, criteria);
            Set<FactorScore>   typedResults = new LinkedHashSet <FactorScore> ();
            for (BaseBusinessClass bbcResult : results)
            {
                FactorScore aResult = (FactorScore)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new FactorScore[0]);
                            
        }
    }

        
                public static FactorScore[]
             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_Score))
        {
            return HELPER_Score.toObject (getScore ());
        }
        else if (attribName.equals (FIELD_ColorRank))
        {
            return HELPER_ColorRank.toObject (getColorRank ());
        }
        else if (attribName.equals (FIELD_WghtdScore))
        {
            return HELPER_WghtdScore.toObject (getWghtdScore ());
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            return HELPER_ColorCode.toObject (getColorCode ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_Score))
        {
            return HELPER_Score;
        }
        else if (attribName.equals (FIELD_ColorRank))
        {
            return HELPER_ColorRank;
        }
        else if (attribName.equals (FIELD_WghtdScore))
        {
            return HELPER_WghtdScore;
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            return HELPER_ColorCode;
        }
        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_Score))
        {
            setScore ((Integer)(HELPER_Score.fromObject (_Score, attribValue)));            
        }
        else if (attribName.equals (FIELD_ColorRank))
        {
            setColorRank ((Integer)(HELPER_ColorRank.fromObject (_ColorRank, attribValue)));            
        }
        else if (attribName.equals (FIELD_WghtdScore))
        {
            setWghtdScore ((Integer)(HELPER_WghtdScore.fromObject (_WghtdScore, attribValue)));            
        }
        else if (attribName.equals (FIELD_ColorCode))
        {
            setColorCode ((ColorCode)(HELPER_ColorCode.fromObject (_ColorCode, 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_Score))
        {
            return getWriteability_Score ();
        }
        else if (fieldName.equals (FIELD_ColorRank))
        {
            return getWriteability_ColorRank ();
        }
        else if (fieldName.equals (FIELD_WghtdScore))
        {
            return getWriteability_WghtdScore ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_TestAnalysis))
        {
            return getWriteability_TestAnalysis ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Factor))
        {
            return getWriteability_Factor ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Level))
        {
            return getWriteability_Level ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Narrative))
        {
            return getWriteability_Narrative ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Candidate))
        {
            return getWriteability_Candidate ();
        }
        else if (fieldName.equals (FIELD_ColorCode))
        {
            return getWriteability_ColorCode ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_Score () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Score);
            }
        
            if (getWriteability_ColorRank () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ColorRank);
            }
        
            if (getWriteability_WghtdScore () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_WghtdScore);
            }
        
            if (getWriteability_ColorCode () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ColorCode);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_Score.getAttribObject (getClass (), _Score, false, FIELD_Score));
        result.add(HELPER_ColorRank.getAttribObject (getClass (), _ColorRank, false, FIELD_ColorRank));
        result.add(HELPER_WghtdScore.getAttribObject (getClass (), _WghtdScore, false, FIELD_WghtdScore));
        result.add(HELPER_ColorCode.getAttribObject (getClass (), _ColorCode, false, FIELD_ColorCode));

        return result;
    }


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


    public Object getAttributeMetadata (String attribute, String metadata)
    {
        if (ATTRIBUTES_METADATA_FactorScore.containsKey (attribute))
        {
            return ((Map)ATTRIBUTES_METADATA_FactorScore.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 FactorScoreBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<FactorScore>
    {

    /**
     * Get the attribute Score
     */
    public Integer getScore (FactorScore obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Score.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setScore (FactorScore obj, Integer newScore) throws FieldException
    {
        return newScore;
    }

    /**
     * Get the attribute ColorRank
     */
    public Integer getColorRank (FactorScore obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ColorRank.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setColorRank (FactorScore obj, Integer newColorRank) throws FieldException
    {
        return newColorRank;
    }

    /**
     * Get the attribute WghtdScore
     */
    public Integer getWghtdScore (FactorScore obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute WghtdScore.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setWghtdScore (FactorScore obj, Integer newWghtdScore) throws FieldException
    {
        return newWghtdScore;
    }

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

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

    }

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

        public FactorScorePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("ColorCode"))
            {
                return toColorCode ();
            }                
            if (name.equals ("Score"))
            {
                return toScore ();
            }                
            if (name.equals ("ColorRank"))
            {
                return toColorRank ();
            }                
            if (name.equals ("WghtdScore"))
            {
                return toWghtdScore ();
            }                
            if (name.equals ("TestAnalysis"))
            {
                return toTestAnalysis ();
            }                
            if (name.equals ("Factor"))
            {
                return toFactor ();
            }                
            if (name.equals ("Level"))
            {
                return toLevel ();
            }                
            if (name.equals ("Narrative"))
            {
                return toNarrative ();
            }                
            if (name.equals ("Candidate"))
            {
                return toCandidate ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, ColorCode> toColorCode () { return pipe(new ORMAttributePipe<Me, ColorCode>(FIELD_ColorCode));  }
        
        public PipeLine<From, Integer> toScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_Score));  }
        
        public PipeLine<From, Integer> toColorRank () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_ColorRank));  }
        
        public PipeLine<From, Integer> toWghtdScore () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_WghtdScore));  }
        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 Factor.FactorPipeLineFactory<From, Factor> toFactor () { return toFactor (Filter.ALL); }

        public Factor.FactorPipeLineFactory<From, Factor> toFactor (Filter<Factor> filter) 
        { 
            return Factor.REFERENCE_Factor.new FactorPipeLineFactory<From, Factor> (this, new ORMSingleAssocPipe<Me, Factor>(SINGLEREFERENCE_Factor, filter)); 
        }
        public Level.LevelPipeLineFactory<From, Level> toLevel () { return toLevel (Filter.ALL); }

        public Level.LevelPipeLineFactory<From, Level> toLevel (Filter<Level> filter) 
        { 
            return Level.REFERENCE_Level.new LevelPipeLineFactory<From, Level> (this, new ORMSingleAssocPipe<Me, Level>(SINGLEREFERENCE_Level, filter)); 
        }
        public Narrative.NarrativePipeLineFactory<From, Narrative> toNarrative () { return toNarrative (Filter.ALL); }

        public Narrative.NarrativePipeLineFactory<From, Narrative> toNarrative (Filter<Narrative> filter) 
        { 
            return Narrative.REFERENCE_Narrative.new NarrativePipeLineFactory<From, Narrative> (this, new ORMSingleAssocPipe<Me, Narrative>(SINGLEREFERENCE_Narrative, filter)); 
        }
        public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }

        public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate (Filter<Candidate> filter) 
        { 
            return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "ColorCode"))
        {
            return true;
        }
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

class DummyFactorScore extends FactorScore
{
    // Default constructor primarily to support Externalisable
    public DummyFactorScore()
    {
        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();
    }

    public Factor getFactor () throws StorageException
    {
        return (Factor)(Factor.DUMMY_Factor);
    }


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

    public Level getLevel () throws StorageException
    {
        return (Level)(Level.DUMMY_Level);
    }


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

    public Narrative getNarrative () throws StorageException
    {
        return (Narrative)(Narrative.DUMMY_Narrative);
    }


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

    public Candidate getCandidate () throws StorageException
    {
        return (Candidate)(Candidate.DUMMY_Candidate);
    }


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

}

    
