/*
 * 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 oneit.security.*;



public abstract class BaseCandidate extends SecUserExtension
{
    // Reference instance for the object
    public static final Candidate REFERENCE_Candidate = new Candidate ();

    // Reference instance for the object
    public static final Candidate DUMMY_Candidate = new DummyCandidate ();

    // Static constants corresponding to field names
    
    public static final String FIELD_Phone = "Phone";
    public static final String FIELD_ForgotPasswordMailSendDate = "ForgotPasswordMailSendDate";
    public static final String FIELD_ForgotPasswordKey = "ForgotPasswordKey";
    public static final String FIELD_VerificationMailSendDate = "VerificationMailSendDate";
    public static final String FIELD_VerificationKey = "VerificationKey";
    public static final String FIELD_IsAccountVerified = "IsAccountVerified";
    public static final String FIELD_PrivacyPolicyAgreed = "PrivacyPolicyAgreed";
    public static final String FIELD_ConditionsAgreed = "ConditionsAgreed";
    public static final String SINGLEREFERENCE_TestInput = "TestInput";
    public static final String BACKREF_TestInput = "";
    public static final String MULTIPLEREFERENCE_TestAnalysises = "TestAnalysises";
    public static final String BACKREF_TestAnalysises = "";
    public static final String MULTIPLEREFERENCE_JobApplications = "JobApplications";
    public static final String BACKREF_JobApplications = "";
    public static final String MULTIPLEREFERENCE_CultureCriteriaAnswers = "CultureCriteriaAnswers";
    public static final String BACKREF_CultureCriteriaAnswers = "";
    public static final String MULTIPLEREFERENCE_ProfileAssessmentAnswers = "ProfileAssessmentAnswers";
    public static final String BACKREF_ProfileAssessmentAnswers = "";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<Candidate> HELPER_Phone = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_ForgotPasswordMailSendDate = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_ForgotPasswordKey = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_VerificationMailSendDate = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_VerificationKey = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_IsAccountVerified = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_PrivacyPolicyAgreed = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Candidate> HELPER_ConditionsAgreed = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private String _Phone;
    private Date _ForgotPasswordMailSendDate;
    private String _ForgotPasswordKey;
    private Date _VerificationMailSendDate;
    private String _VerificationKey;
    private Boolean _IsAccountVerified;
    private Boolean _PrivacyPolicyAgreed;
    private Boolean _ConditionsAgreed;
    

    // Private attributes corresponding to single references
    private SingleAssociation<Candidate, TestInput> _TestInput;
    

    // Private attributes corresponding to multiple references
    private MultipleAssociation<Candidate, TestAnalysis> _TestAnalysises;
    private MultipleAssociation<Candidate, JobApplication> _JobApplications;
    private MultipleAssociation<Candidate, CultureCriteriaAnswer> _CultureCriteriaAnswers;
    private MultipleAssociation<Candidate, Answer> _ProfileAssessmentAnswers;
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_PrivacyPolicyAgreed_Validators;
    private static final AttributeValidator[] FIELD_ConditionsAgreed_Validators;
    private static final AttributeValidator[] FIELD_Phone_Validators;
    private static final AttributeValidator[] FIELD_ForgotPasswordMailSendDate_Validators;
    private static final AttributeValidator[] FIELD_ForgotPasswordKey_Validators;
    private static final AttributeValidator[] FIELD_VerificationMailSendDate_Validators;
    private static final AttributeValidator[] FIELD_VerificationKey_Validators;
    private static final AttributeValidator[] FIELD_IsAccountVerified_Validators;
    

    // Arrays of behaviour decorators
    private static final CandidateBehaviourDecorator[] Candidate_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_TestAnalysises = TestAnalysis.BACKREF_Candidate;
            String tmp_JobApplications = JobApplication.BACKREF_Candidate;
            String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_Candidate;
            String tmp_ProfileAssessmentAnswers = Answer.BACKREF_Candidate;
            String tmp_TestInput = TestInput.BACKREF_Candidates;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_TestAnalysises();
            setupAssocMetaData_JobApplications();
            setupAssocMetaData_CultureCriteriaAnswers();
            setupAssocMetaData_ProfileAssessmentAnswers();
            setupAssocMetaData_TestInput();
            FIELD_PrivacyPolicyAgreed_Validators = (AttributeValidator[])setupAttribMetaData_PrivacyPolicyAgreed(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ConditionsAgreed_Validators = (AttributeValidator[])setupAttribMetaData_ConditionsAgreed(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Phone_Validators = (AttributeValidator[])setupAttribMetaData_Phone(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ForgotPasswordMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ForgotPasswordKey_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordKey(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_VerificationMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_VerificationMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_VerificationKey_Validators = (AttributeValidator[])setupAttribMetaData_VerificationKey(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IsAccountVerified_Validators = (AttributeValidator[])setupAttribMetaData_IsAccountVerified(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_Candidate.initialiseReference ();
            DUMMY_Candidate.initialiseReference ();
            Candidate_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Candidate.class).toArray(new CandidateBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

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

        metaInfo.put ("backreferenceName", "Candidate");
        metaInfo.put ("name", "TestAnalysises");
        metaInfo.put ("type", "TestAnalysis");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.TestAnalysises:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_TestAnalysises, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_JobApplications()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "Candidate");
        metaInfo.put ("name", "JobApplications");
        metaInfo.put ("type", "JobApplication");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.JobApplications:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_JobApplications, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_CultureCriteriaAnswers()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "Candidate");
        metaInfo.put ("name", "CultureCriteriaAnswers");
        metaInfo.put ("type", "CultureCriteriaAnswer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.CultureCriteriaAnswers:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_ProfileAssessmentAnswers()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "Candidate");
        metaInfo.put ("name", "ProfileAssessmentAnswers");
        metaInfo.put ("type", "Answer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.ProfileAssessmentAnswers:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_TestInput()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "Candidates");
        metaInfo.put ("dbcol", "test_input_id");
        metaInfo.put ("name", "TestInput");
        metaInfo.put ("type", "TestInput");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.TestInput:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (SINGLEREFERENCE_TestInput, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static List setupAttribMetaData_PrivacyPolicyAgreed(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "PrivacyPolicyAgreed");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.PrivacyPolicyAgreed:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_PrivacyPolicyAgreed, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "ConditionsAgreed");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.ConditionsAgreed:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_ConditionsAgreed, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "phone");
        metaInfo.put ("length", "30");
        metaInfo.put ("name", "Phone");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.Phone:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_Phone, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "forgot_password_mail_send_date");
        metaInfo.put ("name", "ForgotPasswordMailSendDate");
        metaInfo.put ("type", "Date");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.ForgotPasswordMailSendDate:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_ForgotPasswordMailSendDate, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "forgot_password_key");
        metaInfo.put ("length", "10");
        metaInfo.put ("name", "ForgotPasswordKey");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.ForgotPasswordKey:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_ForgotPasswordKey, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "verification_mail_send_date");
        metaInfo.put ("name", "VerificationMailSendDate");
        metaInfo.put ("type", "Date");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.VerificationMailSendDate:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_VerificationMailSendDate, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "verification_key");
        metaInfo.put ("length", "10");
        metaInfo.put ("name", "VerificationKey");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.VerificationKey:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_VerificationKey, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "is_account_verified");
        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "IsAccountVerified");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Candidate.IsAccountVerified:", metaInfo);
        ATTRIBUTES_METADATA_Candidate.put (FIELD_IsAccountVerified, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _Phone = (String)(HELPER_Phone.initialise (_Phone));
        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.initialise (_ForgotPasswordMailSendDate));
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.initialise (_ForgotPasswordKey));
        _VerificationMailSendDate = (Date)(HELPER_VerificationMailSendDate.initialise (_VerificationMailSendDate));
        _VerificationKey = (String)(HELPER_VerificationKey.initialise (_VerificationKey));
        _IsAccountVerified = (Boolean)(Boolean.FALSE);
        _PrivacyPolicyAgreed = (Boolean)(Boolean.FALSE);
        _ConditionsAgreed = (Boolean)(Boolean.FALSE);
    }


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

        _TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "oneit_sec_user_extension");
        _TestAnalysises = new MultipleAssociation<Candidate, TestAnalysis> (this, MULTIPLEREFERENCE_TestAnalysises, TestAnalysis.SINGLEREFERENCE_Candidate, TestAnalysis.REFERENCE_TestAnalysis);
        _JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
        _CultureCriteriaAnswers = new MultipleAssociation<Candidate, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_Candidate, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
        _ProfileAssessmentAnswers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer);
        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _TestInput = new SingleAssociation<Candidate, TestInput> (this, SINGLEREFERENCE_TestInput, TestInput.MULTIPLEREFERENCE_Candidates, TestInput.REFERENCE_TestInput, "oneit_sec_user_extension");
        _TestAnalysises = new MultipleAssociation<Candidate, TestAnalysis> (this, MULTIPLEREFERENCE_TestAnalysises, TestAnalysis.SINGLEREFERENCE_Candidate, TestAnalysis.REFERENCE_TestAnalysis);
        _JobApplications = new MultipleAssociation<Candidate, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Candidate, JobApplication.REFERENCE_JobApplication);
        _CultureCriteriaAnswers = new MultipleAssociation<Candidate, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_Candidate, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
        _ProfileAssessmentAnswers = new MultipleAssociation<Candidate, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_Candidate, Answer.REFERENCE_Answer);
        
        
        return this;
    }

    

    /**
     * Get the attribute Phone
     */
    public String getPhone ()
    {
        assertValid();
        String valToReturn = _Phone;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getPhone ((Candidate)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 prePhoneChange (String newPhone) 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 postPhoneChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Phone.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setPhone (String newPhone) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Phone.compare (_Phone, newPhone);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newPhone = bhd.setPhone ((Candidate)this, newPhone);
                oldAndNewIdentical = HELPER_Phone.compare (_Phone, newPhone);
            }

            

            if (FIELD_Phone_Validators.length > 0)
            {
                Object newPhoneObj = HELPER_Phone.toObject (newPhone);

                if (newPhoneObj != null)
                {
                    int     loopMax = FIELD_Phone_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_Phone);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Phone () != FieldWriteability.FALSE, "Field  Phone is not writeable");
            prePhoneChange (newPhone);
            markFieldChange (FIELD_Phone);
            _Phone = newPhone;            
            postFieldChange (FIELD_Phone);
            postPhoneChange ();
        }
    }

    /**
     * Get the attribute ForgotPasswordMailSendDate
     */
    public Date getForgotPasswordMailSendDate ()
    {
        assertValid();
        Date valToReturn = _ForgotPasswordMailSendDate;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getForgotPasswordMailSendDate ((Candidate)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 preForgotPasswordMailSendDateChange (Date newForgotPasswordMailSendDate) 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 postForgotPasswordMailSendDateChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ForgotPasswordMailSendDate.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setForgotPasswordMailSendDate (Date newForgotPasswordMailSendDate) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ForgotPasswordMailSendDate.compare (_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newForgotPasswordMailSendDate = bhd.setForgotPasswordMailSendDate ((Candidate)this, newForgotPasswordMailSendDate);
                oldAndNewIdentical = HELPER_ForgotPasswordMailSendDate.compare (_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);
            }

            

            if (FIELD_ForgotPasswordMailSendDate_Validators.length > 0)
            {
                Object newForgotPasswordMailSendDateObj = HELPER_ForgotPasswordMailSendDate.toObject (newForgotPasswordMailSendDate);

                if (newForgotPasswordMailSendDateObj != null)
                {
                    int     loopMax = FIELD_ForgotPasswordMailSendDate_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_ForgotPasswordMailSendDate);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.FALSE, "Field  ForgotPasswordMailSendDate is not writeable");
            preForgotPasswordMailSendDateChange (newForgotPasswordMailSendDate);
            markFieldChange (FIELD_ForgotPasswordMailSendDate);
            _ForgotPasswordMailSendDate = newForgotPasswordMailSendDate;            
            postFieldChange (FIELD_ForgotPasswordMailSendDate);
            postForgotPasswordMailSendDateChange ();
        }
    }

    /**
     * Get the attribute ForgotPasswordKey
     */
    public String getForgotPasswordKey ()
    {
        assertValid();
        String valToReturn = _ForgotPasswordKey;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getForgotPasswordKey ((Candidate)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 preForgotPasswordKeyChange (String newForgotPasswordKey) 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 postForgotPasswordKeyChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ForgotPasswordKey.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setForgotPasswordKey (String newForgotPasswordKey) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ForgotPasswordKey.compare (_ForgotPasswordKey, newForgotPasswordKey);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newForgotPasswordKey = bhd.setForgotPasswordKey ((Candidate)this, newForgotPasswordKey);
                oldAndNewIdentical = HELPER_ForgotPasswordKey.compare (_ForgotPasswordKey, newForgotPasswordKey);
            }

            

            if (FIELD_ForgotPasswordKey_Validators.length > 0)
            {
                Object newForgotPasswordKeyObj = HELPER_ForgotPasswordKey.toObject (newForgotPasswordKey);

                if (newForgotPasswordKeyObj != null)
                {
                    int     loopMax = FIELD_ForgotPasswordKey_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_ForgotPasswordKey);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ForgotPasswordKey () != FieldWriteability.FALSE, "Field  ForgotPasswordKey is not writeable");
            preForgotPasswordKeyChange (newForgotPasswordKey);
            markFieldChange (FIELD_ForgotPasswordKey);
            _ForgotPasswordKey = newForgotPasswordKey;            
            postFieldChange (FIELD_ForgotPasswordKey);
            postForgotPasswordKeyChange ();
        }
    }

    /**
     * Get the attribute VerificationMailSendDate
     */
    public Date getVerificationMailSendDate ()
    {
        assertValid();
        Date valToReturn = _VerificationMailSendDate;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getVerificationMailSendDate ((Candidate)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 preVerificationMailSendDateChange (Date newVerificationMailSendDate) 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 postVerificationMailSendDateChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute VerificationMailSendDate.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setVerificationMailSendDate (Date newVerificationMailSendDate) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_VerificationMailSendDate.compare (_VerificationMailSendDate, newVerificationMailSendDate);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newVerificationMailSendDate = bhd.setVerificationMailSendDate ((Candidate)this, newVerificationMailSendDate);
                oldAndNewIdentical = HELPER_VerificationMailSendDate.compare (_VerificationMailSendDate, newVerificationMailSendDate);
            }

            

            if (FIELD_VerificationMailSendDate_Validators.length > 0)
            {
                Object newVerificationMailSendDateObj = HELPER_VerificationMailSendDate.toObject (newVerificationMailSendDate);

                if (newVerificationMailSendDateObj != null)
                {
                    int     loopMax = FIELD_VerificationMailSendDate_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_VerificationMailSendDate);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_VerificationMailSendDate () != FieldWriteability.FALSE, "Field  VerificationMailSendDate is not writeable");
            preVerificationMailSendDateChange (newVerificationMailSendDate);
            markFieldChange (FIELD_VerificationMailSendDate);
            _VerificationMailSendDate = newVerificationMailSendDate;            
            postFieldChange (FIELD_VerificationMailSendDate);
            postVerificationMailSendDateChange ();
        }
    }

    /**
     * Get the attribute VerificationKey
     */
    public String getVerificationKey ()
    {
        assertValid();
        String valToReturn = _VerificationKey;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getVerificationKey ((Candidate)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 preVerificationKeyChange (String newVerificationKey) 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 postVerificationKeyChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute VerificationKey.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setVerificationKey (String newVerificationKey) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_VerificationKey.compare (_VerificationKey, newVerificationKey);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newVerificationKey = bhd.setVerificationKey ((Candidate)this, newVerificationKey);
                oldAndNewIdentical = HELPER_VerificationKey.compare (_VerificationKey, newVerificationKey);
            }

            

            if (FIELD_VerificationKey_Validators.length > 0)
            {
                Object newVerificationKeyObj = HELPER_VerificationKey.toObject (newVerificationKey);

                if (newVerificationKeyObj != null)
                {
                    int     loopMax = FIELD_VerificationKey_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_VerificationKey);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_VerificationKey () != FieldWriteability.FALSE, "Field  VerificationKey is not writeable");
            preVerificationKeyChange (newVerificationKey);
            markFieldChange (FIELD_VerificationKey);
            _VerificationKey = newVerificationKey;            
            postFieldChange (FIELD_VerificationKey);
            postVerificationKeyChange ();
        }
    }

    /**
     * Get the attribute IsAccountVerified
     */
    public Boolean getIsAccountVerified ()
    {
        assertValid();
        Boolean valToReturn = _IsAccountVerified;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getIsAccountVerified ((Candidate)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 preIsAccountVerifiedChange (Boolean newIsAccountVerified) 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 postIsAccountVerifiedChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute IsAccountVerified.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIsAccountVerified (Boolean newIsAccountVerified) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_IsAccountVerified.compare (_IsAccountVerified, newIsAccountVerified);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newIsAccountVerified = bhd.setIsAccountVerified ((Candidate)this, newIsAccountVerified);
                oldAndNewIdentical = HELPER_IsAccountVerified.compare (_IsAccountVerified, newIsAccountVerified);
            }

            

            if (FIELD_IsAccountVerified_Validators.length > 0)
            {
                Object newIsAccountVerifiedObj = HELPER_IsAccountVerified.toObject (newIsAccountVerified);

                if (newIsAccountVerifiedObj != null)
                {
                    int     loopMax = FIELD_IsAccountVerified_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_IsAccountVerified);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_IsAccountVerified () != FieldWriteability.FALSE, "Field  IsAccountVerified is not writeable");
            preIsAccountVerifiedChange (newIsAccountVerified);
            markFieldChange (FIELD_IsAccountVerified);
            _IsAccountVerified = newIsAccountVerified;            
            postFieldChange (FIELD_IsAccountVerified);
            postIsAccountVerifiedChange ();
        }
    }

    /**
     * Get the attribute PrivacyPolicyAgreed
     */
    public Boolean getPrivacyPolicyAgreed ()
    {
        assertValid();
        Boolean valToReturn = _PrivacyPolicyAgreed;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getPrivacyPolicyAgreed ((Candidate)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 prePrivacyPolicyAgreedChange (Boolean newPrivacyPolicyAgreed) 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 postPrivacyPolicyAgreedChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute PrivacyPolicyAgreed.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setPrivacyPolicyAgreed (Boolean newPrivacyPolicyAgreed) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_PrivacyPolicyAgreed.compare (_PrivacyPolicyAgreed, newPrivacyPolicyAgreed);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newPrivacyPolicyAgreed = bhd.setPrivacyPolicyAgreed ((Candidate)this, newPrivacyPolicyAgreed);
                oldAndNewIdentical = HELPER_PrivacyPolicyAgreed.compare (_PrivacyPolicyAgreed, newPrivacyPolicyAgreed);
            }

            

            if (FIELD_PrivacyPolicyAgreed_Validators.length > 0)
            {
                Object newPrivacyPolicyAgreedObj = HELPER_PrivacyPolicyAgreed.toObject (newPrivacyPolicyAgreed);

                if (newPrivacyPolicyAgreedObj != null)
                {
                    int     loopMax = FIELD_PrivacyPolicyAgreed_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_PrivacyPolicyAgreed);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_PrivacyPolicyAgreed () != FieldWriteability.FALSE, "Field  PrivacyPolicyAgreed is not writeable");
            prePrivacyPolicyAgreedChange (newPrivacyPolicyAgreed);
            markFieldChange (FIELD_PrivacyPolicyAgreed);
            _PrivacyPolicyAgreed = newPrivacyPolicyAgreed;            
            postFieldChange (FIELD_PrivacyPolicyAgreed);
            postPrivacyPolicyAgreedChange ();
        }
    }

    /**
     * Get the attribute ConditionsAgreed
     */
    public Boolean getConditionsAgreed ()
    {
        assertValid();
        Boolean valToReturn = _ConditionsAgreed;

            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                valToReturn = bhd.getConditionsAgreed ((Candidate)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 preConditionsAgreedChange (Boolean newConditionsAgreed) 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 postConditionsAgreedChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ConditionsAgreed.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setConditionsAgreed (Boolean newConditionsAgreed) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ConditionsAgreed.compare (_ConditionsAgreed, newConditionsAgreed);
        
        try
        {
            for (CandidateBehaviourDecorator bhd : Candidate_BehaviourDecorators)
            {
                newConditionsAgreed = bhd.setConditionsAgreed ((Candidate)this, newConditionsAgreed);
                oldAndNewIdentical = HELPER_ConditionsAgreed.compare (_ConditionsAgreed, newConditionsAgreed);
            }

            

            if (FIELD_ConditionsAgreed_Validators.length > 0)
            {
                Object newConditionsAgreedObj = HELPER_ConditionsAgreed.toObject (newConditionsAgreed);

                if (newConditionsAgreedObj != null)
                {
                    int     loopMax = FIELD_ConditionsAgreed_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Candidate.get (FIELD_ConditionsAgreed);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ConditionsAgreed () != FieldWriteability.FALSE, "Field  ConditionsAgreed is not writeable");
            preConditionsAgreedChange (newConditionsAgreed);
            markFieldChange (FIELD_ConditionsAgreed);
            _ConditionsAgreed = newConditionsAgreed;            
            postFieldChange (FIELD_ConditionsAgreed);
            postConditionsAgreedChange ();
        }
    }



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

        
        result.add("TestInput");
        

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_TestInput))
        {
            return _TestInput.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_TestInput))
        {
            return TestInput.MULTIPLEREFERENCE_Candidates ;
        }
        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_TestInput))
        {
            return getTestInput ();
        }
        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_TestInput))
        {
            return getTestInput (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_TestInput))
        {
            return getTestInputID ();
        }
        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_TestInput))
        {
            setTestInput ((TestInput)(newValue));
        }
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getTestInputID ()
    {
        assertValid();
        
        if (_TestInput == null)
        {
            return null;
        }
        else
        {
            return _TestInput.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 preTestInputChange (TestInput newTestInput) 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 postTestInputChange () throws FieldException
    {
    }



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

        if (_TestInput.wouldReferencedChange (newTestInput))
        {
            assertValid();
            Debug.assertion (getWriteability_TestInput () != FieldWriteability.FALSE, "Assoc TestInput is not writeable");
            preTestInputChange (newTestInput);
            TestInput oldTestInput = getTestInput ();

                    if (oldTestInput != null)
                    {
                        // This is to stop validation from triggering when we are removed
                        _TestInput.set (null);
                        oldTestInput.removeFromCandidates ((Candidate)(this));
                    }

                    _TestInput.set (newTestInput);

                    if (newTestInput != null)
                    {
                        newTestInput.addToCandidates ((Candidate)(this));
                    }
                
            postTestInputChange ();
        }
    }

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

        
        result.add("TestAnalysises");
        
        result.add("JobApplications");
        
        result.add("CultureCriteriaAnswers");
        
        result.add("ProfileAssessmentAnswers");
        

        return result;
    }


    /**
     * Get the reference instance for the multi assoc name.
     */
    public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            return TestAnalysis.REFERENCE_TestAnalysis ;
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return JobApplication.REFERENCE_JobApplication ;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer ;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return Answer.REFERENCE_Answer ;
        }
        

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            return TestAnalysis.SINGLEREFERENCE_Candidate ;
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return JobApplication.SINGLEREFERENCE_Candidate ;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return CultureCriteriaAnswer.SINGLEREFERENCE_Candidate ;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return Answer.SINGLEREFERENCE_Candidate ;
        }
        

        return super.getMultiAssocBackReference(attribName);
    }


    /**
     * Get the assoc count for the multi assoc name.
     */
    public int getMultiAssocCount(String attribName) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            return this.getTestAnalysisesCount();
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return this.getJobApplicationsCount();
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return this.getCultureCriteriaAnswersCount();
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return this.getProfileAssessmentAnswersCount();
        }
        

        return super.getMultiAssocCount(attribName);
    }


    /**
     * Get the assoc at a particular index
     */
    public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            return this.getTestAnalysisesAt(index);
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return this.getJobApplicationsAt(index);
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return this.getCultureCriteriaAnswersAt(index);
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return this.getProfileAssessmentAnswersAt(index);
        }
        

        return super.getMultiAssocAt(attribName, index);
    }


    /**
     * Add to a multi assoc by attribute name
     */
    public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            addToTestAnalysises((TestAnalysis)newElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            addToJobApplications((JobApplication)newElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            addToCultureCriteriaAnswers((CultureCriteriaAnswer)newElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            addToProfileAssessmentAnswers((Answer)newElement);

            return;
        }
        

        super.addToMultiAssoc(attribName, newElement);
    }

    /**
     * Remove from a multi assoc by attribute name
     */
    public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            removeFromTestAnalysises((TestAnalysis)oldElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            removeFromJobApplications((JobApplication)oldElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            removeFromCultureCriteriaAnswers((CultureCriteriaAnswer)oldElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            removeFromProfileAssessmentAnswers((Answer)oldElement);

            return;
        }
        

        super.removeFromMultiAssoc(attribName, oldElement);
    }


    protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            _TestAnalysises.__loadAssociation (elements);
            return;
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            _JobApplications.__loadAssociation (elements);
            return;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            _CultureCriteriaAnswers.__loadAssociation (elements);
            return;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            _ProfileAssessmentAnswers.__loadAssociation (elements);
            return;
        }
        

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {
        
        if (MULTIPLEREFERENCE_TestAnalysises.equals(attribName))
        {
            return _TestAnalysises.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return _JobApplications.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return _CultureCriteriaAnswers.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return _ProfileAssessmentAnswers.isLoaded ();
        }
        

        return super.__isMultiAssocLoaded(attribName);
    }

    

    public FieldWriteability getWriteability_TestAnalysises ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getTestAnalysisesCount () throws StorageException
    {
        assertValid();
        return _TestAnalysises.getReferencedObjectsCount ();
    }


    public void addToTestAnalysises (TestAnalysis newElement) throws StorageException
    {
        if (_TestAnalysises.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_TestAnalysises () != FieldWriteability.FALSE, "MultiAssoc TestAnalysises is not writeable (add)");
            _TestAnalysises.appendElement (newElement);

            try
            {
                if (newElement.getCandidate () != this)
                {
                    newElement.setCandidate ((Candidate)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromTestAnalysises (TestAnalysis elementToRemove) throws StorageException
    {
        if (_TestAnalysises.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_TestAnalysises () != FieldWriteability.FALSE, "MultiAssoc TestAnalysises is not writeable (remove)");
            _TestAnalysises.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getCandidate () != null)
                {
                    elementToRemove.setCandidate (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public TestAnalysis getTestAnalysisesAt (int index) throws StorageException
    {
        return (TestAnalysis)(_TestAnalysises.getElementAt (index));
    }


    public SortedSet<TestAnalysis> getTestAnalysisesSet () throws StorageException
    {
        return _TestAnalysises.getSet ();
    }

    public FieldWriteability getWriteability_JobApplications ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getJobApplicationsCount () throws StorageException
    {
        assertValid();
        return _JobApplications.getReferencedObjectsCount ();
    }


    public void addToJobApplications (JobApplication newElement) throws StorageException
    {
        if (_JobApplications.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_JobApplications () != FieldWriteability.FALSE, "MultiAssoc JobApplications is not writeable (add)");
            _JobApplications.appendElement (newElement);

            try
            {
                if (newElement.getCandidate () != this)
                {
                    newElement.setCandidate ((Candidate)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromJobApplications (JobApplication elementToRemove) throws StorageException
    {
        if (_JobApplications.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_JobApplications () != FieldWriteability.FALSE, "MultiAssoc JobApplications is not writeable (remove)");
            _JobApplications.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getCandidate () != null)
                {
                    elementToRemove.setCandidate (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public JobApplication getJobApplicationsAt (int index) throws StorageException
    {
        return (JobApplication)(_JobApplications.getElementAt (index));
    }


    public SortedSet<JobApplication> getJobApplicationsSet () throws StorageException
    {
        return _JobApplications.getSet ();
    }

    public FieldWriteability getWriteability_CultureCriteriaAnswers ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getCultureCriteriaAnswersCount () throws StorageException
    {
        assertValid();
        return _CultureCriteriaAnswers.getReferencedObjectsCount ();
    }


    public void addToCultureCriteriaAnswers (CultureCriteriaAnswer newElement) throws StorageException
    {
        if (_CultureCriteriaAnswers.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_CultureCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc CultureCriteriaAnswers is not writeable (add)");
            _CultureCriteriaAnswers.appendElement (newElement);

            try
            {
                if (newElement.getCandidate () != this)
                {
                    newElement.setCandidate ((Candidate)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromCultureCriteriaAnswers (CultureCriteriaAnswer elementToRemove) throws StorageException
    {
        if (_CultureCriteriaAnswers.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_CultureCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc CultureCriteriaAnswers is not writeable (remove)");
            _CultureCriteriaAnswers.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getCandidate () != null)
                {
                    elementToRemove.setCandidate (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public CultureCriteriaAnswer getCultureCriteriaAnswersAt (int index) throws StorageException
    {
        return (CultureCriteriaAnswer)(_CultureCriteriaAnswers.getElementAt (index));
    }


    public SortedSet<CultureCriteriaAnswer> getCultureCriteriaAnswersSet () throws StorageException
    {
        return _CultureCriteriaAnswers.getSet ();
    }

    public FieldWriteability getWriteability_ProfileAssessmentAnswers ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getProfileAssessmentAnswersCount () throws StorageException
    {
        assertValid();
        return _ProfileAssessmentAnswers.getReferencedObjectsCount ();
    }


    public void addToProfileAssessmentAnswers (Answer newElement) throws StorageException
    {
        if (_ProfileAssessmentAnswers.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_ProfileAssessmentAnswers () != FieldWriteability.FALSE, "MultiAssoc ProfileAssessmentAnswers is not writeable (add)");
            _ProfileAssessmentAnswers.appendElement (newElement);

            try
            {
                if (newElement.getCandidate () != this)
                {
                    newElement.setCandidate ((Candidate)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromProfileAssessmentAnswers (Answer elementToRemove) throws StorageException
    {
        if (_ProfileAssessmentAnswers.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_ProfileAssessmentAnswers () != FieldWriteability.FALSE, "MultiAssoc ProfileAssessmentAnswers is not writeable (remove)");
            _ProfileAssessmentAnswers.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getCandidate () != null)
                {
                    elementToRemove.setCandidate (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public Answer getProfileAssessmentAnswersAt (int index) throws StorageException
    {
        return (Answer)(_ProfileAssessmentAnswers.getElementAt (index));
    }


    public SortedSet<Answer> getProfileAssessmentAnswersSet () throws StorageException
    {
        return _ProfileAssessmentAnswers.getSet ();
    }



    public void onDelete ()
    {
        try 
        {
            // Ensure we are removed from any loaded multi-associations that aren't mandatory
            if (_TestInput.isLoaded () || getTransaction ().isObjectLoaded (_TestInput.getReferencedType (), getTestInputID ()))
            {
                TestInput  referenced = getTestInput ();

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidates from ", getObjectID (), " to ", referenced.getObjectID ());
                    _TestInput.set (null);
                    referenced.removeFromCandidates ((Candidate)this);
                }
            }
        
            for(TestAnalysis referenced : CollectionUtils.reverse(getTestAnalysisesSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setCandidate(null);
            }

            for(JobApplication referenced : CollectionUtils.reverse(getJobApplicationsSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setCandidate(null);
            }

            for(CultureCriteriaAnswer referenced : CollectionUtils.reverse(getCultureCriteriaAnswersSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setCandidate(null);
            }

            for(Answer referenced : CollectionUtils.reverse(getProfileAssessmentAnswersSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Candidate from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setCandidate(null);
            }

        }
        catch (Exception e)
        {
            throw NestedException.wrap(e);
        }

        super.onDelete ();
    }


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


    public Candidate referenceInstance ()
    {
        return REFERENCE_Candidate;
    }


    public Candidate getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getCandidateByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_Candidate;
    }


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





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

        oneit_sec_user_extensionPSet.setAttrib (FIELD_ObjectID, myID);
        oneit_sec_user_extensionPSet.setAttrib (FIELD_Phone, HELPER_Phone.toObject (_Phone)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject (_ForgotPasswordMailSendDate)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject (_ForgotPasswordKey)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.toObject (_VerificationMailSendDate)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_VerificationKey, HELPER_VerificationKey.toObject (_VerificationKey)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject (_IsAccountVerified)); //
        _TestInput.getPersistentSets (allSets);
        
    }


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

        
        PersistentSet   oneit_sec_user_extensionPSet = allSets.getPersistentSet (objectID, "oneit_sec_user_extension");

        _Phone = (String)(HELPER_Phone.fromObject (_Phone, oneit_sec_user_extensionPSet.getAttrib (FIELD_Phone))); //
        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordMailSendDate))); //
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordKey))); //
        _VerificationMailSendDate = (Date)(HELPER_VerificationMailSendDate.fromObject (_VerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (FIELD_VerificationMailSendDate))); //
        _VerificationKey = (String)(HELPER_VerificationKey.fromObject (_VerificationKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_VerificationKey))); //
        _IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsAccountVerified))); //
        _TestInput.setFromPersistentSets (objectID, allSets);
        
    }





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

        if (other instanceof Candidate)
        {
            Candidate otherCandidate = (Candidate)other;
            
            try
            {
                setPhone (otherCandidate.getPhone ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setForgotPasswordMailSendDate (otherCandidate.getForgotPasswordMailSendDate ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setForgotPasswordKey (otherCandidate.getForgotPasswordKey ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setVerificationMailSendDate (otherCandidate.getVerificationMailSendDate ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setVerificationKey (otherCandidate.getVerificationKey ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setIsAccountVerified (otherCandidate.getIsAccountVerified ());
            }
            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 BaseCandidate)
        {
            BaseCandidate sourceCandidate = (BaseCandidate)(source);

            _Phone = sourceCandidate._Phone;
            _ForgotPasswordMailSendDate = sourceCandidate._ForgotPasswordMailSendDate;
            _ForgotPasswordKey = sourceCandidate._ForgotPasswordKey;
            _VerificationMailSendDate = sourceCandidate._VerificationMailSendDate;
            _VerificationKey = sourceCandidate._VerificationKey;
            _IsAccountVerified = sourceCandidate._IsAccountVerified;
            _PrivacyPolicyAgreed = sourceCandidate._PrivacyPolicyAgreed;
            _ConditionsAgreed = sourceCandidate._ConditionsAgreed;
            
        }
    }


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

            _TestInput.copyFrom (sourceCandidate._TestInput, 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 BaseCandidate)
        {
            BaseCandidate sourceCandidate = (BaseCandidate)(source);

            _TestAnalysises.copyFrom (sourceCandidate._TestAnalysises, linkToGhosts);
            _JobApplications.copyFrom (sourceCandidate._JobApplications, linkToGhosts);
            _CultureCriteriaAnswers.copyFrom (sourceCandidate._CultureCriteriaAnswers, linkToGhosts);
            _ProfileAssessmentAnswers.copyFrom (sourceCandidate._ProfileAssessmentAnswers, linkToGhosts);
            
        }
    }


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

        _Phone = (String)(HELPER_Phone.readExternal (_Phone, vals.get(FIELD_Phone))); //
        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.readExternal (_ForgotPasswordMailSendDate, vals.get(FIELD_ForgotPasswordMailSendDate))); //
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.readExternal (_ForgotPasswordKey, vals.get(FIELD_ForgotPasswordKey))); //
        _VerificationMailSendDate = (Date)(HELPER_VerificationMailSendDate.readExternal (_VerificationMailSendDate, vals.get(FIELD_VerificationMailSendDate))); //
        _VerificationKey = (String)(HELPER_VerificationKey.readExternal (_VerificationKey, vals.get(FIELD_VerificationKey))); //
        _IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.readExternal (_IsAccountVerified, vals.get(FIELD_IsAccountVerified))); //
        _PrivacyPolicyAgreed = (Boolean)(HELPER_PrivacyPolicyAgreed.readExternal (_PrivacyPolicyAgreed, vals.get(FIELD_PrivacyPolicyAgreed))); //
        _ConditionsAgreed = (Boolean)(HELPER_ConditionsAgreed.readExternal (_ConditionsAgreed, vals.get(FIELD_ConditionsAgreed))); //
        _TestInput.readExternalData(vals.get(SINGLEREFERENCE_TestInput));
        _TestAnalysises.readExternalData(vals.get(MULTIPLEREFERENCE_TestAnalysises));
        _JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
        _CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers));
        _ProfileAssessmentAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_ProfileAssessmentAnswers));
        
    }


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

        vals.put (FIELD_Phone, HELPER_Phone.writeExternal (_Phone));
        vals.put (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.writeExternal (_ForgotPasswordMailSendDate));
        vals.put (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.writeExternal (_ForgotPasswordKey));
        vals.put (FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.writeExternal (_VerificationMailSendDate));
        vals.put (FIELD_VerificationKey, HELPER_VerificationKey.writeExternal (_VerificationKey));
        vals.put (FIELD_IsAccountVerified, HELPER_IsAccountVerified.writeExternal (_IsAccountVerified));
        vals.put (FIELD_PrivacyPolicyAgreed, HELPER_PrivacyPolicyAgreed.writeExternal (_PrivacyPolicyAgreed));
        vals.put (FIELD_ConditionsAgreed, HELPER_ConditionsAgreed.writeExternal (_ConditionsAgreed));
        vals.put (SINGLEREFERENCE_TestInput, _TestInput.writeExternalData());
        vals.put (MULTIPLEREFERENCE_TestAnalysises, _TestAnalysises.writeExternalData());
        vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
        vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData());
        vals.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, _ProfileAssessmentAnswers.writeExternalData());
        
    }


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

        if (other instanceof BaseCandidate)
        {
            BaseCandidate otherCandidate = (BaseCandidate)(other);

            
            if (!HELPER_Phone.compare(this._Phone, otherCandidate._Phone))
            {
                listener.notifyFieldChange(this, other, FIELD_Phone, HELPER_Phone.toObject(this._Phone), HELPER_Phone.toObject(otherCandidate._Phone));
            }
            if (!HELPER_ForgotPasswordMailSendDate.compare(this._ForgotPasswordMailSendDate, otherCandidate._ForgotPasswordMailSendDate))
            {
                listener.notifyFieldChange(this, other, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(this._ForgotPasswordMailSendDate), HELPER_ForgotPasswordMailSendDate.toObject(otherCandidate._ForgotPasswordMailSendDate));
            }
            if (!HELPER_ForgotPasswordKey.compare(this._ForgotPasswordKey, otherCandidate._ForgotPasswordKey))
            {
                listener.notifyFieldChange(this, other, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(this._ForgotPasswordKey), HELPER_ForgotPasswordKey.toObject(otherCandidate._ForgotPasswordKey));
            }
            if (!HELPER_VerificationMailSendDate.compare(this._VerificationMailSendDate, otherCandidate._VerificationMailSendDate))
            {
                listener.notifyFieldChange(this, other, FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.toObject(this._VerificationMailSendDate), HELPER_VerificationMailSendDate.toObject(otherCandidate._VerificationMailSendDate));
            }
            if (!HELPER_VerificationKey.compare(this._VerificationKey, otherCandidate._VerificationKey))
            {
                listener.notifyFieldChange(this, other, FIELD_VerificationKey, HELPER_VerificationKey.toObject(this._VerificationKey), HELPER_VerificationKey.toObject(otherCandidate._VerificationKey));
            }
            if (!HELPER_IsAccountVerified.compare(this._IsAccountVerified, otherCandidate._IsAccountVerified))
            {
                listener.notifyFieldChange(this, other, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(this._IsAccountVerified), HELPER_IsAccountVerified.toObject(otherCandidate._IsAccountVerified));
            }

            // Compare single assocs
            _TestInput.compare (otherCandidate._TestInput, listener);
            

            // Compare multiple assocs
            _TestAnalysises.compare (otherCandidate._TestAnalysises, listener);
            _JobApplications.compare (otherCandidate._JobApplications, listener);
            _CultureCriteriaAnswers.compare (otherCandidate._CultureCriteriaAnswers, listener);
            _ProfileAssessmentAnswers.compare (otherCandidate._ProfileAssessmentAnswers, listener);
            
        }
    }


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

        visitor.visitField(this, FIELD_PrivacyPolicyAgreed, HELPER_PrivacyPolicyAgreed.toObject(getPrivacyPolicyAgreed()));
        visitor.visitField(this, FIELD_ConditionsAgreed, HELPER_ConditionsAgreed.toObject(getConditionsAgreed()));
        
    }


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

        visitor.visitField(this, FIELD_Phone, HELPER_Phone.toObject(getPhone()));
        visitor.visitField(this, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(getForgotPasswordMailSendDate()));
        visitor.visitField(this, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(getForgotPasswordKey()));
        visitor.visitField(this, FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.toObject(getVerificationMailSendDate()));
        visitor.visitField(this, FIELD_VerificationKey, HELPER_VerificationKey.toObject(getVerificationKey()));
        visitor.visitField(this, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(getIsAccountVerified()));
        visitor.visitAssociation (_TestInput);
        visitor.visitAssociation (_TestAnalysises);
        visitor.visitAssociation (_JobApplications);
        visitor.visitAssociation (_CultureCriteriaAnswers);
        visitor.visitAssociation (_ProfileAssessmentAnswers);
        
    }


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

        if (scope.includes (_TestInput))
        {
            visitor.visit (_TestInput);
        }
        if (scope.includes (_TestAnalysises))
        {
            visitor.visit (_TestAnalysises);
        }
        if (scope.includes (_JobApplications))
        {
            visitor.visit (_JobApplications);
        }
        if (scope.includes (_CultureCriteriaAnswers))
        {
            visitor.visit (_CultureCriteriaAnswers);
        }
        if (scope.includes (_ProfileAssessmentAnswers))
        {
            visitor.visit (_ProfileAssessmentAnswers);
        }
        
    }


    public static Candidate createCandidate (ObjectTransaction transaction) throws StorageException
    {
        Candidate     result = new Candidate ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static Candidate getCandidateByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (Candidate)(transaction.getObjectByID (REFERENCE_Candidate, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_Phone))
        {
            return filter.matches (getPhone ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return filter.matches (getForgotPasswordMailSendDate ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return filter.matches (getForgotPasswordKey ());
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            return filter.matches (getVerificationMailSendDate ());
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            return filter.matches (getVerificationKey ());
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            return filter.matches (getIsAccountVerified ());
        }
        else if (attribName.equals (SINGLEREFERENCE_TestInput))
        {
            return filter.matches (getTestInput ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
            public SearchAll andPhone (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.phone", "Phone");
                return this;
            }
            
            public SearchAll andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchAll andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchAll andVerificationMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_mail_send_date", "VerificationMailSendDate");
                return this;
            }
            
            public SearchAll andVerificationKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_key", "VerificationKey");
                return this;
            }
            
            public SearchAll andIsAccountVerified (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_account_verified", "IsAccountVerified");
                return this;
            }
            
            public SearchAll andTestInput (QueryFilter<TestInput> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.test_input_id", "TestInput");
                return this;
            }
            
            public SearchAll andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
                public Candidate[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_Candidate, SEARCH_All, criteria);
            Set<Candidate>   typedResults = new LinkedHashSet <Candidate> ();
            for (BaseBusinessClass bbcResult : results)
            {
                Candidate aResult = (Candidate)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Candidate[0]);
                            
        }
    }

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

    public static SearchIdPin SearchByIdPin () { return new SearchIdPin (); }

    public static class SearchIdPin extends SearchObject<Candidate>
    {
        
        public SearchIdPin byID (Long ID)
        {
            by ("ID", ID);
            return this;
        }
        
        public SearchIdPin byPin (String Pin)
        {
            by ("Pin", Pin);
            return this;
        }
        
            public SearchIdPin andObjectID (QueryFilter<Long> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.object_id", FIELD_ObjectID);
                return this;
            }

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

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

            
            public SearchIdPin andPhone (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.phone", "Phone");
                return this;
            }
            
            public SearchIdPin andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchIdPin andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchIdPin andVerificationMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_mail_send_date", "VerificationMailSendDate");
                return this;
            }
            
            public SearchIdPin andVerificationKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_key", "VerificationKey");
                return this;
            }
            
            public SearchIdPin andIsAccountVerified (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_account_verified", "IsAccountVerified");
                return this;
            }
            
            public SearchIdPin andTestInput (QueryFilter<TestInput> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.test_input_id", "TestInput");
                return this;
            }
            
            public SearchIdPin andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
                public Candidate search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_Candidate, SEARCH_IdPin, criteria);
            Set<Candidate>   typedResults = new LinkedHashSet <Candidate> ();
            for (BaseBusinessClass bbcResult : results)
            {
                Candidate aResult = (Candidate)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return (Candidate)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "Candidate", "");
                            
        }
    }

        
                public static Candidate searchIdPin (ObjectTransaction transaction, Long ID, String Pin) throws StorageException
        {
            return SearchByIdPin ()
            .byID  (ID)
            .byPin  (Pin)
            .search (transaction);
        }



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_Phone))
        {
            return HELPER_Phone.toObject (getPhone ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return HELPER_ForgotPasswordMailSendDate.toObject (getForgotPasswordMailSendDate ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return HELPER_ForgotPasswordKey.toObject (getForgotPasswordKey ());
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            return HELPER_VerificationMailSendDate.toObject (getVerificationMailSendDate ());
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            return HELPER_VerificationKey.toObject (getVerificationKey ());
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            return HELPER_IsAccountVerified.toObject (getIsAccountVerified ());
        }
        else if (attribName.equals (FIELD_PrivacyPolicyAgreed))
        {
            return HELPER_PrivacyPolicyAgreed.toObject (getPrivacyPolicyAgreed ());
        }
        else if (attribName.equals (FIELD_ConditionsAgreed))
        {
            return HELPER_ConditionsAgreed.toObject (getConditionsAgreed ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_Phone))
        {
            return HELPER_Phone;
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return HELPER_ForgotPasswordMailSendDate;
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return HELPER_ForgotPasswordKey;
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            return HELPER_VerificationMailSendDate;
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            return HELPER_VerificationKey;
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            return HELPER_IsAccountVerified;
        }
        else if (attribName.equals (FIELD_PrivacyPolicyAgreed))
        {
            return HELPER_PrivacyPolicyAgreed;
        }
        else if (attribName.equals (FIELD_ConditionsAgreed))
        {
            return HELPER_ConditionsAgreed;
        }
        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_Phone))
        {
            setPhone ((String)(HELPER_Phone.fromObject (_Phone, attribValue)));            
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            setForgotPasswordMailSendDate ((Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, attribValue)));            
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            setForgotPasswordKey ((String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, attribValue)));            
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            setVerificationMailSendDate ((Date)(HELPER_VerificationMailSendDate.fromObject (_VerificationMailSendDate, attribValue)));            
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            setVerificationKey ((String)(HELPER_VerificationKey.fromObject (_VerificationKey, attribValue)));            
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            setIsAccountVerified ((Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, attribValue)));            
        }
        else if (attribName.equals (FIELD_PrivacyPolicyAgreed))
        {
            setPrivacyPolicyAgreed ((Boolean)(HELPER_PrivacyPolicyAgreed.fromObject (_PrivacyPolicyAgreed, attribValue)));            
        }
        else if (attribName.equals (FIELD_ConditionsAgreed))
        {
            setConditionsAgreed ((Boolean)(HELPER_ConditionsAgreed.fromObject (_ConditionsAgreed, 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_Phone))
        {
            return getWriteability_Phone ();
        }
        else if (fieldName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return getWriteability_ForgotPasswordMailSendDate ();
        }
        else if (fieldName.equals (FIELD_ForgotPasswordKey))
        {
            return getWriteability_ForgotPasswordKey ();
        }
        else if (fieldName.equals (FIELD_VerificationMailSendDate))
        {
            return getWriteability_VerificationMailSendDate ();
        }
        else if (fieldName.equals (FIELD_VerificationKey))
        {
            return getWriteability_VerificationKey ();
        }
        else if (fieldName.equals (FIELD_IsAccountVerified))
        {
            return getWriteability_IsAccountVerified ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_TestAnalysises))
        {
            return getWriteability_TestAnalysises ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_JobApplications))
        {
            return getWriteability_JobApplications ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_CultureCriteriaAnswers))
        {
            return getWriteability_CultureCriteriaAnswers ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_ProfileAssessmentAnswers))
        {
            return getWriteability_ProfileAssessmentAnswers ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_TestInput))
        {
            return getWriteability_TestInput ();
        }
        else if (fieldName.equals (FIELD_PrivacyPolicyAgreed))
        {
            return getWriteability_PrivacyPolicyAgreed ();
        }
        else if (fieldName.equals (FIELD_ConditionsAgreed))
        {
            return getWriteability_ConditionsAgreed ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_Phone () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Phone);
            }
        
            if (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ForgotPasswordMailSendDate);
            }
        
            if (getWriteability_ForgotPasswordKey () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ForgotPasswordKey);
            }
        
            if (getWriteability_VerificationMailSendDate () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_VerificationMailSendDate);
            }
        
            if (getWriteability_VerificationKey () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_VerificationKey);
            }
        
            if (getWriteability_IsAccountVerified () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IsAccountVerified);
            }
        
            if (getWriteability_PrivacyPolicyAgreed () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_PrivacyPolicyAgreed);
            }
        
            if (getWriteability_ConditionsAgreed () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ConditionsAgreed);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_Phone.getAttribObject (getClass (), _Phone, false, FIELD_Phone));
        result.add(HELPER_ForgotPasswordMailSendDate.getAttribObject (getClass (), _ForgotPasswordMailSendDate, false, FIELD_ForgotPasswordMailSendDate));
        result.add(HELPER_ForgotPasswordKey.getAttribObject (getClass (), _ForgotPasswordKey, false, FIELD_ForgotPasswordKey));
        result.add(HELPER_VerificationMailSendDate.getAttribObject (getClass (), _VerificationMailSendDate, false, FIELD_VerificationMailSendDate));
        result.add(HELPER_VerificationKey.getAttribObject (getClass (), _VerificationKey, false, FIELD_VerificationKey));
        result.add(HELPER_IsAccountVerified.getAttribObject (getClass (), _IsAccountVerified, false, FIELD_IsAccountVerified));
        result.add(HELPER_PrivacyPolicyAgreed.getAttribObject (getClass (), _PrivacyPolicyAgreed, false, FIELD_PrivacyPolicyAgreed));
        result.add(HELPER_ConditionsAgreed.getAttribObject (getClass (), _ConditionsAgreed, false, FIELD_ConditionsAgreed));

        return result;
    }


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


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

    /**
     * Get the attribute Phone
     */
    public String getPhone (Candidate obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Phone.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setPhone (Candidate obj, String newPhone) throws FieldException
    {
        return newPhone;
    }

    /**
     * Get the attribute ForgotPasswordMailSendDate
     */
    public Date getForgotPasswordMailSendDate (Candidate obj, Date original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ForgotPasswordMailSendDate.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Date setForgotPasswordMailSendDate (Candidate obj, Date newForgotPasswordMailSendDate) throws FieldException
    {
        return newForgotPasswordMailSendDate;
    }

    /**
     * Get the attribute ForgotPasswordKey
     */
    public String getForgotPasswordKey (Candidate obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ForgotPasswordKey.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setForgotPasswordKey (Candidate obj, String newForgotPasswordKey) throws FieldException
    {
        return newForgotPasswordKey;
    }

    /**
     * Get the attribute VerificationMailSendDate
     */
    public Date getVerificationMailSendDate (Candidate obj, Date original)
    {
        return original;
    }

    /**
     * Change the value set for attribute VerificationMailSendDate.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Date setVerificationMailSendDate (Candidate obj, Date newVerificationMailSendDate) throws FieldException
    {
        return newVerificationMailSendDate;
    }

    /**
     * Get the attribute VerificationKey
     */
    public String getVerificationKey (Candidate obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute VerificationKey.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setVerificationKey (Candidate obj, String newVerificationKey) throws FieldException
    {
        return newVerificationKey;
    }

    /**
     * Get the attribute IsAccountVerified
     */
    public Boolean getIsAccountVerified (Candidate obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IsAccountVerified.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setIsAccountVerified (Candidate obj, Boolean newIsAccountVerified) throws FieldException
    {
        return newIsAccountVerified;
    }

    /**
     * Get the attribute PrivacyPolicyAgreed
     */
    public Boolean getPrivacyPolicyAgreed (Candidate obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute PrivacyPolicyAgreed.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setPrivacyPolicyAgreed (Candidate obj, Boolean newPrivacyPolicyAgreed) throws FieldException
    {
        return newPrivacyPolicyAgreed;
    }

    /**
     * Get the attribute ConditionsAgreed
     */
    public Boolean getConditionsAgreed (Candidate obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ConditionsAgreed.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setConditionsAgreed (Candidate obj, Boolean newConditionsAgreed) throws FieldException
    {
        return newConditionsAgreed;
    }

    }

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

        public CandidatePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("TestAnalysises"))
            {
                return toTestAnalysises ();
            }                
            if (name.equals ("JobApplications"))
            {
                return toJobApplications ();
            }                
            if (name.equals ("CultureCriteriaAnswers"))
            {
                return toCultureCriteriaAnswers ();
            }                
            if (name.equals ("ProfileAssessmentAnswers"))
            {
                return toProfileAssessmentAnswers ();
            }                
            if (name.equals ("PrivacyPolicyAgreed"))
            {
                return toPrivacyPolicyAgreed ();
            }                
            if (name.equals ("ConditionsAgreed"))
            {
                return toConditionsAgreed ();
            }                
            if (name.equals ("Phone"))
            {
                return toPhone ();
            }                
            if (name.equals ("ForgotPasswordMailSendDate"))
            {
                return toForgotPasswordMailSendDate ();
            }                
            if (name.equals ("ForgotPasswordKey"))
            {
                return toForgotPasswordKey ();
            }                
            if (name.equals ("VerificationMailSendDate"))
            {
                return toVerificationMailSendDate ();
            }                
            if (name.equals ("VerificationKey"))
            {
                return toVerificationKey ();
            }                
            if (name.equals ("IsAccountVerified"))
            {
                return toIsAccountVerified ();
            }                
            if (name.equals ("TestInput"))
            {
                return toTestInput ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Boolean> toPrivacyPolicyAgreed () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_PrivacyPolicyAgreed));  }
        
        public PipeLine<From, Boolean> toConditionsAgreed () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ConditionsAgreed));  }
        
        public PipeLine<From, String> toPhone () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Phone));  }
        
        public PipeLine<From, Date> toForgotPasswordMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ForgotPasswordMailSendDate));  }
        
        public PipeLine<From, String> toForgotPasswordKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ForgotPasswordKey));  }
        
        public PipeLine<From, Date> toVerificationMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_VerificationMailSendDate));  }
        
        public PipeLine<From, String> toVerificationKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_VerificationKey));  }
        
        public PipeLine<From, Boolean> toIsAccountVerified () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsAccountVerified));  }
        public TestInput.TestInputPipeLineFactory<From, TestInput> toTestInput () { return toTestInput (Filter.ALL); }

        public TestInput.TestInputPipeLineFactory<From, TestInput> toTestInput (Filter<TestInput> filter) 
        { 
            return TestInput.REFERENCE_TestInput.new TestInputPipeLineFactory<From, TestInput> (this, new ORMSingleAssocPipe<Me, TestInput>(SINGLEREFERENCE_TestInput, filter)); 
        }
        public TestAnalysis.TestAnalysisPipeLineFactory<From, TestAnalysis> toTestAnalysises () { return toTestAnalysises(Filter.ALL); }        

        public TestAnalysis.TestAnalysisPipeLineFactory<From, TestAnalysis> toTestAnalysises (Filter<TestAnalysis> filter)
        {
            return TestAnalysis.REFERENCE_TestAnalysis.new TestAnalysisPipeLineFactory<From, TestAnalysis> (this, new ORMMultiAssocPipe<Me, TestAnalysis>(MULTIPLEREFERENCE_TestAnalysises, filter)); 
        }
        public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications () { return toJobApplications(Filter.ALL); }        

        public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications (Filter<JobApplication> filter)
        {
            return JobApplication.REFERENCE_JobApplication.new JobApplicationPipeLineFactory<From, JobApplication> (this, new ORMMultiAssocPipe<Me, JobApplication>(MULTIPLEREFERENCE_JobApplications, filter)); 
        }
        public CultureCriteriaAnswer.CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> toCultureCriteriaAnswers () { return toCultureCriteriaAnswers(Filter.ALL); }        

        public CultureCriteriaAnswer.CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> toCultureCriteriaAnswers (Filter<CultureCriteriaAnswer> filter)
        {
            return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer.new CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, CultureCriteriaAnswer>(MULTIPLEREFERENCE_CultureCriteriaAnswers, filter)); 
        }
        public Answer.AnswerPipeLineFactory<From, Answer> toProfileAssessmentAnswers () { return toProfileAssessmentAnswers(Filter.ALL); }        

        public Answer.AnswerPipeLineFactory<From, Answer> toProfileAssessmentAnswers (Filter<Answer> filter)
        {
            return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_ProfileAssessmentAnswers, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "PrivacyPolicyAgreed"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "ConditionsAgreed"))
        {
            return true;
        }
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


    public TestInput getTestInput () throws StorageException
    {
        return (TestInput)(TestInput.DUMMY_TestInput);
    }


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

    public int getTestAnalysisesCount () throws StorageException
    {
        return 0;
    }


    public TestAnalysis getTestAnalysisesAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association TestAnalysises");
    }


    public SortedSet getTestAnalysisesSet () throws StorageException
    {
        return new TreeSet();
    }

    public int getJobApplicationsCount () throws StorageException
    {
        return 0;
    }


    public JobApplication getJobApplicationsAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association JobApplications");
    }


    public SortedSet getJobApplicationsSet () throws StorageException
    {
        return new TreeSet();
    }

    public int getCultureCriteriaAnswersCount () throws StorageException
    {
        return 0;
    }


    public CultureCriteriaAnswer getCultureCriteriaAnswersAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association CultureCriteriaAnswers");
    }


    public SortedSet getCultureCriteriaAnswersSet () throws StorageException
    {
        return new TreeSet();
    }

    public int getProfileAssessmentAnswersCount () throws StorageException
    {
        return 0;
    }


    public Answer getProfileAssessmentAnswersAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association ProfileAssessmentAnswers");
    }


    public SortedSet getProfileAssessmentAnswersSet () throws StorageException
    {
        return new TreeSet();
    }

}

    
