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


    package performa.orm;

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

import performa.orm.types.*;



public abstract class BaseJobApplication extends BaseBusinessClass
{
    // Reference instance for the object
    public static final JobApplication REFERENCE_JobApplication = new JobApplication ();

    // Reference instance for the object
    public static final JobApplication DUMMY_JobApplication = new DummyJobApplication ();

    // Static constants corresponding to field names
    
    public static final String FIELD_CV = "CV";
    public static final String FIELD_ApplicationStatus = "ApplicationStatus";
    public static final String FIELD_SubmittedDate = "SubmittedDate";
    public static final String FIELD_AppProcessOption = "AppProcessOption";
    public static final String FIELD_OverallRank = "OverallRank";
    public static final String FIELD_RoleFit = "RoleFit";
    public static final String FIELD_RequirementFit = "RequirementFit";
    public static final String FIELD_CultureFit = "CultureFit";
    public static final String FIELD_FactorScoreDetails = "FactorScoreDetails";
    public static final String SINGLEREFERENCE_Candidate = "Candidate";
    public static final String BACKREF_Candidate = "";
    public static final String SINGLEREFERENCE_Job = "Job";
    public static final String BACKREF_Job = "";
    public static final String MULTIPLEREFERENCE_AssessmentCriteriaAnswers = "AssessmentCriteriaAnswers";
    public static final String BACKREF_AssessmentCriteriaAnswers = "";

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

    // Static constants corresponding to attribute helpers
    private static final BLOBAttributeHelper HELPER_CV = BLOBAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<JobApplication, ApplicationStatus> HELPER_ApplicationStatus =  new EnumeratedAttributeHelper<JobApplication, ApplicationStatus> (ApplicationStatus.FACTORY_ApplicationStatus);
    private static final DefaultAttributeHelper<JobApplication> HELPER_SubmittedDate = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<JobApplication, AppProcessOption> HELPER_AppProcessOption =  new EnumeratedAttributeHelper<JobApplication, AppProcessOption> (AppProcessOption.FACTORY_AppProcessOption);
    private static final DefaultAttributeHelper<JobApplication> HELPER_OverallRank = DefaultAttributeHelper.INSTANCE;
    private static final BLOBAttributeHelper HELPER_RoleFit = BLOBAttributeHelper.INSTANCE;
    private static final BLOBAttributeHelper HELPER_RequirementFit = BLOBAttributeHelper.INSTANCE;
    private static final BLOBAttributeHelper HELPER_CultureFit = BLOBAttributeHelper.INSTANCE;
    private static final BLOBAttributeHelper HELPER_FactorScoreDetails = BLOBAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private BinaryContent _CV;
    private ApplicationStatus _ApplicationStatus;
    private Date _SubmittedDate;
    private AppProcessOption _AppProcessOption;
    private Integer _OverallRank;
    private Map _RoleFit;
    private Map _RequirementFit;
    private Map _CultureFit;
    private Map _FactorScoreDetails;
    

    // Private attributes corresponding to single references
    private SingleAssociation<JobApplication, Candidate> _Candidate;
    private SingleAssociation<JobApplication, Job> _Job;
    

    // Private attributes corresponding to multiple references
    private MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> _AssessmentCriteriaAnswers;
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_AppProcessOption_Validators;
    private static final AttributeValidator[] FIELD_OverallRank_Validators;
    private static final AttributeValidator[] FIELD_RoleFit_Validators;
    private static final AttributeValidator[] FIELD_RequirementFit_Validators;
    private static final AttributeValidator[] FIELD_CultureFit_Validators;
    private static final AttributeValidator[] FIELD_FactorScoreDetails_Validators;
    private static final AttributeValidator[] FIELD_CV_Validators;
    private static final AttributeValidator[] FIELD_ApplicationStatus_Validators;
    private static final AttributeValidator[] FIELD_SubmittedDate_Validators;
    

