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

import oneit.security.*;



public abstract class BaseJob extends BaseBusinessClass
{
    // Reference instance for the object
    public static final Job REFERENCE_Job = new Job ();

    // Reference instance for the object
    public static final Job DUMMY_Job = new DummyJob ();

    // Static constants corresponding to field names
    
    public static final String FIELD_JobTitle = "JobTitle";
    public static final String FIELD_JobDescription = "JobDescription";
    public static final String FIELD_JobStatus = "JobStatus";
    public static final String FIELD_ApplyBy = "ApplyBy";
    public static final String FIELD_IncludeAssessmentCriteria = "IncludeAssessmentCriteria";
    public static final String FIELD_AssessmentType = "AssessmentType";
    public static final String FIELD_RandomKey = "RandomKey";
    public static final String FIELD_Email = "Email";
    public static final String SINGLEREFERENCE_Level = "Level";
    public static final String SINGLEREFERENCE_SecUser = "SecUser";
    public static final String MULTIPLEREFERENCE_JobApplications = "JobApplications";
    public static final String BACKREF_JobApplications = "";
    public static final String MULTIPLEREFERENCE_AssessmentCriterias = "AssessmentCriterias";
    public static final String BACKREF_AssessmentCriterias = "";
    public static final String MULTIPLEREFERENCE_CultureCriterias = "CultureCriterias";
    public static final String BACKREF_CultureCriterias = "";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<Job> HELPER_JobTitle = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Job> HELPER_JobDescription = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<Job, JobStatus> HELPER_JobStatus =  new EnumeratedAttributeHelper<Job, JobStatus> (JobStatus.FACTORY_JobStatus);
    private static final DefaultAttributeHelper<Job> HELPER_ApplyBy = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Job> HELPER_IncludeAssessmentCriteria = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<Job, AssessmentType> HELPER_AssessmentType =  new EnumeratedAttributeHelper<Job, AssessmentType> (AssessmentType.FACTORY_AssessmentType);
    private static final DefaultAttributeHelper<Job> HELPER_RandomKey = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<Job> HELPER_Email = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private String _JobTitle;
    private String _JobDescription;
    private JobStatus _JobStatus;
    private Date _ApplyBy;
    private Boolean _IncludeAssessmentCriteria;
    private AssessmentType _AssessmentType;
    private String _RandomKey;
    private String _Email;
    

    // Private attributes corresponding to single references
    private SingleAssociation<Job, Level> _Level;
    private SingleAssociation<Job, SecUser> _SecUser;
    

    // Private attributes corresponding to multiple references
    private MultipleAssociation<Job, JobApplication> _JobApplications;
    private MultipleAssociation<Job, AssessmentCriteria> _AssessmentCriterias;
    private MultipleAssociation<Job, CultureCriteria> _CultureCriterias;
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_Email_Validators;
    private static final AttributeValidator[] FIELD_JobTitle_Validators;
    private static final AttributeValidator[] FIELD_JobDescription_Validators;
    private static final AttributeValidator[] FIELD_JobStatus_Validators;
    private static final AttributeValidator[] FIELD_ApplyBy_Validators;
    private static final AttributeValidator[] FIELD_IncludeAssessmentCriteria_Validators;
    private static final AttributeValidator[] FIELD_AssessmentType_Validators;
    private static final AttributeValidator[] FIELD_RandomKey_Validators;
    

