/*
 * 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_IsSelected = "IsSelected";
    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 = "";
    public static final String MULTIPLEREFERENCE_CultureCriteriaAnswers = "CultureCriteriaAnswers";
    public static final String BACKREF_CultureCriteriaAnswers = "";
    public static final String MULTIPLEREFERENCE_ProfileAssessmentAnswers = "ProfileAssessmentAnswers";
    public static final String BACKREF_ProfileAssessmentAnswers = "";

    // Static constants corresponding to searches
    public static final String SEARCH_All = "All";
    public static final String SEARCH_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_IsSelected = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private BinaryContent _CV;
    private ApplicationStatus _ApplicationStatus;
    private Boolean _IsSelected;
    

    // 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;
    private MultipleAssociation<JobApplication, CultureCriteriaAnswer> _CultureCriteriaAnswers;
    private MultipleAssociation<JobApplication, Answer> _ProfileAssessmentAnswers;
    

    // 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_IsSelected_Validators;
    private static final AttributeValidator[] FIELD_CV_Validators;
    private static final AttributeValidator[] FIELD_ApplicationStatus_Validators;
    

    // Arrays of behaviour decorators
    private static final JobApplicationBehaviourDecorator[] JobApplication_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_AssessmentCriteriaAnswers = AssessmentCriteriaAnswer.BACKREF_JobApplication;
            String tmp_CultureCriteriaAnswers = CultureCriteriaAnswer.BACKREF_JobApplication;
            String tmp_ProfileAssessmentAnswers = Answer.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_CultureCriteriaAnswers();
            setupAssocMetaData_ProfileAssessmentAnswers();
            setupAssocMetaData_Candidate();
            setupAssocMetaData_Job();
            FIELD_IsSelected_Validators = (AttributeValidator[])setupAttribMetaData_IsSelected(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]);
            

            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_CultureCriteriaAnswers()
    {
        Map metaInfo = new HashMap ();

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

        metaInfo.put ("backreferenceName", "JobApplication");
        metaInfo.put ("name", "ProfileAssessmentAnswers");
        metaInfo.put ("type", "Answer");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.ProfileAssessmentAnswers:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, 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_IsSelected(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "IsSelected");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for JobApplication.IsSelected:", metaInfo);
        ATTRIBUTES_METADATA_JobApplication.put (FIELD_IsSelected, Collections.unmodifiableMap (metaInfo));

        List validators = BaseBusinessClass.getAttribValidators(JobApplication.class, "IsSelected", metaInfo, validatorMapping);
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for JobApplication.IsSelected:", 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 ("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;
    }
    
    // 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);
        _IsSelected = (Boolean)(Boolean.FALSE);
    }


    // 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);
        _CultureCriteriaAnswers = new MultipleAssociation<JobApplication, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
        _ProfileAssessmentAnswers = new MultipleAssociation<JobApplication, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_JobApplication, Answer.REFERENCE_Answer);
        
    }


    // 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);
        _CultureCriteriaAnswers = new MultipleAssociation<JobApplication, CultureCriteriaAnswer> (this, MULTIPLEREFERENCE_CultureCriteriaAnswers, CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication, CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer);
        _ProfileAssessmentAnswers = new MultipleAssociation<JobApplication, Answer> (this, MULTIPLEREFERENCE_ProfileAssessmentAnswers, Answer.SINGLEREFERENCE_JobApplication, Answer.REFERENCE_Answer);
        
        
        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);
            }

            

            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 IsSelected
     */
    public Boolean getIsSelected ()
    {
        assertValid();
        Boolean valToReturn = _IsSelected;

            for (JobApplicationBehaviourDecorator bhd : JobApplication_BehaviourDecorators)
            {
                valToReturn = bhd.getIsSelected ((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 preIsSelectedChange (Boolean newIsSelected) 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 postIsSelectedChange () throws FieldException
    {
    }

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

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

            

            if (FIELD_IsSelected_Validators.length > 0)
            {
                Object newIsSelectedObj = HELPER_IsSelected.toObject (newIsSelected);

                if (newIsSelectedObj != null)
                {
                    int     loopMax = FIELD_IsSelected_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_JobApplication.get (FIELD_IsSelected);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_IsSelected () != FieldWriteability.FALSE, "Field  IsSelected is not writeable");
            preIsSelectedChange (newIsSelected);
            markFieldChange (FIELD_IsSelected);
            _IsSelected = newIsSelected;            
            postFieldChange (FIELD_IsSelected);
            postIsSelectedChange ();
        }
    }



    /**
     * 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");
        
        result.add("CultureCriteriaAnswers");
        
        result.add("ProfileAssessmentAnswers");
        

        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 ;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return CultureCriteriaAnswer.REFERENCE_CultureCriteriaAnswer ;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return Answer.REFERENCE_Answer ;
        }
        

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return AssessmentCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return CultureCriteriaAnswer.SINGLEREFERENCE_JobApplication ;
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return Answer.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();
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return this.getCultureCriteriaAnswersCount();
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return this.getProfileAssessmentAnswersCount();
        }
        

        return super.getMultiAssocCount(attribName);
    }


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

        return super.getMultiAssocAt(attribName, index);
    }


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

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

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

            return;
        }
        

        super.addToMultiAssoc(attribName, newElement);
    }

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

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

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

            return;
        }
        

        super.removeFromMultiAssoc(attribName, oldElement);
    }


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

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {
        
        if (MULTIPLEREFERENCE_AssessmentCriteriaAnswers.equals(attribName))
        {
            return _AssessmentCriteriaAnswers.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_CultureCriteriaAnswers.equals(attribName))
        {
            return _CultureCriteriaAnswers.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_ProfileAssessmentAnswers.equals(attribName))
        {
            return _ProfileAssessmentAnswers.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 FieldWriteability getWriteability_CultureCriteriaAnswers ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getCultureCriteriaAnswersCount () throws StorageException
    {
        assertValid();
        return _CultureCriteriaAnswers.getReferencedObjectsCount ();
    }


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

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


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


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


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

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


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

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


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


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


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



    public void onDelete ()
    {
        try 
        {
            // Ensure we are removed from any loaded multi-associations that aren't mandatory
            if (_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);
            }

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

            for(Answer referenced : CollectionUtils.reverse(getProfileAssessmentAnswersSet()))
            { 
                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)); //
        _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))); //
        _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);
            }
            
        }
    }


    /**
     * 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;
            _IsSelected = sourceJobApplication._IsSelected;
            
        }
    }


    /**
     * 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);
            _CultureCriteriaAnswers.copyFrom (sourceJobApplication._CultureCriteriaAnswers, linkToGhosts);
            _ProfileAssessmentAnswers.copyFrom (sourceJobApplication._ProfileAssessmentAnswers, 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))); //
        _IsSelected = (Boolean)(HELPER_IsSelected.readExternal (_IsSelected, vals.get(FIELD_IsSelected))); //
        _Candidate.readExternalData(vals.get(SINGLEREFERENCE_Candidate));
        _Job.readExternalData(vals.get(SINGLEREFERENCE_Job));
        _AssessmentCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriteriaAnswers));
        _CultureCriteriaAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriteriaAnswers));
        _ProfileAssessmentAnswers.readExternalData(vals.get(MULTIPLEREFERENCE_ProfileAssessmentAnswers));
        
    }


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

        vals.put (FIELD_CV, HELPER_CV.writeExternal (_CV));
        vals.put (FIELD_ApplicationStatus, HELPER_ApplicationStatus.writeExternal (_ApplicationStatus));
        vals.put (FIELD_IsSelected, HELPER_IsSelected.writeExternal (_IsSelected));
        vals.put (SINGLEREFERENCE_Candidate, _Candidate.writeExternalData());
        vals.put (SINGLEREFERENCE_Job, _Job.writeExternalData());
        vals.put (MULTIPLEREFERENCE_AssessmentCriteriaAnswers, _AssessmentCriteriaAnswers.writeExternalData());
        vals.put (MULTIPLEREFERENCE_CultureCriteriaAnswers, _CultureCriteriaAnswers.writeExternalData());
        vals.put (MULTIPLEREFERENCE_ProfileAssessmentAnswers, _ProfileAssessmentAnswers.writeExternalData());
        
    }


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

        if (other instanceof 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));
            }

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

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


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

        visitor.visitField(this, FIELD_IsSelected, HELPER_IsSelected.toObject(getIsSelected()));
        
    }


    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.visitAssociation (_Candidate);
        visitor.visitAssociation (_Job);
        visitor.visitAssociation (_AssessmentCriteriaAnswers);
        visitor.visitAssociation (_CultureCriteriaAnswers);
        visitor.visitAssociation (_ProfileAssessmentAnswers);
        
    }


    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);
        }
        if (scope.includes (_CultureCriteriaAnswers))
        {
            visitor.visit (_CultureCriteriaAnswers);
        }
        if (scope.includes (_ProfileAssessmentAnswers))
        {
            visitor.visit (_ProfileAssessmentAnswers);
        }
        
    }


    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 (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 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 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 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
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_JobApplication, SEARCH_CandidateJob, criteria);
            Set<JobApplication>   typedResults = new LinkedHashSet <JobApplication> ();
            for (BaseBusinessClass bbcResult : results)
            {
                JobApplication aResult = (JobApplication)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    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_IsSelected))
        {
            return HELPER_IsSelected.toObject (getIsSelected ());
        }
        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_IsSelected))
        {
            return HELPER_IsSelected;
        }
        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_IsSelected))
        {
            setIsSelected ((Boolean)(HELPER_IsSelected.fromObject (_IsSelected, 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 (MULTIPLEREFERENCE_AssessmentCriteriaAnswers))
        {
            return getWriteability_AssessmentCriteriaAnswers ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_CultureCriteriaAnswers))
        {
            return getWriteability_CultureCriteriaAnswers ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_ProfileAssessmentAnswers))
        {
            return getWriteability_ProfileAssessmentAnswers ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Candidate))
        {
            return getWriteability_Candidate ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Job))
        {
            return getWriteability_Job ();
        }
        else if (fieldName.equals (FIELD_IsSelected))
        {
            return getWriteability_IsSelected ();
        }
        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_IsSelected () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IsSelected);
            }
        

        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, false, FIELD_ApplicationStatus));
        result.add(HELPER_IsSelected.getAttribObject (getClass (), _IsSelected, false, FIELD_IsSelected));

        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 IsSelected
     */
    public Boolean getIsSelected (JobApplication obj, Boolean original)
    {
        return original;
    }

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

    }

    
    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 ("CultureCriteriaAnswers"))
            {
                return toCultureCriteriaAnswers ();
            }                
            if (name.equals ("ProfileAssessmentAnswers"))
            {
                return toProfileAssessmentAnswers ();
            }                
            if (name.equals ("IsSelected"))
            {
                return toIsSelected ();
            }                
            if (name.equals ("CV"))
            {
                return toCV ();
            }                
            if (name.equals ("ApplicationStatus"))
            {
                return toApplicationStatus ();
            }                
            if (name.equals ("Candidate"))
            {
                return toCandidate ();
            }                
            if (name.equals ("Job"))
            {
                return toJob ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Boolean> toIsSelected () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsSelected));  }
        
        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 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 CultureCriteriaAnswer.CultureCriteriaAnswerPipeLineFactory<From, CultureCriteriaAnswer> toCultureCriteriaAnswers () { return toCultureCriteriaAnswers(Filter.ALL); }        

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

        public Answer.AnswerPipeLineFactory<From, Answer> toProfileAssessmentAnswers (Filter<Answer> filter)
        {
            return Answer.REFERENCE_Answer.new AnswerPipeLineFactory<From, Answer> (this, new ORMMultiAssocPipe<Me, Answer>(MULTIPLEREFERENCE_ProfileAssessmentAnswers, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "IsSelected"))
        {
            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();
    }

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


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


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

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


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


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

}

    