    // Arrays of behaviour decorators
    private static final JobApplicationBehaviourDecorator[] JobApplication_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_AssessmentCriteriaAnswers = AssessmentCriteriaAnswer.BACKREF_JobApplication;
            String tmp_Candidate = Candidate.BACKREF_JobApplications;
            String tmp_Job = Job.BACKREF_JobApplications;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_AssessmentCriteriaAnswers();
            setupAssocMetaData_Candidate();
            setupAssocMetaData_Job();
            FIELD_AppProcessOption_Validators = (AttributeValidator[])setupAttribMetaData_AppProcessOption(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_OverallRank_Validators = (AttributeValidator[])setupAttribMetaData_OverallRank(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_RoleFit_Validators = (AttributeValidator[])setupAttribMetaData_RoleFit(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_RequirementFit_Validators = (AttributeValidator[])setupAttribMetaData_RequirementFit(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_CultureFit_Validators = (AttributeValidator[])setupAttribMetaData_CultureFit(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_FactorScoreDetails_Validators = (AttributeValidator[])setupAttribMetaData_FactorScoreDetails(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_CV_Validators = (AttributeValidator[])setupAttribMetaData_CV(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ApplicationStatus_Validators = (AttributeValidator[])setupAttribMetaData_ApplicationStatus(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_SubmittedDate_Validators = (AttributeValidator[])setupAttribMetaData_SubmittedDate(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_JobApplication.initialiseReference ();
            DUMMY_JobApplication.initialiseReference ();
            JobApplication_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(JobApplication.class).toArray(new JobApplicationBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

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

        metaInfo.put ("backreferenceName", "JobApplication");
        metaInfo.put ("name", "AssessmentCriteriaAnswers");
        metaInfo.put ("type", "AssessmentCriteriaAnswer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.AssessmentCriteriaAnswers:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Candidate()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "JobApplications");
        metaInfo.put ("dbcol", "candidate_id");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "Candidate");
        metaInfo.put ("type", "Candidate");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Candidate:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (SINGLEREFERENCE_Candidate, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Job()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "JobApplications");
        metaInfo.put ("dbcol", "job_id");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "Job");
        metaInfo.put ("type", "Job");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.Job:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (SINGLEREFERENCE_Job, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static List setupAttribMetaData_AppProcessOption(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("name", "AppProcessOption");
        metaInfo.put ("type", "AppProcessOption");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.AppProcessOption:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_AppProcessOption, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("name", "OverallRank");
        metaInfo.put ("type", "Integer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.OverallRank:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_OverallRank, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "BLOBAttributeHelper");
        metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
        metaInfo.put ("name", "RoleFit");
        metaInfo.put ("type", "Map");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.RoleFit:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_RoleFit, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "BLOBAttributeHelper");
        metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
        metaInfo.put ("name", "RequirementFit");
        metaInfo.put ("type", "Map");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.RequirementFit:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_RequirementFit, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "BLOBAttributeHelper");
        metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
        metaInfo.put ("name", "CultureFit");
        metaInfo.put ("type", "Map");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.CultureFit:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_CultureFit, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "BLOBAttributeHelper");
        metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
        metaInfo.put ("name", "FactorScoreDetails");
        metaInfo.put ("type", "Map");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.FactorScoreDetails:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_FactorScoreDetails, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "BLOBAttributeHelper");
        metaInfo.put ("attribHelperInstance", "BLOBAttributeHelper.INSTANCE");
        metaInfo.put ("binaryHandler", "loggedin");
        metaInfo.put ("dbcol", "cv");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "CV");
        metaInfo.put ("type", "BinaryContent");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.CV:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_CV, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "application_status");
        metaInfo.put ("defaultValue", "ApplicationStatus.DRAFT");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "ApplicationStatus");
        metaInfo.put ("type", "ApplicationStatus");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.ApplicationStatus:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_ApplicationStatus, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "submitted_date");
        metaInfo.put ("name", "SubmittedDate");
        metaInfo.put ("type", "Date");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.SubmittedDate:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_SubmittedDate, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _CV = (BinaryContent)(HELPER_CV.initialise (_CV));
        _ApplicationStatus = (ApplicationStatus)(ApplicationStatus.DRAFT);
        _SubmittedDate = (Date)(HELPER_SubmittedDate.initialise (_SubmittedDate));
        _AppProcessOption = (AppProcessOption)(HELPER_AppProcessOption.initialise (_AppProcessOption));
        _OverallRank = (Integer)(HELPER_OverallRank.initialise (_OverallRank));
        _RoleFit = (Map)(HELPER_RoleFit.initialise (_RoleFit));
        _RequirementFit = (Map)(HELPER_RequirementFit.initialise (_RequirementFit));
        _CultureFit = (Map)(HELPER_CultureFit.initialise (_CultureFit));
        _FactorScoreDetails = (Map)(HELPER_FactorScoreDetails.initialise (_FactorScoreDetails));
    }


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

        _Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
        _Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
        _AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _Candidate = new SingleAssociation<JobApplication, Candidate> (this, SINGLEREFERENCE_Candidate, Candidate.MULTIPLEREFERENCE_JobApplications, Candidate.REFERENCE_Candidate, "tl_job_application");
        _Job = new SingleAssociation<JobApplication, Job> (this, SINGLEREFERENCE_Job, Job.MULTIPLEREFERENCE_JobApplications, Job.REFERENCE_Job, "tl_job_application");
        _AssessmentCriteriaAnswers = new MultipleAssociation<JobApplication, AssessmentCriteriaAnswer> (this, MULTIPLEREFERENCE_AssessmentCriteriaAnswers, AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication, AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer);
        
        
        return this;
    }

    

    /**
     * Get the attribute CV
     */
    public BinaryContent getCV ()
    {
        assertValid();
        BinaryContent valToReturn = _CV;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getCV ((JobApplication)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 preCVChange (BinaryContent newCV) 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 postCVChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute CV.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setCV (BinaryContent newCV) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_CV.compare (_CV, newCV);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newCV = bhd.setCV ((JobApplication)this, newCV);
                oldAndNewIdentical = HELPER_CV.compare (_CV, newCV);
            }

            

            if (FIELD_CV_Validators.length > 0)
            {
                Object newCVObj = HELPER_CV.toObject (newCV);

                if (newCVObj != null)
                {
                    int     loopMax = FIELD_CV_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_CV);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_CV () != FieldWriteability.FALSE, "Field  CV is not writeable");
            preCVChange (newCV);
            markFieldChange (FIELD_CV);
            _CV = newCV;            
            postFieldChange (FIELD_CV);
            postCVChange ();
        }
    }

    /**
     * Get the attribute ApplicationStatus
     */
    public ApplicationStatus getApplicationStatus ()
    {
        assertValid();
        ApplicationStatus valToReturn = _ApplicationStatus;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getApplicationStatus ((JobApplication)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 preApplicationStatusChange (ApplicationStatus newApplicationStatus) 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 postApplicationStatusChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ApplicationStatus.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setApplicationStatus (ApplicationStatus newApplicationStatus) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newApplicationStatus = bhd.setApplicationStatus ((JobApplication)this, newApplicationStatus);
                oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
            }

            BusinessObjectParser.assertFieldCondition (newApplicationStatus != null, this, FIELD_ApplicationStatus, "mandatory");
            

            if (FIELD_ApplicationStatus_Validators.length > 0)
            {
                Object newApplicationStatusObj = HELPER_ApplicationStatus.toObject (newApplicationStatus);

                if (newApplicationStatusObj != null)
                {
                    int     loopMax = FIELD_ApplicationStatus_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_ApplicationStatus);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ApplicationStatus () != FieldWriteability.FALSE, "Field  ApplicationStatus is not writeable");
            preApplicationStatusChange (newApplicationStatus);
            markFieldChange (FIELD_ApplicationStatus);
            _ApplicationStatus = newApplicationStatus;            
            postFieldChange (FIELD_ApplicationStatus);
            postApplicationStatusChange ();
        }
    }