    // Arrays of behaviour decorators
    private static final JobBehaviourDecorator[] Job_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_JobApplications = JobApplication.BACKREF_Job;
            String tmp_AssessmentCriterias = AssessmentCriteria.BACKREF_Job;
            String tmp_CultureCriterias = CultureCriteria.BACKREF_Job;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_JobApplications();
            setupAssocMetaData_AssessmentCriterias();
            setupAssocMetaData_CultureCriterias();
            setupAssocMetaData_Level();
            setupAssocMetaData_SecUser();
            FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_JobTitle_Validators = (AttributeValidator[])setupAttribMetaData_JobTitle(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_JobDescription_Validators = (AttributeValidator[])setupAttribMetaData_JobDescription(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_JobStatus_Validators = (AttributeValidator[])setupAttribMetaData_JobStatus(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ApplyBy_Validators = (AttributeValidator[])setupAttribMetaData_ApplyBy(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IncludeAssessmentCriteria_Validators = (AttributeValidator[])setupAttribMetaData_IncludeAssessmentCriteria(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_AssessmentType_Validators = (AttributeValidator[])setupAttribMetaData_AssessmentType(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_RandomKey_Validators = (AttributeValidator[])setupAttribMetaData_RandomKey(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_Job.initialiseReference ();
            DUMMY_Job.initialiseReference ();
            Job_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(Job.class).toArray(new JobBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

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

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

        metaInfo.put ("backreferenceName", "Job");
        metaInfo.put ("name", "AssessmentCriterias");
        metaInfo.put ("type", "AssessmentCriteria");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.AssessmentCriterias:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (MULTIPLEREFERENCE_AssessmentCriterias, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_CultureCriterias()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "Job");
        metaInfo.put ("name", "CultureCriterias");
        metaInfo.put ("type", "CultureCriteria");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.CultureCriterias:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (MULTIPLEREFERENCE_CultureCriterias, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Level()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "level_id");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "Level");
        metaInfo.put ("type", "Level");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.Level:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (SINGLEREFERENCE_Level, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_SecUser()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "secuser_id");
        metaInfo.put ("name", "SecUser");
        metaInfo.put ("type", "SecUser");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.SecUser:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (SINGLEREFERENCE_SecUser, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static List setupAttribMetaData_Email(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("name", "Email");
        metaInfo.put ("type", "String");
        metaInfo.put ("validators", "Email");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.Email:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_Email, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "job_title");
        metaInfo.put ("length", "500");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "JobTitle");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.JobTitle:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_JobTitle, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "job_description");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "JobDescription");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.JobDescription:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_JobDescription, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "job_status");
        metaInfo.put ("defaultValue", "JobStatus.DRAFT");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "JobStatus");
        metaInfo.put ("type", "JobStatus");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.JobStatus:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_JobStatus, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "apply_by");
        metaInfo.put ("name", "ApplyBy");
        metaInfo.put ("type", "Date");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.ApplyBy:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_ApplyBy, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "include_assessment_criteria");
        metaInfo.put ("defaultValue", "Boolean.TRUE");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "IncludeAssessmentCriteria");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.IncludeAssessmentCriteria:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_IncludeAssessmentCriteria, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "assessment_type");
        metaInfo.put ("defaultValue", "AssessmentType.COMPREHENSIVE");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "AssessmentType");
        metaInfo.put ("type", "AssessmentType");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.AssessmentType:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_AssessmentType, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "random_key");
        metaInfo.put ("length", "10");
        metaInfo.put ("name", "RandomKey");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for Job.RandomKey:", metaInfo);
        ATTRIBUTES_METADATA_Job.put (FIELD_RandomKey, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _JobTitle = (String)(HELPER_JobTitle.initialise (_JobTitle));
        _JobDescription = (String)(HELPER_JobDescription.initialise (_JobDescription));
        _JobStatus = (JobStatus)(JobStatus.DRAFT);
        _ApplyBy = (Date)(HELPER_ApplyBy.initialise (_ApplyBy));
        _IncludeAssessmentCriteria = (Boolean)(Boolean.TRUE);
        _AssessmentType = (AssessmentType)(AssessmentType.COMPREHENSIVE);
        _RandomKey = (String)(HELPER_RandomKey.initialise (_RandomKey));
        _Email = (String)(HELPER_Email.initialise (_Email));
    }


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

        _Level = new SingleAssociation<Job, Level> (this, SINGLEREFERENCE_Level, null, Level.REFERENCE_Level, "tl_job");
        _SecUser = new SingleAssociation<Job, SecUser> (this, SINGLEREFERENCE_SecUser, null, SecUser.REFERENCE_SecUser, "tl_job");
        _JobApplications = new MultipleAssociation<Job, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Job, JobApplication.REFERENCE_JobApplication);
        _AssessmentCriterias = new MultipleAssociation<Job, AssessmentCriteria> (this, MULTIPLEREFERENCE_AssessmentCriterias, AssessmentCriteria.SINGLEREFERENCE_Job, AssessmentCriteria.REFERENCE_AssessmentCriteria);
        _CultureCriterias = new MultipleAssociation<Job, CultureCriteria> (this, MULTIPLEREFERENCE_CultureCriterias, CultureCriteria.SINGLEREFERENCE_Job, CultureCriteria.REFERENCE_CultureCriteria);
        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _Level = new SingleAssociation<Job, Level> (this, SINGLEREFERENCE_Level, null, Level.REFERENCE_Level, "tl_job");
        _SecUser = new SingleAssociation<Job, SecUser> (this, SINGLEREFERENCE_SecUser, null, SecUser.REFERENCE_SecUser, "tl_job");
        _JobApplications = new MultipleAssociation<Job, JobApplication> (this, MULTIPLEREFERENCE_JobApplications, JobApplication.SINGLEREFERENCE_Job, JobApplication.REFERENCE_JobApplication);
        _AssessmentCriterias = new MultipleAssociation<Job, AssessmentCriteria> (this, MULTIPLEREFERENCE_AssessmentCriterias, AssessmentCriteria.SINGLEREFERENCE_Job, AssessmentCriteria.REFERENCE_AssessmentCriteria);
        _CultureCriterias = new MultipleAssociation<Job, CultureCriteria> (this, MULTIPLEREFERENCE_CultureCriterias, CultureCriteria.SINGLEREFERENCE_Job, CultureCriteria.REFERENCE_CultureCriteria);
        
        
        return this;
    }

    

    /**
     * Get the attribute JobTitle
     */
    public String getJobTitle ()
    {
        assertValid();
        String valToReturn = _JobTitle;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getJobTitle ((Job)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 preJobTitleChange (String newJobTitle) 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 postJobTitleChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute JobTitle.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setJobTitle (String newJobTitle) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_JobTitle.compare (_JobTitle, newJobTitle);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newJobTitle = bhd.setJobTitle ((Job)this, newJobTitle);
                oldAndNewIdentical = HELPER_JobTitle.compare (_JobTitle, newJobTitle);
            }

            BusinessObjectParser.assertFieldCondition (newJobTitle != null, this, FIELD_JobTitle, "mandatory");
            

            if (FIELD_JobTitle_Validators.length > 0)
            {
                Object newJobTitleObj = HELPER_JobTitle.toObject (newJobTitle);

                if (newJobTitleObj != null)
                {
                    int     loopMax = FIELD_JobTitle_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_JobTitle);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_JobTitle () != FieldWriteability.FALSE, "Field  JobTitle is not writeable");
            preJobTitleChange (newJobTitle);
            markFieldChange (FIELD_JobTitle);
            _JobTitle = newJobTitle;            
            postFieldChange (FIELD_JobTitle);
            postJobTitleChange ();
        }
    }

    /**
     * Get the attribute JobDescription
     */
    public String getJobDescription ()
    {
        assertValid();
        String valToReturn = _JobDescription;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getJobDescription ((Job)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 preJobDescriptionChange (String newJobDescription) 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 postJobDescriptionChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute JobDescription.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setJobDescription (String newJobDescription) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_JobDescription.compare (_JobDescription, newJobDescription);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newJobDescription = bhd.setJobDescription ((Job)this, newJobDescription);
                oldAndNewIdentical = HELPER_JobDescription.compare (_JobDescription, newJobDescription);
            }

            BusinessObjectParser.assertFieldCondition (newJobDescription != null, this, FIELD_JobDescription, "mandatory");
            

            if (FIELD_JobDescription_Validators.length > 0)
            {
                Object newJobDescriptionObj = HELPER_JobDescription.toObject (newJobDescription);

                if (newJobDescriptionObj != null)
                {
                    int     loopMax = FIELD_JobDescription_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_JobDescription);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_JobDescription () != FieldWriteability.FALSE, "Field  JobDescription is not writeable");
            preJobDescriptionChange (newJobDescription);
            markFieldChange (FIELD_JobDescription);
            _JobDescription = newJobDescription;            
            postFieldChange (FIELD_JobDescription);
            postJobDescriptionChange ();
        }
    }

    /**
     * Get the attribute JobStatus
     */
    public JobStatus getJobStatus ()
    {
        assertValid();
        JobStatus valToReturn = _JobStatus;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getJobStatus ((Job)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 preJobStatusChange (JobStatus newJobStatus) 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 postJobStatusChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute JobStatus.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setJobStatus (JobStatus newJobStatus) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_JobStatus.compare (_JobStatus, newJobStatus);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newJobStatus = bhd.setJobStatus ((Job)this, newJobStatus);
                oldAndNewIdentical = HELPER_JobStatus.compare (_JobStatus, newJobStatus);
            }

            BusinessObjectParser.assertFieldCondition (newJobStatus != null, this, FIELD_JobStatus, "mandatory");
            

            if (FIELD_JobStatus_Validators.length > 0)
            {
                Object newJobStatusObj = HELPER_JobStatus.toObject (newJobStatus);

                if (newJobStatusObj != null)
                {
                    int     loopMax = FIELD_JobStatus_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_JobStatus);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_JobStatus () != FieldWriteability.FALSE, "Field  JobStatus is not writeable");
            preJobStatusChange (newJobStatus);
            markFieldChange (FIELD_JobStatus);
            _JobStatus = newJobStatus;            
            postFieldChange (FIELD_JobStatus);
            postJobStatusChange ();
        }
    }

    /**
     * Get the attribute ApplyBy
     */
    public Date getApplyBy ()
    {
        assertValid();
        Date valToReturn = _ApplyBy;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getApplyBy ((Job)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 preApplyByChange (Date newApplyBy) 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 postApplyByChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ApplyBy.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setApplyBy (Date newApplyBy) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ApplyBy.compare (_ApplyBy, newApplyBy);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newApplyBy = bhd.setApplyBy ((Job)this, newApplyBy);
                oldAndNewIdentical = HELPER_ApplyBy.compare (_ApplyBy, newApplyBy);
            }

            

            if (FIELD_ApplyBy_Validators.length > 0)
            {
                Object newApplyByObj = HELPER_ApplyBy.toObject (newApplyBy);

                if (newApplyByObj != null)
                {
                    int     loopMax = FIELD_ApplyBy_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_ApplyBy);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ApplyBy () != FieldWriteability.FALSE, "Field  ApplyBy is not writeable");
            preApplyByChange (newApplyBy);
            markFieldChange (FIELD_ApplyBy);
            _ApplyBy = newApplyBy;            
            postFieldChange (FIELD_ApplyBy);
            postApplyByChange ();
        }
    }

    /**
     * Get the attribute IncludeAssessmentCriteria
     */
    public Boolean getIncludeAssessmentCriteria ()
    {
        assertValid();
        Boolean valToReturn = _IncludeAssessmentCriteria;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getIncludeAssessmentCriteria ((Job)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 preIncludeAssessmentCriteriaChange (Boolean newIncludeAssessmentCriteria) 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 postIncludeAssessmentCriteriaChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute IncludeAssessmentCriteria.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIncludeAssessmentCriteria (Boolean newIncludeAssessmentCriteria) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_IncludeAssessmentCriteria.compare (_IncludeAssessmentCriteria, newIncludeAssessmentCriteria);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newIncludeAssessmentCriteria = bhd.setIncludeAssessmentCriteria ((Job)this, newIncludeAssessmentCriteria);
                oldAndNewIdentical = HELPER_IncludeAssessmentCriteria.compare (_IncludeAssessmentCriteria, newIncludeAssessmentCriteria);
            }

            BusinessObjectParser.assertFieldCondition (newIncludeAssessmentCriteria != null, this, FIELD_IncludeAssessmentCriteria, "mandatory");
            

            if (FIELD_IncludeAssessmentCriteria_Validators.length > 0)
            {
                Object newIncludeAssessmentCriteriaObj = HELPER_IncludeAssessmentCriteria.toObject (newIncludeAssessmentCriteria);

                if (newIncludeAssessmentCriteriaObj != null)
                {
                    int     loopMax = FIELD_IncludeAssessmentCriteria_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_IncludeAssessmentCriteria);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_IncludeAssessmentCriteria () != FieldWriteability.FALSE, "Field  IncludeAssessmentCriteria is not writeable");
            preIncludeAssessmentCriteriaChange (newIncludeAssessmentCriteria);
            markFieldChange (FIELD_IncludeAssessmentCriteria);
            _IncludeAssessmentCriteria = newIncludeAssessmentCriteria;            
            postFieldChange (FIELD_IncludeAssessmentCriteria);
            postIncludeAssessmentCriteriaChange ();
        }
    }

    /**
     * Get the attribute AssessmentType
     */
    public AssessmentType getAssessmentType ()
    {
        assertValid();
        AssessmentType valToReturn = _AssessmentType;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getAssessmentType ((Job)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 preAssessmentTypeChange (AssessmentType newAssessmentType) 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 postAssessmentTypeChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute AssessmentType.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setAssessmentType (AssessmentType newAssessmentType) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_AssessmentType.compare (_AssessmentType, newAssessmentType);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newAssessmentType = bhd.setAssessmentType ((Job)this, newAssessmentType);
                oldAndNewIdentical = HELPER_AssessmentType.compare (_AssessmentType, newAssessmentType);
            }

            BusinessObjectParser.assertFieldCondition (newAssessmentType != null, this, FIELD_AssessmentType, "mandatory");
            

            if (FIELD_AssessmentType_Validators.length > 0)
            {
                Object newAssessmentTypeObj = HELPER_AssessmentType.toObject (newAssessmentType);

                if (newAssessmentTypeObj != null)
                {
                    int     loopMax = FIELD_AssessmentType_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_AssessmentType);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_AssessmentType () != FieldWriteability.FALSE, "Field  AssessmentType is not writeable");
            preAssessmentTypeChange (newAssessmentType);
            markFieldChange (FIELD_AssessmentType);
            _AssessmentType = newAssessmentType;            
            postFieldChange (FIELD_AssessmentType);
            postAssessmentTypeChange ();
        }
    }

    /**
     * Get the attribute RandomKey
     */
    public String getRandomKey ()
    {
        assertValid();
        String valToReturn = _RandomKey;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getRandomKey ((Job)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 preRandomKeyChange (String newRandomKey) 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 postRandomKeyChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute RandomKey.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setRandomKey (String newRandomKey) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_RandomKey.compare (_RandomKey, newRandomKey);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newRandomKey = bhd.setRandomKey ((Job)this, newRandomKey);
                oldAndNewIdentical = HELPER_RandomKey.compare (_RandomKey, newRandomKey);
            }

            

            if (FIELD_RandomKey_Validators.length > 0)
            {
                Object newRandomKeyObj = HELPER_RandomKey.toObject (newRandomKey);

                if (newRandomKeyObj != null)
                {
                    int     loopMax = FIELD_RandomKey_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_RandomKey);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_RandomKey () != FieldWriteability.FALSE, "Field  RandomKey is not writeable");
            preRandomKeyChange (newRandomKey);
            markFieldChange (FIELD_RandomKey);
            _RandomKey = newRandomKey;            
            postFieldChange (FIELD_RandomKey);
            postRandomKeyChange ();
        }
    }

    /**
     * Get the attribute Email
     */
    public String getEmail ()
    {
        assertValid();
        String valToReturn = _Email;

            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                valToReturn = bhd.getEmail ((Job)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 preEmailChange (String newEmail) 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 postEmailChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Email.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setEmail (String newEmail) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Email.compare (_Email, newEmail);
        
        try
        {
            for (JobBehaviourDecorator bhd : Job_BehaviourDecorators)
            {
                newEmail = bhd.setEmail ((Job)this, newEmail);
                oldAndNewIdentical = HELPER_Email.compare (_Email, newEmail);
            }

            

            if (FIELD_Email_Validators.length > 0)
            {
                Object newEmailObj = HELPER_Email.toObject (newEmail);

                if (newEmailObj != null)
                {
                    int     loopMax = FIELD_Email_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_Job.get (FIELD_Email);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Email () != FieldWriteability.FALSE, "Field  Email is not writeable");
            preEmailChange (newEmail);
            markFieldChange (FIELD_Email);
            _Email = newEmail;            
            postFieldChange (FIELD_Email);
            postEmailChange ();
        }
    }



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

        
        result.add("Level");
        
        result.add("SecUser");
        

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_Level))
        {
            return _Level.getReferencedType ();
        }else if (assocName.equals (SINGLEREFERENCE_SecUser))
        {
            return _SecUser.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_Level))
        {
            return null ;
        }else if (assocName.equals (SINGLEREFERENCE_SecUser))
        {
            return null ;
        }
        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_Level))
        {
            return getLevel ();
        }else if (assocName.equals (SINGLEREFERENCE_SecUser))
        {
            return getSecUser ();
        }
        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_Level))
        {
            return getLevel (getType);
        }else if (assocName.equals (SINGLEREFERENCE_SecUser))
        {
            return getSecUser (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_Level))
        {
            return getLevelID ();
        }else if (assocName.equals (SINGLEREFERENCE_SecUser))
        {
            return getSecUserID ();
        }
        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_Level))
        {
            setLevel ((Level)(newValue));
        }else if (assocName.equals (SINGLEREFERENCE_SecUser))
        {
            setSecUser ((SecUser)(newValue));
        }
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



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


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


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

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


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



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

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

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getSecUserID ()
    {
        assertValid();
        
        if (_SecUser == null)
        {
            return null;
        }
        else
        {
            return _SecUser.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 preSecUserChange (SecUser newSecUser) 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 postSecUserChange () throws FieldException
    {
    }



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

        if (_SecUser.wouldReferencedChange (newSecUser))
        {
            assertValid();
            Debug.assertion (getWriteability_SecUser () != FieldWriteability.FALSE, "Assoc SecUser is not writeable");
            preSecUserChange (newSecUser);
            
                    _SecUser.set (newSecUser);
                
            postSecUserChange ();
        }
    }

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

        
        result.add("JobApplications");
        
        result.add("AssessmentCriterias");
        
        result.add("CultureCriterias");
        

        return result;
    }


    /**
     * Get the reference instance for the multi assoc name.
     */
    public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
    {
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return JobApplication.REFERENCE_JobApplication ;
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            return AssessmentCriteria.REFERENCE_AssessmentCriteria ;
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            return CultureCriteria.REFERENCE_CultureCriteria ;
        }
        

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return JobApplication.SINGLEREFERENCE_Job ;
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            return AssessmentCriteria.SINGLEREFERENCE_Job ;
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            return CultureCriteria.SINGLEREFERENCE_Job ;
        }
        

        return super.getMultiAssocBackReference(attribName);
    }


    /**
     * Get the assoc count for the multi assoc name.
     */
    public int getMultiAssocCount(String attribName) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return this.getJobApplicationsCount();
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            return this.getAssessmentCriteriasCount();
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            return this.getCultureCriteriasCount();
        }
        

        return super.getMultiAssocCount(attribName);
    }


    /**
     * Get the assoc at a particular index
     */
    public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return this.getJobApplicationsAt(index);
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            return this.getAssessmentCriteriasAt(index);
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            return this.getCultureCriteriasAt(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_JobApplications.equals(attribName))
        {
            addToJobApplications((JobApplication)newElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            addToAssessmentCriterias((AssessmentCriteria)newElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            addToCultureCriterias((CultureCriteria)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_JobApplications.equals(attribName))
        {
            removeFromJobApplications((JobApplication)oldElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            removeFromAssessmentCriterias((AssessmentCriteria)oldElement);

            return;
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            removeFromCultureCriterias((CultureCriteria)oldElement);

            return;
        }
        

        super.removeFromMultiAssoc(attribName, oldElement);
    }


    protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
    {
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            _JobApplications.__loadAssociation (elements);
            return;
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            _AssessmentCriterias.__loadAssociation (elements);
            return;
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            _CultureCriterias.__loadAssociation (elements);
            return;
        }
        

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {
        
        if (MULTIPLEREFERENCE_JobApplications.equals(attribName))
        {
            return _JobApplications.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_AssessmentCriterias.equals(attribName))
        {
            return _AssessmentCriterias.isLoaded ();
        }
        
        if (MULTIPLEREFERENCE_CultureCriterias.equals(attribName))
        {
            return _CultureCriterias.isLoaded ();
        }
        

        return super.__isMultiAssocLoaded(attribName);
    }

    

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


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

            try
            {
                if (newElement.getJob () != this)
                {
                    newElement.setJob ((Job)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


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


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


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

    public FieldWriteability getWriteability_AssessmentCriterias ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getAssessmentCriteriasCount () throws StorageException
    {
        assertValid();
        return _AssessmentCriterias.getReferencedObjectsCount ();
    }


    public void addToAssessmentCriterias (AssessmentCriteria newElement) throws StorageException
    {
        if (_AssessmentCriterias.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_AssessmentCriterias () != FieldWriteability.FALSE, "MultiAssoc AssessmentCriterias is not writeable (add)");
            _AssessmentCriterias.appendElement (newElement);

            try
            {
                if (newElement.getJob () != this)
                {
                    newElement.setJob ((Job)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromAssessmentCriterias (AssessmentCriteria elementToRemove) throws StorageException
    {
        if (_AssessmentCriterias.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_AssessmentCriterias () != FieldWriteability.FALSE, "MultiAssoc AssessmentCriterias is not writeable (remove)");
            _AssessmentCriterias.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getJob () != null)
                {
                    elementToRemove.setJob (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public AssessmentCriteria getAssessmentCriteriasAt (int index) throws StorageException
    {
        return (AssessmentCriteria)(_AssessmentCriterias.getElementAt (index));
    }


    public SortedSet<AssessmentCriteria> getAssessmentCriteriasSet () throws StorageException
    {
        return _AssessmentCriterias.getSet ();
    }

    public FieldWriteability getWriteability_CultureCriterias ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getCultureCriteriasCount () throws StorageException
    {
        assertValid();
        return _CultureCriterias.getReferencedObjectsCount ();
    }


    public void addToCultureCriterias (CultureCriteria newElement) throws StorageException
    {
        if (_CultureCriterias.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_CultureCriterias () != FieldWriteability.FALSE, "MultiAssoc CultureCriterias is not writeable (add)");
            _CultureCriterias.appendElement (newElement);

            try
            {
                if (newElement.getJob () != this)
                {
                    newElement.setJob ((Job)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromCultureCriterias (CultureCriteria elementToRemove) throws StorageException
    {
        if (_CultureCriterias.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_CultureCriterias () != FieldWriteability.FALSE, "MultiAssoc CultureCriterias is not writeable (remove)");
            _CultureCriterias.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getJob () != null)
                {
                    elementToRemove.setJob (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public CultureCriteria getCultureCriteriasAt (int index) throws StorageException
    {
        return (CultureCriteria)(_CultureCriterias.getElementAt (index));
    }


    public SortedSet<CultureCriteria> getCultureCriteriasSet () throws StorageException
    {
        return _CultureCriterias.getSet ();
    }



    public void onDelete ()
    {
        try 
        {
            for(JobApplication referenced : CollectionUtils.reverse(getJobApplicationsSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Job from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setJob(null);
            }

            for(AssessmentCriteria referenced : CollectionUtils.reverse(getAssessmentCriteriasSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Job from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setJob(null);
            }

            for(CultureCriteria referenced : CollectionUtils.reverse(getCultureCriteriasSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Job from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setJob(null);
            }

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

        super.onDelete ();
    }


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


    public Job referenceInstance ()
    {
        return REFERENCE_Job;
    }


    public Job getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getJobByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_Job;
    }


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





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

        tl_jobPSet.setAttrib (FIELD_ObjectID, myID);
        tl_jobPSet.setAttrib (FIELD_JobTitle, HELPER_JobTitle.toObject (_JobTitle)); //
        tl_jobPSet.setAttrib (FIELD_JobDescription, HELPER_JobDescription.toObject (_JobDescription)); //
        tl_jobPSet.setAttrib (FIELD_JobStatus, HELPER_JobStatus.toObject (_JobStatus)); //
        tl_jobPSet.setAttrib (FIELD_ApplyBy, HELPER_ApplyBy.toObject (_ApplyBy)); //
        tl_jobPSet.setAttrib (FIELD_IncludeAssessmentCriteria, HELPER_IncludeAssessmentCriteria.toObject (_IncludeAssessmentCriteria)); //
        tl_jobPSet.setAttrib (FIELD_AssessmentType, HELPER_AssessmentType.toObject (_AssessmentType)); //
        tl_jobPSet.setAttrib (FIELD_RandomKey, HELPER_RandomKey.toObject (_RandomKey)); //
        _Level.getPersistentSets (allSets);
        _SecUser.getPersistentSets (allSets);
        
    }


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

        
        PersistentSet   tl_jobPSet = allSets.getPersistentSet (objectID, "tl_job");

        _JobTitle = (String)(HELPER_JobTitle.fromObject (_JobTitle, tl_jobPSet.getAttrib (FIELD_JobTitle))); //
        _JobDescription = (String)(HELPER_JobDescription.fromObject (_JobDescription, tl_jobPSet.getAttrib (FIELD_JobDescription))); //
        _JobStatus = (JobStatus)(HELPER_JobStatus.fromObject (_JobStatus, tl_jobPSet.getAttrib (FIELD_JobStatus))); //
        _ApplyBy = (Date)(HELPER_ApplyBy.fromObject (_ApplyBy, tl_jobPSet.getAttrib (FIELD_ApplyBy))); //
        _IncludeAssessmentCriteria = (Boolean)(HELPER_IncludeAssessmentCriteria.fromObject (_IncludeAssessmentCriteria, tl_jobPSet.getAttrib (FIELD_IncludeAssessmentCriteria))); //
        _AssessmentType = (AssessmentType)(HELPER_AssessmentType.fromObject (_AssessmentType, tl_jobPSet.getAttrib (FIELD_AssessmentType))); //
        _RandomKey = (String)(HELPER_RandomKey.fromObject (_RandomKey, tl_jobPSet.getAttrib (FIELD_RandomKey))); //
        _Level.setFromPersistentSets (objectID, allSets);
        _SecUser.setFromPersistentSets (objectID, allSets);
        
    }





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

        if (other instanceof Job)
        {
            Job otherJob = (Job)other;
            
            try
            {
                setJobTitle (otherJob.getJobTitle ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setJobDescription (otherJob.getJobDescription ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setJobStatus (otherJob.getJobStatus ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setApplyBy (otherJob.getApplyBy ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setIncludeAssessmentCriteria (otherJob.getIncludeAssessmentCriteria ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setAssessmentType (otherJob.getAssessmentType ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setRandomKey (otherJob.getRandomKey ());
            }
            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 BaseJob)
        {
            BaseJob sourceJob = (BaseJob)(source);

            _JobTitle = sourceJob._JobTitle;
            _JobDescription = sourceJob._JobDescription;
            _JobStatus = sourceJob._JobStatus;
            _ApplyBy = sourceJob._ApplyBy;
            _IncludeAssessmentCriteria = sourceJob._IncludeAssessmentCriteria;
            _AssessmentType = sourceJob._AssessmentType;
            _RandomKey = sourceJob._RandomKey;
            _Email = sourceJob._Email;
            
        }
    }


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

            _Level.copyFrom (sourceJob._Level, linkToGhosts);
            _SecUser.copyFrom (sourceJob._SecUser, 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 BaseJob)
        {
            BaseJob sourceJob = (BaseJob)(source);

            _JobApplications.copyFrom (sourceJob._JobApplications, linkToGhosts);
            _AssessmentCriterias.copyFrom (sourceJob._AssessmentCriterias, linkToGhosts);
            _CultureCriterias.copyFrom (sourceJob._CultureCriterias, linkToGhosts);
            
        }
    }


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

        
        context.check (getLevelID() != null, this, SINGLEREFERENCE_Level, "mandatory");
        
    }


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

        _JobTitle = (String)(HELPER_JobTitle.readExternal (_JobTitle, vals.get(FIELD_JobTitle))); //
        _JobDescription = (String)(HELPER_JobDescription.readExternal (_JobDescription, vals.get(FIELD_JobDescription))); //
        _JobStatus = (JobStatus)(HELPER_JobStatus.readExternal (_JobStatus, vals.get(FIELD_JobStatus))); //
        _ApplyBy = (Date)(HELPER_ApplyBy.readExternal (_ApplyBy, vals.get(FIELD_ApplyBy))); //
        _IncludeAssessmentCriteria = (Boolean)(HELPER_IncludeAssessmentCriteria.readExternal (_IncludeAssessmentCriteria, vals.get(FIELD_IncludeAssessmentCriteria))); //
        _AssessmentType = (AssessmentType)(HELPER_AssessmentType.readExternal (_AssessmentType, vals.get(FIELD_AssessmentType))); //
        _RandomKey = (String)(HELPER_RandomKey.readExternal (_RandomKey, vals.get(FIELD_RandomKey))); //
        _Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); //
        _Level.readExternalData(vals.get(SINGLEREFERENCE_Level));
        _SecUser.readExternalData(vals.get(SINGLEREFERENCE_SecUser));
        _JobApplications.readExternalData(vals.get(MULTIPLEREFERENCE_JobApplications));
        _AssessmentCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_AssessmentCriterias));
        _CultureCriterias.readExternalData(vals.get(MULTIPLEREFERENCE_CultureCriterias));
        
    }


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

        vals.put (FIELD_JobTitle, HELPER_JobTitle.writeExternal (_JobTitle));
        vals.put (FIELD_JobDescription, HELPER_JobDescription.writeExternal (_JobDescription));
        vals.put (FIELD_JobStatus, HELPER_JobStatus.writeExternal (_JobStatus));
        vals.put (FIELD_ApplyBy, HELPER_ApplyBy.writeExternal (_ApplyBy));
        vals.put (FIELD_IncludeAssessmentCriteria, HELPER_IncludeAssessmentCriteria.writeExternal (_IncludeAssessmentCriteria));
        vals.put (FIELD_AssessmentType, HELPER_AssessmentType.writeExternal (_AssessmentType));
        vals.put (FIELD_RandomKey, HELPER_RandomKey.writeExternal (_RandomKey));
        vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email));
        vals.put (SINGLEREFERENCE_Level, _Level.writeExternalData());
        vals.put (SINGLEREFERENCE_SecUser, _SecUser.writeExternalData());
        vals.put (MULTIPLEREFERENCE_JobApplications, _JobApplications.writeExternalData());
        vals.put (MULTIPLEREFERENCE_AssessmentCriterias, _AssessmentCriterias.writeExternalData());
        vals.put (MULTIPLEREFERENCE_CultureCriterias, _CultureCriterias.writeExternalData());
        
    }


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

        if (other instanceof BaseJob)
        {
            BaseJob otherJob = (BaseJob)(other);

            
            if (!HELPER_JobTitle.compare(this._JobTitle, otherJob._JobTitle))
            {
                listener.notifyFieldChange(this, other, FIELD_JobTitle, HELPER_JobTitle.toObject(this._JobTitle), HELPER_JobTitle.toObject(otherJob._JobTitle));
            }
            if (!HELPER_JobDescription.compare(this._JobDescription, otherJob._JobDescription))
            {
                listener.notifyFieldChange(this, other, FIELD_JobDescription, HELPER_JobDescription.toObject(this._JobDescription), HELPER_JobDescription.toObject(otherJob._JobDescription));
            }
            if (!HELPER_JobStatus.compare(this._JobStatus, otherJob._JobStatus))
            {
                listener.notifyFieldChange(this, other, FIELD_JobStatus, HELPER_JobStatus.toObject(this._JobStatus), HELPER_JobStatus.toObject(otherJob._JobStatus));
            }
            if (!HELPER_ApplyBy.compare(this._ApplyBy, otherJob._ApplyBy))
            {
                listener.notifyFieldChange(this, other, FIELD_ApplyBy, HELPER_ApplyBy.toObject(this._ApplyBy), HELPER_ApplyBy.toObject(otherJob._ApplyBy));
            }
            if (!HELPER_IncludeAssessmentCriteria.compare(this._IncludeAssessmentCriteria, otherJob._IncludeAssessmentCriteria))
            {
                listener.notifyFieldChange(this, other, FIELD_IncludeAssessmentCriteria, HELPER_IncludeAssessmentCriteria.toObject(this._IncludeAssessmentCriteria), HELPER_IncludeAssessmentCriteria.toObject(otherJob._IncludeAssessmentCriteria));
            }
            if (!HELPER_AssessmentType.compare(this._AssessmentType, otherJob._AssessmentType))
            {
                listener.notifyFieldChange(this, other, FIELD_AssessmentType, HELPER_AssessmentType.toObject(this._AssessmentType), HELPER_AssessmentType.toObject(otherJob._AssessmentType));
            }
            if (!HELPER_RandomKey.compare(this._RandomKey, otherJob._RandomKey))
            {
                listener.notifyFieldChange(this, other, FIELD_RandomKey, HELPER_RandomKey.toObject(this._RandomKey), HELPER_RandomKey.toObject(otherJob._RandomKey));
            }

            // Compare single assocs
            _Level.compare (otherJob._Level, listener);
            _SecUser.compare (otherJob._SecUser, listener);
            

            // Compare multiple assocs
            _JobApplications.compare (otherJob._JobApplications, listener);
            _AssessmentCriterias.compare (otherJob._AssessmentCriterias, listener);
            _CultureCriterias.compare (otherJob._CultureCriterias, listener);
            
        }
    }


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

        visitor.visitField(this, FIELD_Email, HELPER_Email.toObject(getEmail()));
        
    }


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

        visitor.visitField(this, FIELD_JobTitle, HELPER_JobTitle.toObject(getJobTitle()));
        visitor.visitField(this, FIELD_JobDescription, HELPER_JobDescription.toObject(getJobDescription()));
        visitor.visitField(this, FIELD_JobStatus, HELPER_JobStatus.toObject(getJobStatus()));
        visitor.visitField(this, FIELD_ApplyBy, HELPER_ApplyBy.toObject(getApplyBy()));
        visitor.visitField(this, FIELD_IncludeAssessmentCriteria, HELPER_IncludeAssessmentCriteria.toObject(getIncludeAssessmentCriteria()));
        visitor.visitField(this, FIELD_AssessmentType, HELPER_AssessmentType.toObject(getAssessmentType()));
        visitor.visitField(this, FIELD_RandomKey, HELPER_RandomKey.toObject(getRandomKey()));
        visitor.visitAssociation (_Level);
        visitor.visitAssociation (_SecUser);
        visitor.visitAssociation (_JobApplications);
        visitor.visitAssociation (_AssessmentCriterias);
        visitor.visitAssociation (_CultureCriterias);
        
    }


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

        if (scope.includes (_Level))
        {
            visitor.visit (_Level);
        }
        if (scope.includes (_SecUser))
        {
            visitor.visit (_SecUser);
        }
        if (scope.includes (_JobApplications))
        {
            visitor.visit (_JobApplications);
        }
        if (scope.includes (_AssessmentCriterias))
        {
            visitor.visit (_AssessmentCriterias);
        }
        if (scope.includes (_CultureCriterias))
        {
            visitor.visit (_CultureCriterias);
        }
        
    }


    public static Job createJob (ObjectTransaction transaction) throws StorageException
    {
        Job     result = new Job ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static Job getJobByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (Job)(transaction.getObjectByID (REFERENCE_Job, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_JobTitle))
        {
            return filter.matches (getJobTitle ());
        }
        else if (attribName.equals (FIELD_JobDescription))
        {
            return filter.matches (getJobDescription ());
        }
        else if (attribName.equals (FIELD_JobStatus))
        {
            return filter.matches (getJobStatus ());
        }
        else if (attribName.equals (FIELD_ApplyBy))
        {
            return filter.matches (getApplyBy ());
        }
        else if (attribName.equals (FIELD_IncludeAssessmentCriteria))
        {
            return filter.matches (getIncludeAssessmentCriteria ());
        }
        else if (attribName.equals (FIELD_AssessmentType))
        {
            return filter.matches (getAssessmentType ());
        }
        else if (attribName.equals (FIELD_RandomKey))
        {
            return filter.matches (getRandomKey ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Level))
        {
            return filter.matches (getLevel ());
        }
        else if (attribName.equals (SINGLEREFERENCE_SecUser))
        {
            return filter.matches (getSecUser ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
            public SearchAll andJobTitle (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_job.job_title", "JobTitle");
                return this;
            }
            
            public SearchAll andJobDescription (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_job.job_description", "JobDescription");
                return this;
            }
            
            public SearchAll andJobStatus (QueryFilter<JobStatus> filter)
            {
                filter.addFilter (context, "tl_job.job_status", "JobStatus");
                return this;
            }
            
            public SearchAll andApplyBy (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "tl_job.apply_by", "ApplyBy");
                return this;
            }
            
            public SearchAll andIncludeAssessmentCriteria (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "tl_job.include_assessment_criteria", "IncludeAssessmentCriteria");
                return this;
            }
            
            public SearchAll andAssessmentType (QueryFilter<AssessmentType> filter)
            {
                filter.addFilter (context, "tl_job.assessment_type", "AssessmentType");
                return this;
            }
            
            public SearchAll andRandomKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_job.random_key", "RandomKey");
                return this;
            }
            
            public SearchAll andLevel (QueryFilter<Level> filter)
            {
                filter.addFilter (context, "tl_job.level_id", "Level");
                return this;
            }
            
            public SearchAll andSecUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "tl_job.secuser_id", "SecUser");
                return this;
            }
            
                public Job[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_Job, SEARCH_All, criteria);
            Set<Job>   typedResults = new LinkedHashSet <Job> ();
            for (BaseBusinessClass bbcResult : results)
            {
                Job aResult = (Job)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new Job[0]);
                            
        }
    }

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

    public static SearchJobKey SearchByJobKey () { return new SearchJobKey (); }

    public static class SearchJobKey extends SearchObject<Job>
    {
        
        public SearchJobKey byID (Long ID)
        {
            by ("ID", ID);
            return this;
        }
        
        public SearchJobKey byKey (String Key)
        {
            by ("Key", Key);
            return this;
        }
        
            public SearchJobKey andObjectID (QueryFilter<Long> filter)
            {
                filter.addFilter (context, "tl_job.object_id", FIELD_ObjectID);
                return this;
            }

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

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

            
            public SearchJobKey andJobTitle (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_job.job_title", "JobTitle");
                return this;
            }
            
            public SearchJobKey andJobDescription (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_job.job_description", "JobDescription");
                return this;
            }
            
            public SearchJobKey andJobStatus (QueryFilter<JobStatus> filter)
            {
                filter.addFilter (context, "tl_job.job_status", "JobStatus");
                return this;
            }
            
            public SearchJobKey andApplyBy (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "tl_job.apply_by", "ApplyBy");
                return this;
            }
            
            public SearchJobKey andIncludeAssessmentCriteria (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "tl_job.include_assessment_criteria", "IncludeAssessmentCriteria");
                return this;
            }
            
            public SearchJobKey andAssessmentType (QueryFilter<AssessmentType> filter)
            {
                filter.addFilter (context, "tl_job.assessment_type", "AssessmentType");
                return this;
            }
            
            public SearchJobKey andRandomKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "tl_job.random_key", "RandomKey");
                return this;
            }
            
            public SearchJobKey andLevel (QueryFilter<Level> filter)
            {
                filter.addFilter (context, "tl_job.level_id", "Level");
                return this;
            }
            
            public SearchJobKey andSecUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "tl_job.secuser_id", "SecUser");
                return this;
            }
            
                public Job search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_Job, SEARCH_JobKey, criteria);
            Set<Job>   typedResults = new LinkedHashSet <Job> ();
            for (BaseBusinessClass bbcResult : results)
            {
                Job aResult = (Job)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return (Job)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "Job", "");
                            
        }
    }

        
                public static Job searchJobKey (ObjectTransaction transaction, Long ID, String Key) throws StorageException
        {
            return SearchByJobKey ()
            .byID  (ID)
            .byKey  (Key)
            .search (transaction);
        }



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_JobTitle))
        {
            return HELPER_JobTitle.toObject (getJobTitle ());
        }
        else if (attribName.equals (FIELD_JobDescription))
        {
            return HELPER_JobDescription.toObject (getJobDescription ());
        }
        else if (attribName.equals (FIELD_JobStatus))
        {
            return HELPER_JobStatus.toObject (getJobStatus ());
        }
        else if (attribName.equals (FIELD_ApplyBy))
        {
            return HELPER_ApplyBy.toObject (getApplyBy ());
        }
        else if (attribName.equals (FIELD_IncludeAssessmentCriteria))
        {
            return HELPER_IncludeAssessmentCriteria.toObject (getIncludeAssessmentCriteria ());
        }
        else if (attribName.equals (FIELD_AssessmentType))
        {
            return HELPER_AssessmentType.toObject (getAssessmentType ());
        }
        else if (attribName.equals (FIELD_RandomKey))
        {
            return HELPER_RandomKey.toObject (getRandomKey ());
        }
        else if (attribName.equals (FIELD_Email))
        {
            return HELPER_Email.toObject (getEmail ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_JobTitle))
        {
            return HELPER_JobTitle;
        }
        else if (attribName.equals (FIELD_JobDescription))
        {
            return HELPER_JobDescription;
        }
        else if (attribName.equals (FIELD_JobStatus))
        {
            return HELPER_JobStatus;
        }
        else if (attribName.equals (FIELD_ApplyBy))
        {
            return HELPER_ApplyBy;
        }
        else if (attribName.equals (FIELD_IncludeAssessmentCriteria))
        {
            return HELPER_IncludeAssessmentCriteria;
        }
        else if (attribName.equals (FIELD_AssessmentType))
        {
            return HELPER_AssessmentType;
        }
        else if (attribName.equals (FIELD_RandomKey))
        {
            return HELPER_RandomKey;
        }
        else if (attribName.equals (FIELD_Email))
        {
            return HELPER_Email;
        }
        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_JobTitle))
        {
            setJobTitle ((String)(HELPER_JobTitle.fromObject (_JobTitle, attribValue)));            
        }
        else if (attribName.equals (FIELD_JobDescription))
        {
            setJobDescription ((String)(HELPER_JobDescription.fromObject (_JobDescription, attribValue)));            
        }
        else if (attribName.equals (FIELD_JobStatus))
        {
            setJobStatus ((JobStatus)(HELPER_JobStatus.fromObject (_JobStatus, attribValue)));            
        }
        else if (attribName.equals (FIELD_ApplyBy))
        {
            setApplyBy ((Date)(HELPER_ApplyBy.fromObject (_ApplyBy, attribValue)));            
        }
        else if (attribName.equals (FIELD_IncludeAssessmentCriteria))
        {
            setIncludeAssessmentCriteria ((Boolean)(HELPER_IncludeAssessmentCriteria.fromObject (_IncludeAssessmentCriteria, attribValue)));            
        }
        else if (attribName.equals (FIELD_AssessmentType))
        {
            setAssessmentType ((AssessmentType)(HELPER_AssessmentType.fromObject (_AssessmentType, attribValue)));            
        }
        else if (attribName.equals (FIELD_RandomKey))
        {
            setRandomKey ((String)(HELPER_RandomKey.fromObject (_RandomKey, attribValue)));            
        }
        else if (attribName.equals (FIELD_Email))
        {
            setEmail ((String)(HELPER_Email.fromObject (_Email, 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_JobTitle))
        {
            return getWriteability_JobTitle ();
        }
        else if (fieldName.equals (FIELD_JobDescription))
        {
            return getWriteability_JobDescription ();
        }
        else if (fieldName.equals (FIELD_JobStatus))
        {
            return getWriteability_JobStatus ();
        }
        else if (fieldName.equals (FIELD_ApplyBy))
        {
            return getWriteability_ApplyBy ();
        }
        else if (fieldName.equals (FIELD_IncludeAssessmentCriteria))
        {
            return getWriteability_IncludeAssessmentCriteria ();
        }
        else if (fieldName.equals (FIELD_AssessmentType))
        {
            return getWriteability_AssessmentType ();
        }
        else if (fieldName.equals (FIELD_RandomKey))
        {
            return getWriteability_RandomKey ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_JobApplications))
        {
            return getWriteability_JobApplications ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_AssessmentCriterias))
        {
            return getWriteability_AssessmentCriterias ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_CultureCriterias))
        {
            return getWriteability_CultureCriterias ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Level))
        {
            return getWriteability_Level ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_SecUser))
        {
            return getWriteability_SecUser ();
        }
        else if (fieldName.equals (FIELD_Email))
        {
            return getWriteability_Email ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_JobTitle () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_JobTitle);
            }
        
            if (getWriteability_JobDescription () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_JobDescription);
            }
        
            if (getWriteability_JobStatus () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_JobStatus);
            }
        
            if (getWriteability_ApplyBy () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ApplyBy);
            }
        
            if (getWriteability_IncludeAssessmentCriteria () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IncludeAssessmentCriteria);
            }
        
            if (getWriteability_AssessmentType () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_AssessmentType);
            }
        
            if (getWriteability_RandomKey () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_RandomKey);
            }
        
            if (getWriteability_Email () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Email);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_JobTitle.getAttribObject (getClass (), _JobTitle, true, FIELD_JobTitle));
        result.add(HELPER_JobDescription.getAttribObject (getClass (), _JobDescription, true, FIELD_JobDescription));
        result.add(HELPER_JobStatus.getAttribObject (getClass (), _JobStatus, true, FIELD_JobStatus));
        result.add(HELPER_ApplyBy.getAttribObject (getClass (), _ApplyBy, false, FIELD_ApplyBy));
        result.add(HELPER_IncludeAssessmentCriteria.getAttribObject (getClass (), _IncludeAssessmentCriteria, true, FIELD_IncludeAssessmentCriteria));
        result.add(HELPER_AssessmentType.getAttribObject (getClass (), _AssessmentType, true, FIELD_AssessmentType));
        result.add(HELPER_RandomKey.getAttribObject (getClass (), _RandomKey, false, FIELD_RandomKey));
        result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email));

        return result;
    }


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


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

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

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

    public static class JobBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<Job>
    {

    /**
     * Get the attribute JobTitle
     */
    public String getJobTitle (Job obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute JobTitle.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setJobTitle (Job obj, String newJobTitle) throws FieldException
    {
        return newJobTitle;
    }

    /**
     * Get the attribute JobDescription
     */
    public String getJobDescription (Job obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute JobDescription.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setJobDescription (Job obj, String newJobDescription) throws FieldException
    {
        return newJobDescription;
    }

    /**
     * Get the attribute JobStatus
     */
    public JobStatus getJobStatus (Job obj, JobStatus original)
    {
        return original;
    }

    /**
     * Change the value set for attribute JobStatus.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public JobStatus setJobStatus (Job obj, JobStatus newJobStatus) throws FieldException
    {
        return newJobStatus;
    }

    /**
     * Get the attribute ApplyBy
     */
    public Date getApplyBy (Job obj, Date original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ApplyBy.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Date setApplyBy (Job obj, Date newApplyBy) throws FieldException
    {
        return newApplyBy;
    }

    /**
     * Get the attribute IncludeAssessmentCriteria
     */
    public Boolean getIncludeAssessmentCriteria (Job obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IncludeAssessmentCriteria.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setIncludeAssessmentCriteria (Job obj, Boolean newIncludeAssessmentCriteria) throws FieldException
    {
        return newIncludeAssessmentCriteria;
    }

    /**
     * Get the attribute AssessmentType
     */
    public AssessmentType getAssessmentType (Job obj, AssessmentType original)
    {
        return original;
    }

    /**
     * Change the value set for attribute AssessmentType.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public AssessmentType setAssessmentType (Job obj, AssessmentType newAssessmentType) throws FieldException
    {
        return newAssessmentType;
    }

    /**
     * Get the attribute RandomKey
     */
    public String getRandomKey (Job obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute RandomKey.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setRandomKey (Job obj, String newRandomKey) throws FieldException
    {
        return newRandomKey;
    }

    /**
     * Get the attribute Email
     */
    public String getEmail (Job obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Email.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setEmail (Job obj, String newEmail) throws FieldException
    {
        return newEmail;
    }

    }

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

        public JobPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("JobApplications"))
            {
                return toJobApplications ();
            }                
            if (name.equals ("AssessmentCriterias"))
            {
                return toAssessmentCriterias ();
            }                
            if (name.equals ("CultureCriterias"))
            {
                return toCultureCriterias ();
            }                
            if (name.equals ("Email"))
            {
                return toEmail ();
            }                
            if (name.equals ("JobTitle"))
            {
                return toJobTitle ();
            }                
            if (name.equals ("JobDescription"))
            {
                return toJobDescription ();
            }                
            if (name.equals ("JobStatus"))
            {
                return toJobStatus ();
            }                
            if (name.equals ("ApplyBy"))
            {
                return toApplyBy ();
            }                
            if (name.equals ("IncludeAssessmentCriteria"))
            {
                return toIncludeAssessmentCriteria ();
            }                
            if (name.equals ("AssessmentType"))
            {
                return toAssessmentType ();
            }                
            if (name.equals ("RandomKey"))
            {
                return toRandomKey ();
            }                
            if (name.equals ("Level"))
            {
                return toLevel ();
            }                
            if (name.equals ("SecUser"))
            {
                return toSecUser ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, String> toEmail () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Email));  }
        
        public PipeLine<From, String> toJobTitle () { return pipe(new ORMAttributePipe<Me, String>(FIELD_JobTitle));  }
        
        public PipeLine<From, String> toJobDescription () { return pipe(new ORMAttributePipe<Me, String>(FIELD_JobDescription));  }
        
        public PipeLine<From, JobStatus> toJobStatus () { return pipe(new ORMAttributePipe<Me, JobStatus>(FIELD_JobStatus));  }
        
        public PipeLine<From, Date> toApplyBy () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ApplyBy));  }
        
        public PipeLine<From, Boolean> toIncludeAssessmentCriteria () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IncludeAssessmentCriteria));  }
        
        public PipeLine<From, AssessmentType> toAssessmentType () { return pipe(new ORMAttributePipe<Me, AssessmentType>(FIELD_AssessmentType));  }
        
        public PipeLine<From, String> toRandomKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_RandomKey));  }
        public Level.LevelPipeLineFactory<From, Level> toLevel () { return toLevel (Filter.ALL); }

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

        public SecUser.SecUserPipeLineFactory<From, SecUser> toSecUser (Filter<SecUser> filter) 
        { 
            return SecUser.REFERENCE_SecUser.new SecUserPipeLineFactory<From, SecUser> (this, new ORMSingleAssocPipe<Me, SecUser>(SINGLEREFERENCE_SecUser, filter)); 
        }
        public JobApplication.JobApplicationPipeLineFactory<From, JobApplication> toJobApplications () { return toJobApplications(Filter.ALL); }        

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

        public AssessmentCriteria.AssessmentCriteriaPipeLineFactory<From, AssessmentCriteria> toAssessmentCriterias (Filter<AssessmentCriteria> filter)
        {
            return AssessmentCriteria.REFERENCE_AssessmentCriteria.new AssessmentCriteriaPipeLineFactory<From, AssessmentCriteria> (this, new ORMMultiAssocPipe<Me, AssessmentCriteria>(MULTIPLEREFERENCE_AssessmentCriterias, filter)); 
        }
        public CultureCriteria.CultureCriteriaPipeLineFactory<From, CultureCriteria> toCultureCriterias () { return toCultureCriterias(Filter.ALL); }        

        public CultureCriteria.CultureCriteriaPipeLineFactory<From, CultureCriteria> toCultureCriterias (Filter<CultureCriteria> filter)
        {
            return CultureCriteria.REFERENCE_CultureCriteria.new CultureCriteriaPipeLineFactory<From, CultureCriteria> (this, new ORMMultiAssocPipe<Me, CultureCriteria>(MULTIPLEREFERENCE_CultureCriterias, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "Email"))
        {
            return true;
        }
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


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


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

    public SecUser getSecUser () throws StorageException
    {
        return (SecUser)(SecUser.DUMMY_SecUser);
    }


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

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


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


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

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


    public AssessmentCriteria getAssessmentCriteriasAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association AssessmentCriterias");
    }


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

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


    public CultureCriteria getCultureCriteriasAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association CultureCriterias");
    }


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

}

    