    /**
     * Get the attribute SubmittedDate
     */
    public Date getSubmittedDate ()
    {
        assertValid();
        Date valToReturn = _SubmittedDate;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getSubmittedDate ((JobApplication)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 preSubmittedDateChange (Date newSubmittedDate) 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 postSubmittedDateChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute SubmittedDate.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setSubmittedDate (Date newSubmittedDate) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_SubmittedDate.compare (_SubmittedDate, newSubmittedDate);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newSubmittedDate = bhd.setSubmittedDate ((JobApplication)this, newSubmittedDate);
                oldAndNewIdentical = HELPER_SubmittedDate.compare (_SubmittedDate, newSubmittedDate);
            }

            

            if (FIELD_SubmittedDate_Validators.length > 0)
            {
                Object newSubmittedDateObj = HELPER_SubmittedDate.toObject (newSubmittedDate);

                if (newSubmittedDateObj != null)
                {
                    int     loopMax = FIELD_SubmittedDate_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_SubmittedDate);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_SubmittedDate () != FieldWriteability.FALSE, "Field  SubmittedDate is not writeable");
            preSubmittedDateChange (newSubmittedDate);
            markFieldChange (FIELD_SubmittedDate);
            _SubmittedDate = newSubmittedDate;            
            postFieldChange (FIELD_SubmittedDate);
            postSubmittedDateChange ();
        }
    }

    /**
     * Get the attribute AppProcessOption
     */
    public AppProcessOption getAppProcessOption ()
    {
        assertValid();
        AppProcessOption valToReturn = _AppProcessOption;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getAppProcessOption ((JobApplication)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 preAppProcessOptionChange (AppProcessOption newAppProcessOption) 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 postAppProcessOptionChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute AppProcessOption.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setAppProcessOption (AppProcessOption newAppProcessOption) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_AppProcessOption.compare (_AppProcessOption, newAppProcessOption);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newAppProcessOption = bhd.setAppProcessOption ((JobApplication)this, newAppProcessOption);
                oldAndNewIdentical = HELPER_AppProcessOption.compare (_AppProcessOption, newAppProcessOption);
            }

            

            if (FIELD_AppProcessOption_Validators.length > 0)
            {
                Object newAppProcessOptionObj = HELPER_AppProcessOption.toObject (newAppProcessOption);

                if (newAppProcessOptionObj != null)
                {
                    int     loopMax = FIELD_AppProcessOption_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_AppProcessOption);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_AppProcessOption () != FieldWriteability.FALSE, "Field  AppProcessOption is not writeable");
            preAppProcessOptionChange (newAppProcessOption);
            markFieldChange (FIELD_AppProcessOption);
            _AppProcessOption = newAppProcessOption;            
            postFieldChange (FIELD_AppProcessOption);
            postAppProcessOptionChange ();
        }
    }

    /**
     * Get the attribute OverallRank
     */
    public Integer getOverallRank ()
    {
        assertValid();
        Integer valToReturn = _OverallRank;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getOverallRank ((JobApplication)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 preOverallRankChange (Integer newOverallRank) 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 postOverallRankChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute OverallRank.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setOverallRank (Integer newOverallRank) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_OverallRank.compare (_OverallRank, newOverallRank);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newOverallRank = bhd.setOverallRank ((JobApplication)this, newOverallRank);
                oldAndNewIdentical = HELPER_OverallRank.compare (_OverallRank, newOverallRank);
            }

            

            if (FIELD_OverallRank_Validators.length > 0)
            {
                Object newOverallRankObj = HELPER_OverallRank.toObject (newOverallRank);

                if (newOverallRankObj != null)
                {
                    int     loopMax = FIELD_OverallRank_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_OverallRank);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_OverallRank () != FieldWriteability.FALSE, "Field  OverallRank is not writeable");
            preOverallRankChange (newOverallRank);
            markFieldChange (FIELD_OverallRank);
            _OverallRank = newOverallRank;            
            postFieldChange (FIELD_OverallRank);
            postOverallRankChange ();
        }
    }

    /**
     * Get the attribute RoleFit
     */
    public Map getRoleFit ()
    {
        assertValid();
        Map valToReturn = _RoleFit;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getRoleFit ((JobApplication)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 preRoleFitChange (Map newRoleFit) 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 postRoleFitChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute RoleFit.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setRoleFit (Map newRoleFit) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_RoleFit.compare (_RoleFit, newRoleFit);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newRoleFit = bhd.setRoleFit ((JobApplication)this, newRoleFit);
                oldAndNewIdentical = HELPER_RoleFit.compare (_RoleFit, newRoleFit);
            }

            

            if (FIELD_RoleFit_Validators.length > 0)
            {
                Object newRoleFitObj = HELPER_RoleFit.toObject (newRoleFit);

                if (newRoleFitObj != null)
                {
                    int     loopMax = FIELD_RoleFit_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_RoleFit);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_RoleFit () != FieldWriteability.FALSE, "Field  RoleFit is not writeable");
            preRoleFitChange (newRoleFit);
            markFieldChange (FIELD_RoleFit);
            _RoleFit = newRoleFit;            
            postFieldChange (FIELD_RoleFit);
            postRoleFitChange ();
        }
    }

    /**
     * Get the attribute RequirementFit
     */
    public Map getRequirementFit ()
    {
        assertValid();
        Map valToReturn = _RequirementFit;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getRequirementFit ((JobApplication)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 preRequirementFitChange (Map newRequirementFit) 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 postRequirementFitChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute RequirementFit.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setRequirementFit (Map newRequirementFit) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_RequirementFit.compare (_RequirementFit, newRequirementFit);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newRequirementFit = bhd.setRequirementFit ((JobApplication)this, newRequirementFit);
                oldAndNewIdentical = HELPER_RequirementFit.compare (_RequirementFit, newRequirementFit);
            }

            

            if (FIELD_RequirementFit_Validators.length > 0)
            {
                Object newRequirementFitObj = HELPER_RequirementFit.toObject (newRequirementFit);

                if (newRequirementFitObj != null)
                {
                    int     loopMax = FIELD_RequirementFit_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_RequirementFit);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_RequirementFit () != FieldWriteability.FALSE, "Field  RequirementFit is not writeable");
            preRequirementFitChange (newRequirementFit);
            markFieldChange (FIELD_RequirementFit);
            _RequirementFit = newRequirementFit;            
            postFieldChange (FIELD_RequirementFit);
            postRequirementFitChange ();
        }
    }

    /**
     * Get the attribute CultureFit
     */
    public Map getCultureFit ()
    {
        assertValid();
        Map valToReturn = _CultureFit;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getCultureFit ((JobApplication)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 preCultureFitChange (Map newCultureFit) 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 postCultureFitChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute CultureFit.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setCultureFit (Map newCultureFit) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_CultureFit.compare (_CultureFit, newCultureFit);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newCultureFit = bhd.setCultureFit ((JobApplication)this, newCultureFit);
                oldAndNewIdentical = HELPER_CultureFit.compare (_CultureFit, newCultureFit);
            }

            

            if (FIELD_CultureFit_Validators.length > 0)
            {
                Object newCultureFitObj = HELPER_CultureFit.toObject (newCultureFit);

                if (newCultureFitObj != null)
                {
                    int     loopMax = FIELD_CultureFit_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_CultureFit);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_CultureFit () != FieldWriteability.FALSE, "Field  CultureFit is not writeable");
            preCultureFitChange (newCultureFit);
            markFieldChange (FIELD_CultureFit);
            _CultureFit = newCultureFit;            
            postFieldChange (FIELD_CultureFit);
            postCultureFitChange ();
        }
    }

    /**
     * Get the attribute FactorScoreDetails
     */
    public Map getFactorScoreDetails ()
    {
        assertValid();
        Map valToReturn = _FactorScoreDetails;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getFactorScoreDetails ((JobApplication)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 preFactorScoreDetailsChange (Map newFactorScoreDetails) 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 postFactorScoreDetailsChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute FactorScoreDetails.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setFactorScoreDetails (Map newFactorScoreDetails) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_FactorScoreDetails.compare (_FactorScoreDetails, newFactorScoreDetails);
        
        try
        {
            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                newFactorScoreDetails = bhd.setFactorScoreDetails ((JobApplication)this, newFactorScoreDetails);
                oldAndNewIdentical = HELPER_FactorScoreDetails.compare (_FactorScoreDetails, newFactorScoreDetails);
            }

            

            if (FIELD_FactorScoreDetails_Validators.length > 0)
            {
                Object newFactorScoreDetailsObj = HELPER_FactorScoreDetails.toObject (newFactorScoreDetails);

                if (newFactorScoreDetailsObj != null)
                {
                    int     loopMax = FIELD_FactorScoreDetails_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_FactorScoreDetails);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_FactorScoreDetails () != FieldWriteability.FALSE, "Field  FactorScoreDetails is not writeable");
            preFactorScoreDetailsChange (newFactorScoreDetails);
            markFieldChange (FIELD_FactorScoreDetails);
            _FactorScoreDetails = newFactorScoreDetails;            
            postFieldChange (FIELD_FactorScoreDetails);
            postFactorScoreDetailsChange ();
        }
    }



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

        
        result.add("Candidate");
        
        result.add("Job");
        

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_Candidate))
        {
            return _Candidate.getReferencedType ();
        }else if (assocName.equals (SINGLEREFERENCE_Job))
        {
            return _Job.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_Candidate))
        {
            return Candidate.MULTIPLEREFERENCE_JobApplications ;
        }else if (assocName.equals (SINGLEREFERENCE_Job))
        {
            return Job.MULTIPLEREFERENCE_JobApplications ;
        }
        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_Candidate))
        {
            return getCandidate ();
        }else if (assocName.equals (SINGLEREFERENCE_Job))
        {
            return getJob ();
        }
        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_Candidate))
        {
            return getCandidate (getType);
        }else if (assocName.equals (SINGLEREFERENCE_Job))
        {
            return getJob (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_Candidate))
        {
            return getCandidateID ();
        }else if (assocName.equals (SINGLEREFERENCE_Job))
        {
            return getJobID ();
        }
        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_Candidate))
        {
            setCandidate ((Candidate)(newValue));
        }else if (assocName.equals (SINGLEREFERENCE_Job))
        {
            setJob ((Job)(newValue));
        }
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



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


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


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

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


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



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

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

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

                    _Candidate.set (newCandidate);

                    if (newCandidate != null)
                    {
                        newCandidate.addToJobApplications ((JobApplication)(this));
                    }
                
            postCandidateChange ();
        }
    }

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getJobID ()
    {
        assertValid();
        
        if (_Job == null)
        {
            return null;
        }
        else
        {
            return _Job.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 preJobChange (Job newJob) 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 postJobChange () throws FieldException
    {
    }



    
    public FieldWriteability getWriteability_Job ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    /**
     * Set the reference Job.  Checks to ensure a new value
     * has been supplied.  If so, marks the reference as altered and sets it.
     */
    public void setJob (Job newJob) throws StorageException, FieldException
    {
        BusinessObjectParser.assertFieldCondition (newJob != null, this, SINGLEREFERENCE_Job, "mandatory");
        

        if (_Job.wouldReferencedChange (newJob))
        {
            assertValid();
            Debug.assertion (getWriteability_Job () != FieldWriteability.FALSE, "Assoc Job is not writeable");
            preJobChange (newJob);
            Job oldJob = getJob ();

                    if (oldJob != null)
                    {
                        // This is to stop validation from triggering when we are removed
                        _Job.set (null);
                        oldJob.removeFromJobApplications ((JobApplication)(this));
                    }

                    _Job.set (newJob);

                    if (newJob != null)
                    {
                        newJob.addToJobApplications ((JobApplication)(this));
                    }
                
            postJobChange ();
        }
    }

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

        
        result.add("AssessmentCriteriaAnswers");
        

        return result;
    }


    /**
     * Get the reference instance for the multi assoc name.
     */
    public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer ;
        }
        

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
        }
        

        return super.getMultiAssocBackReference(attribName);
    }


    /**
     * Get the assoc count for the multi assoc name.
     */
    public int getMultiAssocCount(String attribName) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return this.getAssessmentCriteriaAnswersCount();
        }
        

        return super.getMultiAssocCount(attribName);
    }


    /**
     * Get the assoc at a particular index
     */
    public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return this.getAssessmentCriteriaAnswersAt(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_AssessmentCriteriaAnswers.equals(attribName))
        {
            addToAssessmentCriteriaAnswers((AssessmentCriteriaAnswer)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_AssessmentCriteriaAnswers.equals(attribName))
        {
            removeFromAssessmentCriteriaAnswers((AssessmentCriteriaAnswer)oldElement);

            return;
        }
        

        super.removeFromMultiAssoc(attribName, oldElement);
    }


    protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            _AssessmentCriteriaAnswers.__loadAssociation (elements);
            return;
        }
        

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return _AssessmentCriteriaAnswers.isLoaded ();
        }
        

        return super.__isMultiAssocLoaded(attribName);
    }

    

    public FieldWriteability getWriteability_AssessmentCriteriaAnswers ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getAssessmentCriteriaAnswersCount () throws StorageException
    {
        assertValid();
        return _AssessmentCriteriaAnswers.getReferencedObjectsCount ();
    }


    public void addToAssessmentCriteriaAnswers (AssessmentCriteriaAnswer newElement) throws StorageException
    {
        if (_AssessmentCriteriaAnswers.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_AssessmentCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc AssessmentCriteriaAnswers is not writeable (add)");
            _AssessmentCriteriaAnswers.appendElement (newElement);

            try
            {
                if (newElement.getJobApplication () != this)
                {
                    newElement.setJobApplication ((JobApplication)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromAssessmentCriteriaAnswers (AssessmentCriteriaAnswer elementToRemove) throws StorageException
    {
        if (_AssessmentCriteriaAnswers.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_AssessmentCriteriaAnswers () != FieldWriteability.FALSE, "MultiAssoc AssessmentCriteriaAnswers is not writeable (remove)");
            _AssessmentCriteriaAnswers.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getJobApplication () != null)
                {
                    elementToRemove.setJobApplication (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public AssessmentCriteriaAnswer getAssessmentCriteriaAnswersAt (int index) throws StorageException
    {
        return (AssessmentCriteriaAnswer)(_AssessmentCriteriaAnswers.getElementAt (index));
    }


    public SortedSet<AssessmentCriteriaAnswer> getAssessmentCriteriaAnswersSet () throws StorageException
    {
        return _AssessmentCriteriaAnswers.getSet ();
    }



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

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplications from ", getObjectID (), " to ", referenced.getObjectID ());
                    _Candidate.set (null);
                    referenced.removeFromJobApplications ((JobApplication)this);
                }
            }
        
            // Ensure we are removed from any loaded multi-associations that aren't mandatory
            if (_Job.isLoaded () || getTransaction ().isObjectLoaded (_Job.getReferencedType (), getJobID ()))
            {
                Job  referenced = getJob ();

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplications from ", getObjectID (), " to ", referenced.getObjectID ());
                    _Job.set (null);
                    referenced.removeFromJobApplications ((JobApplication)this);
                }
            }
        
            for(AssessmentCriteriaAnswer referenced : CollectionUtils.reverse(getAssessmentCriteriaAnswersSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null JobApplication from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setJobApplication(null);
            }

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

        super.onDelete ();
    }


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


    public JobApplication referenceInstance ()
    {
        return REFERENCE_JobApplication;
    }


    public JobApplication getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getJobApplicationByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_JobApplication;
    }


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





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

        super.getPersistentSets (allSets);

        
        PersistentSet   tl_job_applicationPSet = allSets.getPersistentSet (myID, "tl_job_application", myPSetStatus);

        tl_job_applicationPSet.setAttrib (FIELD_ObjectID, myID);
        tl_job_applicationPSet.setAttrib (FIELD_CV, HELPER_CV.toObject (_CV)); //
        tl_job_applicationPSet.setAttrib (FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject (_ApplicationStatus)); //
        tl_job_applicationPSet.setAttrib (FIELD_SubmittedDate, HELPER_SubmittedDate.toObject (_SubmittedDate)); //
        _Candidate.getPersistentSets (allSets);
        _Job.getPersistentSets (allSets);
        
    }


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

        
        PersistentSet   tl_job_applicationPSet = allSets.getPersistentSet (objectID, "tl_job_application");

        _CV = (BinaryContent)(HELPER_CV.fromObject (_CV, tl_job_applicationPSet.getAttrib (FIELD_CV))); //
        _ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, tl_job_applicationPSet.getAttrib (FIELD_ApplicationStatus))); //
        _SubmittedDate = (Date)(HELPER_SubmittedDate.fromObject (_SubmittedDate, tl_job_applicationPSet.getAttrib (FIELD_SubmittedDate))); //
        _Candidate.setFromPersistentSets (objectID, allSets);
        _Job.setFromPersistentSets (objectID, allSets);
        
    }





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

        if (other instanceof JobApplication)
        {
            JobApplication otherJobApplication = (JobApplication)other;
            
            try
            {
                setCV (otherJobApplication.getCV ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setApplicationStatus (otherJobApplication.getApplicationStatus ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setSubmittedDate (otherJobApplication.getSubmittedDate ());
            }
            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 BaseJobApplication)
        {
            BaseJobApplication sourceJobApplication = (BaseJobApplication)(source);

            _CV = sourceJobApplication._CV;
            _ApplicationStatus = sourceJobApplication._ApplicationStatus;
            _SubmittedDate = sourceJobApplication._SubmittedDate;
            _AppProcessOption = sourceJobApplication._AppProcessOption;
            _OverallRank = sourceJobApplication._OverallRank;
            _RoleFit = sourceJobApplication._RoleFit;
            _RequirementFit = sourceJobApplication._RequirementFit;
            _CultureFit = sourceJobApplication._CultureFit;
            _FactorScoreDetails = sourceJobApplication._FactorScoreDetails;
            
        }
    }


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

            _Candidate.copyFrom (sourceJobApplication._Candidate, linkToGhosts);
            _Job.copyFrom (sourceJobApplication._Job, 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 BaseJobApplication)
        {
            BaseJobApplication sourceJobApplication = (BaseJobApplication)(source);

            _AssessmentCriteriaAnswers.copyFrom (sourceJobApplication._AssessmentCriteriaAnswers, linkToGhosts);
            
        }
    }


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

        
        context.check (getCandidateID() != null, this, SINGLEREFERENCE_Candidate, "mandatory");
        
        context.check (getJobID() != null, this, SINGLEREFERENCE_Job, "mandatory");
        
    }


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

        _CV = (BinaryContent)(HELPER_CV.readExternal (_CV, vals.get(FIELD_CV))); //
        _ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.readExternal (_ApplicationStatus, vals.get(FIELD_ApplicationStatus))); //
        _SubmittedDate = (Date)(HELPER_SubmittedDate.readExternal (_SubmittedDate, vals.get(FIELD_SubmittedDate))); //
        _AppProcessOption = (AppProcessOption)(HELPER_AppProcessOption.readExternal (_AppProcessOption, vals.get(FIELD_AppProcessOption))); //
        _OverallRank = (Integer)(HELPER_OverallRank.readExternal (_OverallRank, vals.get(FIELD_OverallRank))); //
        _RoleFit = (Map)(HELPER_RoleFit.readExternal (_RoleFit, vals.get(FIELD_RoleFit))); //
        _RequirementFit = (Map)(HELPER_RequirementFit.readExternal (_RequirementFit, vals.get(FIELD_RequirementFit))); //
        _CultureFit = (Map)(HELPER_CultureFit.readExternal (_CultureFit, vals.get(FIELD_CultureFit))); //
        _FactorScoreDetails = (Map)(HELPER_FactorScoreDetails.readExternal (_FactorScoreDetails, vals.get(FIELD_FactorScoreDetails))); //
        _Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
        _Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
        _AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers));
        
    }


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

        vals.put (FIELD_CV, HELPER_CV.writeExternal (_CV));
        vals.put (FIELD_ApplicationStatus, HELPER_ApplicationStatus.writeExternal (_ApplicationStatus));
        vals.put (FIELD_SubmittedDate, HELPER_SubmittedDate.writeExternal (_SubmittedDate));
        vals.put (FIELD_AppProcessOption, HELPER_AppProcessOption.writeExternal (_AppProcessOption));
        vals.put (FIELD_OverallRank, HELPER_OverallRank.writeExternal (_OverallRank));
        vals.put (FIELD_RoleFit, HELPER_RoleFit.writeExternal (_RoleFit));
        vals.put (FIELD_RequirementFit, HELPER_RequirementFit.writeExternal (_RequirementFit));
        vals.put (FIELD_CultureFit, HELPER_CultureFit.writeExternal (_CultureFit));
        vals.put (FIELD_FactorScoreDetails, HELPER_FactorScoreDetails.writeExternal (_FactorScoreDetails));
        vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
        vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
        vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData());
        
    }


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

        if (other instanceof BaseJobApplication)
        {
            BaseJobApplication otherJobApplication = (BaseJobApplication)(other);

            
            if (!HELPER_CV.compare(this._CV, otherJobApplication._CV))
            {
                listener.notifyFieldChange(this, other, FIELD_CV, HELPER_CV.toObject(this._CV), HELPER_CV.toObject(otherJobApplication._CV));
            }
            if (!HELPER_ApplicationStatus.compare(this._ApplicationStatus, otherJobApplication._ApplicationStatus))
            {
                listener.notifyFieldChange(this, other, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(this._ApplicationStatus), HELPER_ApplicationStatus.toObject(otherJobApplication._ApplicationStatus));
            }
            if (!HELPER_SubmittedDate.compare(this._SubmittedDate, otherJobApplication._SubmittedDate))
            {
                listener.notifyFieldChange(this, other, FIELD_SubmittedDate, HELPER_SubmittedDate.toObject(this._SubmittedDate), HELPER_SubmittedDate.toObject(otherJobApplication._SubmittedDate));
            }

            // Compare single assocs
            _Candidate.compare (otherJobApplication._Candidate, listener);
            _Job.compare (otherJobApplication._Job, listener);
            

            // Compare multiple assocs
            _AssessmentCriteriaAnswers.compare (otherJobApplication._AssessmentCriteriaAnswers, listener);
            
        }
    }


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

        visitor.visitField(this, FIELD_AppProcessOption, HELPER_AppProcessOption.toObject(getAppProcessOption()));
        visitor.visitField(this, FIELD_OverallRank, HELPER_OverallRank.toObject(getOverallRank()));
        visitor.visitField(this, FIELD_RoleFit, HELPER_RoleFit.toObject(getRoleFit()));
        visitor.visitField(this, FIELD_RequirementFit, HELPER_RequirementFit.toObject(getRequirementFit()));
        visitor.visitField(this, FIELD_CultureFit, HELPER_CultureFit.toObject(getCultureFit()));
        visitor.visitField(this, FIELD_FactorScoreDetails, HELPER_FactorScoreDetails.toObject(getFactorScoreDetails()));
        
    }


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

        visitor.visitField(this, FIELD_CV, HELPER_CV.toObject(getCV()));
        visitor.visitField(this, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(getApplicationStatus()));
        visitor.visitField(this, FIELD_SubmittedDate, HELPER_SubmittedDate.toObject(getSubmittedDate()));
        visitor.visitAssociation (_Candidate);
        visitor.visitAssociation (_Job);
        visitor.visitAssociation (_AssessmentCriteriaAnswers);
        
    }


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

        if (scope.includes (_Candidate))
        {
            visitor.visit (_Candidate);
        }
        if (scope.includes (_Job))
        {
            visitor.visit (_Job);
        }
        if (scope.includes (_AssessmentCriteriaAnswers))
        {
            visitor.visit (_AssessmentCriteriaAnswers);
        }
        
    }


    public static JobApplication createJobApplication (ObjectTransaction transaction) throws StorageException
    {
        JobApplication     result = new JobApplication ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static JobApplication getJobApplicationByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (JobApplication)(transaction.getObjectByID (REFERENCE_JobApplication, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_CV))
        {
            return filter.matches (getCV ());
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            return filter.matches (getApplicationStatus ());
        }
        else if (attribName.equals (FIELD_SubmittedDate))
        {
            return filter.matches (getSubmittedDate ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Candidate))
        {
            return filter.matches (getCandidate ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Job))
        {
            return filter.matches (getJob ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
            public SearchAll andCV (QueryFilter<BinaryContent> filter)
            {
                filter.addFilter (context, "tl_job_application.cv", "CV");
                return this;
            }
            
            public SearchAll andApplicationStatus (QueryFilter<ApplicationStatus> filter)
            {
                filter.addFilter (context, "tl_job_application.application_status", "ApplicationStatus");
                return this;
            }
            
            public SearchAll andSubmittedDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "tl_job_application.submitted_date", "SubmittedDate");
                return this;
            }
            
            public SearchAll andCandidate (QueryFilter<Candidate> filter)
            {
                filter.addFilter (context, "tl_job_application.candidate_id", "Candidate");
                return this;
            }
            
            public SearchAll andJob (QueryFilter<Job> filter)
            {
                filter.addFilter (context, "tl_job_application.job_id", "Job");
                return this;
            }
            
                public JobApplication[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_JobApplication, SEARCH_All, criteria);
            Set<JobApplication>   typedResults = new LinkedHashSet <JobApplication> ();
            for (BaseBusinessClass bbcResult : results)
            {
                JobApplication aResult = (JobApplication)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new JobApplication[0]);
                            
        }
    }

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

        public abstract boolean filterCandidateJob(Candidate Candidate, Job Job) throws StorageException;
    
    public static SearchCandidateJob SearchByCandidateJob () { return new SearchCandidateJob (); }

    public static class SearchCandidateJob extends SearchObject<JobApplication>
    {
        
        public SearchCandidateJob byCandidate (Candidate Candidate)
        {
            by ("Candidate", Candidate);
            return this;
        }
        
        public SearchCandidateJob byJob (Job Job)
        {
            by ("Job", Job);
            return this;
        }
        
            public SearchCandidateJob andObjectID (QueryFilter<Long> filter)
            {
                filter.addFilter (context, "tl_job_application.object_id", FIELD_ObjectID);
                return this;
            }

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

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

            
            public SearchCandidateJob andCV (QueryFilter<BinaryContent> filter)
            {
                filter.addFilter (context, "tl_job_application.cv", "CV");
                return this;
            }
            
            public SearchCandidateJob andApplicationStatus (QueryFilter<ApplicationStatus> filter)
            {
                filter.addFilter (context, "tl_job_application.application_status", "ApplicationStatus");
                return this;
            }
            
            public SearchCandidateJob andSubmittedDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "tl_job_application.submitted_date", "SubmittedDate");
                return this;
            }
            
            public SearchCandidateJob andCandidate (QueryFilter<Candidate> filter)
            {
                filter.addFilter (context, "tl_job_application.candidate_id", "Candidate");
                return this;
            }
            
            public SearchCandidateJob andJob (QueryFilter<Job> filter)
            {
                filter.addFilter (context, "tl_job_application.job_id", "Job");
                return this;
            }
            
                public JobApplication search (ObjectTransaction transaction) throws StorageException
        {
            Candidate Candidate = (Candidate)criteria.get ("Candidate");
                Job Job = (Job)criteria.get ("Job");
                
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_JobApplication, SEARCH_CandidateJob, criteria);
            Set<JobApplication>   typedResults = new LinkedHashSet <JobApplication> ();
            for (BaseBusinessClass bbcResult : results)
            {
                JobApplication aResult = (JobApplication)bbcResult;
                
                    // Check in case in memory objects should be excluded
                    if (!aResult.filterCandidateJob(Candidate, Job) || !filterAndsInMemory (aResult))
                    {
                        continue;
                    }
                
                typedResults.add (aResult);
            }
            
            // Check in memory objects for matches
            for (BaseBusinessClass bbcInMemory : transaction.getObjectsToStore ())
            {
                if (bbcInMemory instanceof JobApplication)
                {
                    JobApplication aInMemory = (JobApplication)bbcInMemory;

                    if (!aInMemory.filterCandidateJob(Candidate, Job) || !filterAndsInMemory (aInMemory))
                    {
                        continue;
                    }

                    typedResults.add (aInMemory);
                }
            }
            
                    return (JobApplication)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "JobApplication", "");
                            
        }
    }

        
                public static JobApplication searchCandidateJob (ObjectTransaction transaction, Candidate Candidate, Job Job) throws StorageException
        {
            return SearchByCandidateJob ()
            .byCandidate  (Candidate)
            .byJob  (Job)
            .search (transaction);
        }



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_CV))
        {
            return HELPER_CV.toObject (getCV ());
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            return HELPER_ApplicationStatus.toObject (getApplicationStatus ());
        }
        else if (attribName.equals (FIELD_SubmittedDate))
        {
            return HELPER_SubmittedDate.toObject (getSubmittedDate ());
        }
        else if (attribName.equals (FIELD_AppProcessOption))
        {
            return HELPER_AppProcessOption.toObject (getAppProcessOption ());
        }
        else if (attribName.equals (FIELD_OverallRank))
        {
            return HELPER_OverallRank.toObject (getOverallRank ());
        }
        else if (attribName.equals (FIELD_RoleFit))
        {
            return HELPER_RoleFit.toObject (getRoleFit ());
        }
        else if (attribName.equals (FIELD_RequirementFit))
        {
            return HELPER_RequirementFit.toObject (getRequirementFit ());
        }
        else if (attribName.equals (FIELD_CultureFit))
        {
            return HELPER_CultureFit.toObject (getCultureFit ());
        }
        else if (attribName.equals (FIELD_FactorScoreDetails))
        {
            return HELPER_FactorScoreDetails.toObject (getFactorScoreDetails ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_CV))
        {
            return HELPER_CV;
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            return HELPER_ApplicationStatus;
        }
        else if (attribName.equals (FIELD_SubmittedDate))
        {
            return HELPER_SubmittedDate;
        }
        else if (attribName.equals (FIELD_AppProcessOption))
        {
            return HELPER_AppProcessOption;
        }
        else if (attribName.equals (FIELD_OverallRank))
        {
            return HELPER_OverallRank;
        }
        else if (attribName.equals (FIELD_RoleFit))
        {
            return HELPER_RoleFit;
        }
        else if (attribName.equals (FIELD_RequirementFit))
        {
            return HELPER_RequirementFit;
        }
        else if (attribName.equals (FIELD_CultureFit))
        {
            return HELPER_CultureFit;
        }
        else if (attribName.equals (FIELD_FactorScoreDetails))
        {
            return HELPER_FactorScoreDetails;
        }
        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_CV))
        {
            setCV ((BinaryContent)(HELPER_CV.fromObject (_CV, attribValue)));            
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            setApplicationStatus ((ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, attribValue)));            
        }
        else if (attribName.equals (FIELD_SubmittedDate))
        {
            setSubmittedDate ((Date)(HELPER_SubmittedDate.fromObject (_SubmittedDate, attribValue)));            
        }
        else if (attribName.equals (FIELD_AppProcessOption))
        {
            setAppProcessOption ((AppProcessOption)(HELPER_AppProcessOption.fromObject (_AppProcessOption, attribValue)));            
        }
        else if (attribName.equals (FIELD_OverallRank))
        {
            setOverallRank ((Integer)(HELPER_OverallRank.fromObject (_OverallRank, attribValue)));            
        }
        else if (attribName.equals (FIELD_RoleFit))
        {
            setRoleFit ((Map)(HELPER_RoleFit.fromObject (_RoleFit, attribValue)));            
        }
        else if (attribName.equals (FIELD_RequirementFit))
        {
            setRequirementFit ((Map)(HELPER_RequirementFit.fromObject (_RequirementFit, attribValue)));            
        }
        else if (attribName.equals (FIELD_CultureFit))
        {
            setCultureFit ((Map)(HELPER_CultureFit.fromObject (_CultureFit, attribValue)));            
        }
        else if (attribName.equals (FIELD_FactorScoreDetails))
        {
            setFactorScoreDetails ((Map)(HELPER_FactorScoreDetails.fromObject (_FactorScoreDetails, 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_CV))
        {
            return getWriteability_CV ();
        }
        else if (fieldName.equals (FIELD_ApplicationStatus))
        {
            return getWriteability_ApplicationStatus ();
        }
        else if (fieldName.equals (FIELD_SubmittedDate))
        {
            return getWriteability_SubmittedDate ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_AssessmentCriteriaAnswers))
        {
            return getWriteability_AssessmentCriteriaAnswers ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Candidate))
        {
            return getWriteability_Candidate ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Job))
        {
            return getWriteability_Job ();
        }
        else if (fieldName.equals (FIELD_AppProcessOption))
        {
            return getWriteability_AppProcessOption ();
        }
        else if (fieldName.equals (FIELD_OverallRank))
        {
            return getWriteability_OverallRank ();
        }
        else if (fieldName.equals (FIELD_RoleFit))
        {
            return getWriteability_RoleFit ();
        }
        else if (fieldName.equals (FIELD_RequirementFit))
        {
            return getWriteability_RequirementFit ();
        }
        else if (fieldName.equals (FIELD_CultureFit))
        {
            return getWriteability_CultureFit ();
        }
        else if (fieldName.equals (FIELD_FactorScoreDetails))
        {
            return getWriteability_FactorScoreDetails ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_CV () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_CV);
            }
        
            if (getWriteability_ApplicationStatus () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ApplicationStatus);
            }
        
            if (getWriteability_SubmittedDate () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_SubmittedDate);
            }
        
            if (getWriteability_AppProcessOption () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_AppProcessOption);
            }
        
            if (getWriteability_OverallRank () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_OverallRank);
            }
        
            if (getWriteability_RoleFit () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_RoleFit);
            }
        
            if (getWriteability_RequirementFit () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_RequirementFit);
            }
        
            if (getWriteability_CultureFit () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_CultureFit);
            }
        
            if (getWriteability_FactorScoreDetails () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_FactorScoreDetails);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_CV.getAttribObject (getClass (), _CV, false, FIELD_CV));
        result.add(HELPER_ApplicationStatus.getAttribObject (getClass (), _ApplicationStatus, true, FIELD_ApplicationStatus));
        result.add(HELPER_SubmittedDate.getAttribObject (getClass (), _SubmittedDate, false, FIELD_SubmittedDate));
        result.add(HELPER_AppProcessOption.getAttribObject (getClass (), _AppProcessOption, false, FIELD_AppProcessOption));
        result.add(HELPER_OverallRank.getAttribObject (getClass (), _OverallRank, false, FIELD_OverallRank));
        result.add(HELPER_RoleFit.getAttribObject (getClass (), _RoleFit, false, FIELD_RoleFit));
        result.add(HELPER_RequirementFit.getAttribObject (getClass (), _RequirementFit, false, FIELD_RequirementFit));
        result.add(HELPER_CultureFit.getAttribObject (getClass (), _CultureFit, false, FIELD_CultureFit));
        result.add(HELPER_FactorScoreDetails.getAttribObject (getClass (), _FactorScoreDetails, false, FIELD_FactorScoreDetails));

        return result;
    }


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


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

    public void preCommit (boolean willBeStored) throws Exception
    {
        super.preCommit(willBeStored);
        
        if(willBeStored)
        {
        
          {  
            oneit.servlets.objstore.binary.BinaryContentHandler bchandler = oneit.servlets.objstore.binary.BinaryContentServlet.getHandler("loggedin");
              
            if(bchandler != null)
            {
                bchandler.preCommit(willBeStored, this, "CV");
            }
            else
            {
                LogMgr.log(BUSINESS_OBJECTS, LogLevel.SYSTEMWARNING, "Unknown BinaryContentHandler loggedin on attribute CV");
            }
          }
          
        }
    }

    public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "CV"))      
        {  
            return oneit.servlets.objstore.binary.BinaryContentServlet.getHandler("loggedin");
        }     
          
        
        return super.getBinaryContentHandler(attribName);
    }

    public static class JobApplicationBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<JobApplication>
    {

    /**
     * Get the attribute CV
     */
    public BinaryContent getCV (JobApplication obj, BinaryContent original)
    {
        return original;
    }

    /**
     * Change the value set for attribute CV.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public BinaryContent setCV (JobApplication obj, BinaryContent newCV) throws FieldException
    {
        return newCV;
    }

    /**
     * Get the attribute ApplicationStatus
     */
    public ApplicationStatus getApplicationStatus (JobApplication obj, ApplicationStatus original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ApplicationStatus.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public ApplicationStatus setApplicationStatus (JobApplication obj, ApplicationStatus newApplicationStatus) throws FieldException
    {
        return newApplicationStatus;
    }

    /**
     * Get the attribute SubmittedDate
     */
    public Date getSubmittedDate (JobApplication obj, Date original)
    {
        return original;
    }

    /**
     * Change the value set for attribute SubmittedDate.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Date setSubmittedDate (JobApplication obj, Date newSubmittedDate) throws FieldException
    {
        return newSubmittedDate;
    }

    /**
     * Get the attribute AppProcessOption
     */
    public AppProcessOption getAppProcessOption (JobApplication obj, AppProcessOption original)
    {
        return original;
    }

    /**
     * Change the value set for attribute AppProcessOption.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public AppProcessOption setAppProcessOption (JobApplication obj, AppProcessOption newAppProcessOption) throws FieldException
    {
        return newAppProcessOption;
    }

    /**
     * Get the attribute OverallRank
     */
    public Integer getOverallRank (JobApplication obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute OverallRank.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setOverallRank (JobApplication obj, Integer newOverallRank) throws FieldException
    {
        return newOverallRank;
    }

    /**
     * Get the attribute RoleFit
     */
    public Map getRoleFit (JobApplication obj, Map original)
    {
        return original;
    }

    /**
     * Change the value set for attribute RoleFit.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Map setRoleFit (JobApplication obj, Map newRoleFit) throws FieldException
    {
        return newRoleFit;
    }

    /**
     * Get the attribute RequirementFit
     */
    public Map getRequirementFit (JobApplication obj, Map original)
    {
        return original;
    }

    /**
     * Change the value set for attribute RequirementFit.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Map setRequirementFit (JobApplication obj, Map newRequirementFit) throws FieldException
    {
        return newRequirementFit;
    }

    /**
     * Get the attribute CultureFit
     */
    public Map getCultureFit (JobApplication obj, Map original)
    {
        return original;
    }

    /**
     * Change the value set for attribute CultureFit.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Map setCultureFit (JobApplication obj, Map newCultureFit) throws FieldException
    {
        return newCultureFit;
    }

    /**
     * Get the attribute FactorScoreDetails
     */
    public Map getFactorScoreDetails (JobApplication obj, Map original)
    {
        return original;
    }

    /**
     * Change the value set for attribute FactorScoreDetails.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Map setFactorScoreDetails (JobApplication obj, Map newFactorScoreDetails) throws FieldException
    {
        return newFactorScoreDetails;
    }

    }

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

        public JobApplicationPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("AssessmentCriteriaAnswers"))
            {
                return toAssessmentCriteriaAnswers ();
            }                
            if (name.equals ("AppProcessOption"))
            {
                return toAppProcessOption ();
            }                
            if (name.equals ("OverallRank"))
            {
                return toOverallRank ();
            }                
            if (name.equals ("RoleFit"))
            {
                return toRoleFit ();
            }                
            if (name.equals ("RequirementFit"))
            {
                return toRequirementFit ();
            }                
            if (name.equals ("CultureFit"))
            {
                return toCultureFit ();
            }                
            if (name.equals ("FactorScoreDetails"))
            {
                return toFactorScoreDetails ();
            }                
            if (name.equals ("CV"))
            {
                return toCV ();
            }                
            if (name.equals ("ApplicationStatus"))
            {
                return toApplicationStatus ();
            }                
            if (name.equals ("SubmittedDate"))
            {
                return toSubmittedDate ();
            }                
            if (name.equals ("Candidate"))
            {
                return toCandidate ();
            }                
            if (name.equals ("Job"))
            {
                return toJob ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, AppProcessOption> toAppProcessOption () { return pipe(new ORMAttributePipe<Me, AppProcessOption>(FIELD_AppProcessOption));  }
        
        public PipeLine<From, Integer> toOverallRank () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_OverallRank));  }
        
        public PipeLine<From, Map> toRoleFit () { return pipe(new ORMAttributePipe<Me, Map>(FIELD_RoleFit));  }
        
        public PipeLine<From, Map> toRequirementFit () { return pipe(new ORMAttributePipe<Me, Map>(FIELD_RequirementFit));  }
        
        public PipeLine<From, Map> toCultureFit () { return pipe(new ORMAttributePipe<Me, Map>(FIELD_CultureFit));  }
        
        public PipeLine<From, Map> toFactorScoreDetails () { return pipe(new ORMAttributePipe<Me, Map>(FIELD_FactorScoreDetails));  }
        
        public PipeLine<From, BinaryContent> toCV () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_CV));  }
        
        public PipeLine<From, ApplicationStatus> toApplicationStatus () { return pipe(new ORMAttributePipe<Me, ApplicationStatus>(FIELD_ApplicationStatus));  }
        
        public PipeLine<From, Date> toSubmittedDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_SubmittedDate));  }
        public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate () { return toCandidate (Filter.ALL); }

        public Candidate.CandidatePipeLineFactory<From, Candidate> toCandidate (Filter<Candidate> filter) 
        { 
            return Candidate.REFERENCE_Candidate.new CandidatePipeLineFactory<From, Candidate> (this, new ORMSingleAssocPipe<Me, Candidate>(SINGLEREFERENCE_Candidate, filter)); 
        }
        public Job.JobPipeLineFactory<From, Job> toJob () { return toJob (Filter.ALL); }

        public Job.JobPipeLineFactory<From, Job> toJob (Filter<Job> filter) 
        { 
            return Job.REFERENCE_Job.new JobPipeLineFactory<From, Job> (this, new ORMSingleAssocPipe<Me, Job>(SINGLEREFERENCE_Job, filter)); 
        }
        public AssessmentCriteriaAnswer.AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> toAssessmentCriteriaAnswers () { return toAssessmentCriteriaAnswers(Filter.ALL); }        

        public AssessmentCriteriaAnswer.AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> toAssessmentCriteriaAnswers (Filter<AssessmentCriteriaAnswer> filter)
        {
            return AssessmentCriteriaAnswer.REFERENCE_AssessmentCriteriaAnswer.new AssessmentCriteriaAnswerPipeLineFactory<From, AssessmentCriteriaAnswer> (this, new ORMMultiAssocPipe<Me, AssessmentCriteriaAnswer>(MULTIPLEREFERENCE_AssessmentCriteriaAnswers, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "AppProcessOption"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "OverallRank"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "RoleFit"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "RequirementFit"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "CultureFit"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "FactorScoreDetails"))
        {
            return true;
        }
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


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


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

    public Job getJob () throws StorageException
    {
        return (Job)(Job.DUMMY_Job);
    }


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

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


    public AssessmentCriteriaAnswer getAssessmentCriteriaAnswersAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association AssessmentCriteriaAnswers");
    }


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

}

    
