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


    package performa.orm;

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

import oneit.security.*;

import performa.orm.types.*;



public abstract class BaseCompanyUser extends SecUserExtension
{
    // Reference instance for the object
    public static final CompanyUser REFERENCE_CompanyUser = new CompanyUser ();

    // Reference instance for the object
    public static final CompanyUser DUMMY_CompanyUser = new DummyCompanyUser ();

    // Static constants corresponding to field names
    
    public static final String FIELD_ForgotPasswordMailSendDate = "ForgotPasswordMailSendDate";
    public static final String FIELD_ForgotPasswordKey = "ForgotPasswordKey";
    public static final String FIELD_Role = "Role";
    public static final String FIELD_Roles = "Roles";
    public static final String FIELD_Phone = "Phone";
    public static final String FIELD_VerificationMailSendDate = "VerificationMailSendDate";
    public static final String FIELD_VerificationKey = "VerificationKey";
    public static final String FIELD_IsAccountVerified = "IsAccountVerified";
    public static final String FIELD_IsEmailChanged = "IsEmailChanged";
    public static final String FIELD_IsDisabled = "IsDisabled";
    public static final String FIELD_Email = "Email";
    public static final String FIELD_Password = "Password";
    public static final String FIELD_ConfirmPassword = "ConfirmPassword";
    public static final String SINGLEREFERENCE_Company = "Company";
    public static final String BACKREF_Company = "";
    public static final String SINGLEREFERENCE_DefaultHiringTeam = "DefaultHiringTeam";
    public static final String MULTIPLEREFERENCE_HiringTeams = "HiringTeams";
    public static final String BACKREF_HiringTeams = "";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<CompanyUser> HELPER_ForgotPasswordMailSendDate = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_ForgotPasswordKey = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<CompanyUser, RoleType> HELPER_Role =  new EnumeratedAttributeHelper<CompanyUser, RoleType> (RoleType.FACTORY_RoleType);
    private static final DelimitedEnumsAttributeHelper HELPER_Roles = new DelimitedEnumsAttributeHelper (RoleType.FACTORY_RoleType);
    private static final DefaultAttributeHelper<CompanyUser> HELPER_Phone = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_VerificationMailSendDate = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_VerificationKey = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_IsAccountVerified = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_IsEmailChanged = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_IsDisabled = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_Email = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_Password = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_ConfirmPassword = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private Date _ForgotPasswordMailSendDate;
    private String _ForgotPasswordKey;
    private RoleType _Role;
    private Set<RoleType> _Roles;
    private String _Phone;
    private Date _VerificationMailSendDate;
    private String _VerificationKey;
    private Boolean _IsAccountVerified;
    private Boolean _IsEmailChanged;
    private Boolean _IsDisabled;
    private String _Email;
    private String _Password;
    private String _ConfirmPassword;
    

    // Private attributes corresponding to single references
    private SingleAssociation<CompanyUser, Company> _Company;
    private SingleAssociation<CompanyUser, HiringTeam> _DefaultHiringTeam;
    

    // Private attributes corresponding to multiple references
    private MultipleAssociation<CompanyUser, CompanyUserHiringTeamLink> _HiringTeams;
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_Email_Validators;
    private static final AttributeValidator[] FIELD_Password_Validators;
    private static final AttributeValidator[] FIELD_ConfirmPassword_Validators;
    private static final AttributeValidator[] FIELD_ForgotPasswordMailSendDate_Validators;
    private static final AttributeValidator[] FIELD_ForgotPasswordKey_Validators;
    private static final AttributeValidator[] FIELD_Role_Validators;
    private static final AttributeValidator[] FIELD_Roles_Validators;
    private static final AttributeValidator[] FIELD_Phone_Validators;
    private static final AttributeValidator[] FIELD_VerificationMailSendDate_Validators;
    private static final AttributeValidator[] FIELD_VerificationKey_Validators;
    private static final AttributeValidator[] FIELD_IsAccountVerified_Validators;
    private static final AttributeValidator[] FIELD_IsEmailChanged_Validators;
    private static final AttributeValidator[] FIELD_IsDisabled_Validators;
    

    // Arrays of behaviour decorators
    private static final CompanyUserBehaviourDecorator[] CompanyUser_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_HiringTeams = CompanyUserHiringTeamLink.BACKREF_CompanyUser;
            String tmp_Company = Company.BACKREF_Users;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_HiringTeams();
            setupAssocMetaData_Company();
            setupAssocMetaData_DefaultHiringTeam();
            FIELD_Email_Validators = (AttributeValidator[])setupAttribMetaData_Email(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Password_Validators = (AttributeValidator[])setupAttribMetaData_Password(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ConfirmPassword_Validators = (AttributeValidator[])setupAttribMetaData_ConfirmPassword(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ForgotPasswordMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ForgotPasswordKey_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordKey(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Role_Validators = (AttributeValidator[])setupAttribMetaData_Role(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Roles_Validators = (AttributeValidator[])setupAttribMetaData_Roles(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Phone_Validators = (AttributeValidator[])setupAttribMetaData_Phone(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_VerificationMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_VerificationMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_VerificationKey_Validators = (AttributeValidator[])setupAttribMetaData_VerificationKey(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IsAccountVerified_Validators = (AttributeValidator[])setupAttribMetaData_IsAccountVerified(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IsEmailChanged_Validators = (AttributeValidator[])setupAttribMetaData_IsEmailChanged(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IsDisabled_Validators = (AttributeValidator[])setupAttribMetaData_IsDisabled(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_CompanyUser.initialiseReference ();
            DUMMY_CompanyUser.initialiseReference ();
            CompanyUser_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(CompanyUser.class).toArray(new CompanyUserBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

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

        metaInfo.put ("backreferenceName", "CompanyUser");
        metaInfo.put ("name", "HiringTeams");
        metaInfo.put ("type", "CompanyUserHiringTeamLink");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.HiringTeams:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (MULTIPLEREFERENCE_HiringTeams, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_Company()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "Users");
        metaInfo.put ("dbcol", "company_id");
        metaInfo.put ("name", "Company");
        metaInfo.put ("type", "Company");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.Company:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (SINGLEREFERENCE_Company, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // Meta Info setup
    private static void setupAssocMetaData_DefaultHiringTeam()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "default_hiring_team_id");
        metaInfo.put ("name", "DefaultHiringTeam");
        metaInfo.put ("type", "HiringTeam");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.DefaultHiringTeam:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (SINGLEREFERENCE_DefaultHiringTeam, 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 CompanyUser.Email:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_Email, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("name", "Password");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.Password:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_Password, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("name", "ConfirmPassword");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.ConfirmPassword:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_ConfirmPassword, Collections.unmodifiableMap (metaInfo));

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

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

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

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

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

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

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "role_type");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "Role");
        metaInfo.put ("type", "RoleType");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.Role:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_Role, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "DelimitedEnumsAttributeHelper");
        metaInfo.put ("attribHelperInstance", "new DelimitedEnumsAttributeHelper (RoleType.FACTORY_RoleType)");
        metaInfo.put ("dbcol", "roles");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "Roles");
        metaInfo.put ("type", "Set<RoleType>");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.Roles:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_Roles, Collections.unmodifiableMap (metaInfo));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        metaInfo.put ("dbcol", "is_email_changed");
        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "IsEmailChanged");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.IsEmailChanged:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_IsEmailChanged, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "is_disabled");
        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "IsDisabled");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.IsDisabled:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (FIELD_IsDisabled, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.initialise (_ForgotPasswordMailSendDate));
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.initialise (_ForgotPasswordKey));
        _Role = (RoleType)(HELPER_Role.initialise (_Role));
        _Roles = (Set<RoleType>)(HELPER_Roles.initialise (_Roles));
        _Phone = (String)(HELPER_Phone.initialise (_Phone));
        _VerificationMailSendDate = (Date)(HELPER_VerificationMailSendDate.initialise (_VerificationMailSendDate));
        _VerificationKey = (String)(HELPER_VerificationKey.initialise (_VerificationKey));
        _IsAccountVerified = (Boolean)(Boolean.FALSE);
        _IsEmailChanged = (Boolean)(Boolean.FALSE);
        _IsDisabled = (Boolean)(Boolean.FALSE);
        _Email = (String)(HELPER_Email.initialise (_Email));
        _Password = (String)(HELPER_Password.initialise (_Password));
        _ConfirmPassword = (String)(HELPER_ConfirmPassword.initialise (_ConfirmPassword));
    }


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

        _Company = new SingleAssociation<CompanyUser, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Users, Company.REFERENCE_Company, "oneit_sec_user_extension");
        _DefaultHiringTeam = new SingleAssociation<CompanyUser, HiringTeam> (this, SINGLEREFERENCE_DefaultHiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "oneit_sec_user_extension");
        _HiringTeams = new MultipleAssociation<CompanyUser, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_HiringTeams, CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _Company = new SingleAssociation<CompanyUser, Company> (this, SINGLEREFERENCE_Company, Company.MULTIPLEREFERENCE_Users, Company.REFERENCE_Company, "oneit_sec_user_extension");
        _DefaultHiringTeam = new SingleAssociation<CompanyUser, HiringTeam> (this, SINGLEREFERENCE_DefaultHiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "oneit_sec_user_extension");
        _HiringTeams = new MultipleAssociation<CompanyUser, CompanyUserHiringTeamLink> (this, MULTIPLEREFERENCE_HiringTeams, CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser, CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink);
        
        
        return this;
    }

    

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getForgotPasswordMailSendDate ((CompanyUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

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

            

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

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

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

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

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getForgotPasswordKey ((CompanyUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

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

            

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

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

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

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

    /**
     * Get the attribute Role
     */
    public RoleType getRole ()
    {
        assertValid();
        RoleType valToReturn = _Role;

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getRole ((CompanyUser)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 preRoleChange (RoleType newRole) 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 postRoleChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Role.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setRole (RoleType newRole) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Role.compare (_Role, newRole);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newRole = bhd.setRole ((CompanyUser)this, newRole);
                oldAndNewIdentical = HELPER_Role.compare (_Role, newRole);
            }

            

            if (FIELD_Role_Validators.length > 0)
            {
                Object newRoleObj = HELPER_Role.toObject (newRole);

                if (newRoleObj != null)
                {
                    int     loopMax = FIELD_Role_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_Role);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Role () != FieldWriteability.FALSE, "Field  Role is not writeable");
            preRoleChange (newRole);
            markFieldChange (FIELD_Role);
            _Role = newRole;            
            postFieldChange (FIELD_Role);
            postRoleChange ();
        }
    }

    /**
     * Get the attribute Roles
     */
    public Set<RoleType> getRoles ()
    {
        assertValid();
        Set<RoleType> valToReturn = _Roles;

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getRoles ((CompanyUser)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 preRolesChange (Set<RoleType> newRoles) 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 postRolesChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Roles.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setRoles (Set<RoleType> newRoles) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Roles.compare (_Roles, newRoles);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newRoles = bhd.setRoles ((CompanyUser)this, newRoles);
                oldAndNewIdentical = HELPER_Roles.compare (_Roles, newRoles);
            }

            

            if (FIELD_Roles_Validators.length > 0)
            {
                Object newRolesObj = HELPER_Roles.toObject (newRoles);

                if (newRolesObj != null)
                {
                    int     loopMax = FIELD_Roles_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_Roles);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Roles () != FieldWriteability.FALSE, "Field  Roles is not writeable");
            preRolesChange (newRoles);
            markFieldChange (FIELD_Roles);
            _Roles = newRoles;            
            postFieldChange (FIELD_Roles);
            postRolesChange ();
        }
    }

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getPhone ((CompanyUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

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

            

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

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

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

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

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getVerificationMailSendDate ((CompanyUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

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

            

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

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

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

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

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getVerificationKey ((CompanyUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

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

            

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

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

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

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

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getIsAccountVerified ((CompanyUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

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

            

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

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

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

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

    /**
     * Get the attribute IsEmailChanged
     */
    public Boolean getIsEmailChanged ()
    {
        assertValid();
        Boolean valToReturn = _IsEmailChanged;

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getIsEmailChanged ((CompanyUser)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 preIsEmailChangedChange (Boolean newIsEmailChanged) 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 postIsEmailChangedChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute IsEmailChanged.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIsEmailChanged (Boolean newIsEmailChanged) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_IsEmailChanged.compare (_IsEmailChanged, newIsEmailChanged);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newIsEmailChanged = bhd.setIsEmailChanged ((CompanyUser)this, newIsEmailChanged);
                oldAndNewIdentical = HELPER_IsEmailChanged.compare (_IsEmailChanged, newIsEmailChanged);
            }

            

            if (FIELD_IsEmailChanged_Validators.length > 0)
            {
                Object newIsEmailChangedObj = HELPER_IsEmailChanged.toObject (newIsEmailChanged);

                if (newIsEmailChangedObj != null)
                {
                    int     loopMax = FIELD_IsEmailChanged_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_IsEmailChanged);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_IsEmailChanged () != FieldWriteability.FALSE, "Field  IsEmailChanged is not writeable");
            preIsEmailChangedChange (newIsEmailChanged);
            markFieldChange (FIELD_IsEmailChanged);
            _IsEmailChanged = newIsEmailChanged;            
            postFieldChange (FIELD_IsEmailChanged);
            postIsEmailChangedChange ();
        }
    }

    /**
     * Get the attribute IsDisabled
     */
    public Boolean getIsDisabled ()
    {
        assertValid();
        Boolean valToReturn = _IsDisabled;

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getIsDisabled ((CompanyUser)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 preIsDisabledChange (Boolean newIsDisabled) 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 postIsDisabledChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute IsDisabled.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIsDisabled (Boolean newIsDisabled) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_IsDisabled.compare (_IsDisabled, newIsDisabled);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newIsDisabled = bhd.setIsDisabled ((CompanyUser)this, newIsDisabled);
                oldAndNewIdentical = HELPER_IsDisabled.compare (_IsDisabled, newIsDisabled);
            }

            

            if (FIELD_IsDisabled_Validators.length > 0)
            {
                Object newIsDisabledObj = HELPER_IsDisabled.toObject (newIsDisabled);

                if (newIsDisabledObj != null)
                {
                    int     loopMax = FIELD_IsDisabled_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_IsDisabled);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_IsDisabled () != FieldWriteability.FALSE, "Field  IsDisabled is not writeable");
            preIsDisabledChange (newIsDisabled);
            markFieldChange (FIELD_IsDisabled);
            _IsDisabled = newIsDisabled;            
            postFieldChange (FIELD_IsDisabled);
            postIsDisabledChange ();
        }
    }

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

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getEmail ((CompanyUser)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 (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newEmail = bhd.setEmail ((CompanyUser)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_CompanyUser.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 ();
        }
    }

    /**
     * Get the attribute Password
     */
    public String getPassword ()
    {
        assertValid();
        String valToReturn = _Password;

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getPassword ((CompanyUser)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 prePasswordChange (String newPassword) 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 postPasswordChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Password.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setPassword (String newPassword) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Password.compare (_Password, newPassword);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newPassword = bhd.setPassword ((CompanyUser)this, newPassword);
                oldAndNewIdentical = HELPER_Password.compare (_Password, newPassword);
            }

            

            if (FIELD_Password_Validators.length > 0)
            {
                Object newPasswordObj = HELPER_Password.toObject (newPassword);

                if (newPasswordObj != null)
                {
                    int     loopMax = FIELD_Password_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_Password);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Password () != FieldWriteability.FALSE, "Field  Password is not writeable");
            prePasswordChange (newPassword);
            markFieldChange (FIELD_Password);
            _Password = newPassword;            
            postFieldChange (FIELD_Password);
            postPasswordChange ();
        }
    }

    /**
     * Get the attribute ConfirmPassword
     */
    public String getConfirmPassword ()
    {
        assertValid();
        String valToReturn = _ConfirmPassword;

            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                valToReturn = bhd.getConfirmPassword ((CompanyUser)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 preConfirmPasswordChange (String newConfirmPassword) 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 postConfirmPasswordChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ConfirmPassword.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setConfirmPassword (String newConfirmPassword) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ConfirmPassword.compare (_ConfirmPassword, newConfirmPassword);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newConfirmPassword = bhd.setConfirmPassword ((CompanyUser)this, newConfirmPassword);
                oldAndNewIdentical = HELPER_ConfirmPassword.compare (_ConfirmPassword, newConfirmPassword);
            }

            

            if (FIELD_ConfirmPassword_Validators.length > 0)
            {
                Object newConfirmPasswordObj = HELPER_ConfirmPassword.toObject (newConfirmPassword);

                if (newConfirmPasswordObj != null)
                {
                    int     loopMax = FIELD_ConfirmPassword_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_CompanyUser.get (FIELD_ConfirmPassword);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ConfirmPassword () != FieldWriteability.FALSE, "Field  ConfirmPassword is not writeable");
            preConfirmPasswordChange (newConfirmPassword);
            markFieldChange (FIELD_ConfirmPassword);
            _ConfirmPassword = newConfirmPassword;            
            postFieldChange (FIELD_ConfirmPassword);
            postConfirmPasswordChange ();
        }
    }



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

        
        result.add("Company");
        
        result.add("DefaultHiringTeam");
        

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_Company))
        {
            return _Company.getReferencedType ();
        }else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            return _DefaultHiringTeam.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_Company))
        {
            return Company.MULTIPLEREFERENCE_Users ;
        }else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            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_Company))
        {
            return getCompany ();
        }else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            return getDefaultHiringTeam ();
        }
        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_Company))
        {
            return getCompany (getType);
        }else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            return getDefaultHiringTeam (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_Company))
        {
            return getCompanyID ();
        }else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            return getDefaultHiringTeamID ();
        }
        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_Company))
        {
            setCompany ((Company)(newValue));
        }else if (assocName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            setDefaultHiringTeam ((HiringTeam)(newValue));
        }
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getCompanyID ()
    {
        assertValid();
        
        if (_Company == null)
        {
            return null;
        }
        else
        {
            return _Company.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 preCompanyChange (Company newCompany) 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 postCompanyChange () throws FieldException
    {
    }



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

        if (_Company.wouldReferencedChange (newCompany))
        {
            assertValid();
            Debug.assertion (getWriteability_Company () != FieldWriteability.FALSE, "Assoc Company is not writeable");
            preCompanyChange (newCompany);
            Company oldCompany = getCompany ();

                    if (oldCompany != null)
                    {
                        // This is to stop validation from triggering when we are removed
                        _Company.set (null);
                        oldCompany.removeFromUsers ((CompanyUser)(this));
                    }

                    _Company.set (newCompany);

                    if (newCompany != null)
                    {
                        newCompany.addToUsers ((CompanyUser)(this));
                    }
                
            postCompanyChange ();
        }
    }

    /**
     * Get the reference DefaultHiringTeam
     */
    public HiringTeam getDefaultHiringTeam () throws StorageException
    {
        assertValid();
        
        try
        {
            return (HiringTeam)(_DefaultHiringTeam.get ());
        }
        catch (ClassCastException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CompanyUser:", this.getObjectID (), ", was trying to get HiringTeam:",  getDefaultHiringTeamID ());
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _DefaultHiringTeam.get ().getClass ());
            throw e;
        }
    }


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getDefaultHiringTeamID ()
    {
        assertValid();
        
        if (_DefaultHiringTeam == null)
        {
            return null;
        }
        else
        {
            return _DefaultHiringTeam.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 preDefaultHiringTeamChange (HiringTeam newDefaultHiringTeam) 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 postDefaultHiringTeamChange () throws FieldException
    {
    }



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

        if (_DefaultHiringTeam.wouldReferencedChange (newDefaultHiringTeam))
        {
            assertValid();
            Debug.assertion (getWriteability_DefaultHiringTeam () != FieldWriteability.FALSE, "Assoc DefaultHiringTeam is not writeable");
            preDefaultHiringTeamChange (newDefaultHiringTeam);
            
                    _DefaultHiringTeam.set (newDefaultHiringTeam);
                
            postDefaultHiringTeamChange ();
        }
    }

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

        
        result.add("HiringTeams");
        

        return result;
    }


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

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {
        
        if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
        {
            return CompanyUserHiringTeamLink.SINGLEREFERENCE_CompanyUser ;
        }
        

        return super.getMultiAssocBackReference(attribName);
    }


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

        return super.getMultiAssocCount(attribName);
    }


    /**
     * Get the assoc at a particular index
     */
    public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
    {
        
        if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
        {
            return this.getHiringTeamsAt(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_HiringTeams.equals(attribName))
        {
            addToHiringTeams((CompanyUserHiringTeamLink)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_HiringTeams.equals(attribName))
        {
            removeFromHiringTeams((CompanyUserHiringTeamLink)oldElement);

            return;
        }
        

        super.removeFromMultiAssoc(attribName, oldElement);
    }


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

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {
        
        if (MULTIPLEREFERENCE_HiringTeams.equals(attribName))
        {
            return _HiringTeams.isLoaded ();
        }
        

        return super.__isMultiAssocLoaded(attribName);
    }

    

    public FieldWriteability getWriteability_HiringTeams ()
    {
        return getFieldWritabilityUtil (FieldWriteability.TRUE);
    }
    
    
    public int getHiringTeamsCount () throws StorageException
    {
        assertValid();
        return _HiringTeams.getReferencedObjectsCount ();
    }


    public void addToHiringTeams (CompanyUserHiringTeamLink newElement) throws StorageException
    {
        if (_HiringTeams.wouldAddChange (newElement))
        {
            assertValid();
            Debug.assertion (getWriteability_HiringTeams () != FieldWriteability.FALSE, "MultiAssoc HiringTeams is not writeable (add)");
            _HiringTeams.appendElement (newElement);

            try
            {
                if (newElement.getCompanyUser () != this)
                {
                    newElement.setCompanyUser ((CompanyUser)(this));
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public void removeFromHiringTeams (CompanyUserHiringTeamLink elementToRemove) throws StorageException
    {
        if (_HiringTeams.wouldRemoveChange (elementToRemove))
        {
            assertValid();
            Debug.assertion (getWriteability_HiringTeams () != FieldWriteability.FALSE, "MultiAssoc HiringTeams is not writeable (remove)");
            _HiringTeams.removeElement (elementToRemove);
            try
            {
                if (elementToRemove.getCompanyUser () != null)
                {
                    elementToRemove.setCompanyUser (null);
                }
            }
            catch (Exception e)
            {
                throw NestedException.wrap(e);
            }
        }
    }


    public CompanyUserHiringTeamLink getHiringTeamsAt (int index) throws StorageException
    {
        return (CompanyUserHiringTeamLink)(_HiringTeams.getElementAt (index));
    }


    public SortedSet<CompanyUserHiringTeamLink> getHiringTeamsSet () throws StorageException
    {
        return _HiringTeams.getSet ();
    }



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

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null Users from ", getObjectID (), " to ", referenced.getObjectID ());
                    _Company.set (null);
                    referenced.removeFromUsers ((CompanyUser)this);
                }
            }
        
            for(CompanyUserHiringTeamLink referenced : CollectionUtils.reverse(getHiringTeamsSet()))
            { 
                LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null CompanyUser from ", getObjectID (), " to ", referenced.getObjectID ());
                referenced.setCompanyUser(null);
            }

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

        super.onDelete ();
    }


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


    public CompanyUser referenceInstance ()
    {
        return REFERENCE_CompanyUser;
    }


    public CompanyUser getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getCompanyUserByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_CompanyUser;
    }


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





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

        super.getPersistentSets (allSets);

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

        oneit_sec_user_extensionPSet.setAttrib (FIELD_ObjectID, myID);
        oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject (_ForgotPasswordMailSendDate)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject (_ForgotPasswordKey)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_Role, HELPER_Role.toObject (_Role)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_Roles, HELPER_Roles.toObject (_Roles)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_Phone, HELPER_Phone.toObject (_Phone)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.toObject (_VerificationMailSendDate)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_VerificationKey, HELPER_VerificationKey.toObject (_VerificationKey)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject (_IsAccountVerified)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject (_IsEmailChanged)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_IsDisabled, HELPER_IsDisabled.toObject (_IsDisabled)); //
        _Company.getPersistentSets (allSets);
        _DefaultHiringTeam.getPersistentSets (allSets);
        
    }


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

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

        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordMailSendDate))); //
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordKey))); //
        _Role = (RoleType)(HELPER_Role.fromObject (_Role, oneit_sec_user_extensionPSet.getAttrib (FIELD_Role))); //
        _Roles = (Set<RoleType>)(HELPER_Roles.fromObject (_Roles, oneit_sec_user_extensionPSet.getAttrib (FIELD_Roles))); //
        _Phone = (String)(HELPER_Phone.fromObject (_Phone, oneit_sec_user_extensionPSet.getAttrib (FIELD_Phone))); //
        _VerificationMailSendDate = (Date)(HELPER_VerificationMailSendDate.fromObject (_VerificationMailSendDate, oneit_sec_user_extensionPSet.getAttrib (FIELD_VerificationMailSendDate))); //
        _VerificationKey = (String)(HELPER_VerificationKey.fromObject (_VerificationKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_VerificationKey))); //
        _IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsAccountVerified))); //
        _IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsEmailChanged))); //
        _IsDisabled = (Boolean)(HELPER_IsDisabled.fromObject (_IsDisabled, oneit_sec_user_extensionPSet.getAttrib (FIELD_IsDisabled))); //
        _Company.setFromPersistentSets (objectID, allSets);
        _DefaultHiringTeam.setFromPersistentSets (objectID, allSets);
        
    }





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

        if (other instanceof CompanyUser)
        {
            CompanyUser otherCompanyUser = (CompanyUser)other;
            
            try
            {
                setForgotPasswordMailSendDate (otherCompanyUser.getForgotPasswordMailSendDate ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setForgotPasswordKey (otherCompanyUser.getForgotPasswordKey ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setRole (otherCompanyUser.getRole ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setRoles (otherCompanyUser.getRoles ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setPhone (otherCompanyUser.getPhone ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setVerificationMailSendDate (otherCompanyUser.getVerificationMailSendDate ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setVerificationKey (otherCompanyUser.getVerificationKey ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setIsAccountVerified (otherCompanyUser.getIsAccountVerified ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setIsEmailChanged (otherCompanyUser.getIsEmailChanged ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setIsDisabled (otherCompanyUser.getIsDisabled ());
            }
            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 BaseCompanyUser)
        {
            BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source);

            _ForgotPasswordMailSendDate = sourceCompanyUser._ForgotPasswordMailSendDate;
            _ForgotPasswordKey = sourceCompanyUser._ForgotPasswordKey;
            _Role = sourceCompanyUser._Role;
            _Roles = sourceCompanyUser._Roles;
            _Phone = sourceCompanyUser._Phone;
            _VerificationMailSendDate = sourceCompanyUser._VerificationMailSendDate;
            _VerificationKey = sourceCompanyUser._VerificationKey;
            _IsAccountVerified = sourceCompanyUser._IsAccountVerified;
            _IsEmailChanged = sourceCompanyUser._IsEmailChanged;
            _IsDisabled = sourceCompanyUser._IsDisabled;
            _Email = sourceCompanyUser._Email;
            _Password = sourceCompanyUser._Password;
            _ConfirmPassword = sourceCompanyUser._ConfirmPassword;
            
        }
    }


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

            _Company.copyFrom (sourceCompanyUser._Company, linkToGhosts);
            _DefaultHiringTeam.copyFrom (sourceCompanyUser._DefaultHiringTeam, 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 BaseCompanyUser)
        {
            BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source);

            _HiringTeams.copyFrom (sourceCompanyUser._HiringTeams, linkToGhosts);
            
        }
    }


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

        
    }


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

        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.readExternal (_ForgotPasswordMailSendDate, vals.get(FIELD_ForgotPasswordMailSendDate))); //
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.readExternal (_ForgotPasswordKey, vals.get(FIELD_ForgotPasswordKey))); //
        _Role = (RoleType)(HELPER_Role.readExternal (_Role, vals.get(FIELD_Role))); //
        _Roles = (Set<RoleType>)(HELPER_Roles.readExternal (_Roles, vals.get(FIELD_Roles))); //
        _Phone = (String)(HELPER_Phone.readExternal (_Phone, vals.get(FIELD_Phone))); //
        _VerificationMailSendDate = (Date)(HELPER_VerificationMailSendDate.readExternal (_VerificationMailSendDate, vals.get(FIELD_VerificationMailSendDate))); //
        _VerificationKey = (String)(HELPER_VerificationKey.readExternal (_VerificationKey, vals.get(FIELD_VerificationKey))); //
        _IsAccountVerified = (Boolean)(HELPER_IsAccountVerified.readExternal (_IsAccountVerified, vals.get(FIELD_IsAccountVerified))); //
        _IsEmailChanged = (Boolean)(HELPER_IsEmailChanged.readExternal (_IsEmailChanged, vals.get(FIELD_IsEmailChanged))); //
        _IsDisabled = (Boolean)(HELPER_IsDisabled.readExternal (_IsDisabled, vals.get(FIELD_IsDisabled))); //
        _Email = (String)(HELPER_Email.readExternal (_Email, vals.get(FIELD_Email))); //
        _Password = (String)(HELPER_Password.readExternal (_Password, vals.get(FIELD_Password))); //
        _ConfirmPassword = (String)(HELPER_ConfirmPassword.readExternal (_ConfirmPassword, vals.get(FIELD_ConfirmPassword))); //
        _Company.readExternalData(vals.get(SINGLEREFERENCE_Company));
        _DefaultHiringTeam.readExternalData(vals.get(SINGLEREFERENCE_DefaultHiringTeam));
        _HiringTeams.readExternalData(vals.get(MULTIPLEREFERENCE_HiringTeams));
        
    }


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

        vals.put (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.writeExternal (_ForgotPasswordMailSendDate));
        vals.put (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.writeExternal (_ForgotPasswordKey));
        vals.put (FIELD_Role, HELPER_Role.writeExternal (_Role));
        vals.put (FIELD_Roles, HELPER_Roles.writeExternal (_Roles));
        vals.put (FIELD_Phone, HELPER_Phone.writeExternal (_Phone));
        vals.put (FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.writeExternal (_VerificationMailSendDate));
        vals.put (FIELD_VerificationKey, HELPER_VerificationKey.writeExternal (_VerificationKey));
        vals.put (FIELD_IsAccountVerified, HELPER_IsAccountVerified.writeExternal (_IsAccountVerified));
        vals.put (FIELD_IsEmailChanged, HELPER_IsEmailChanged.writeExternal (_IsEmailChanged));
        vals.put (FIELD_IsDisabled, HELPER_IsDisabled.writeExternal (_IsDisabled));
        vals.put (FIELD_Email, HELPER_Email.writeExternal (_Email));
        vals.put (FIELD_Password, HELPER_Password.writeExternal (_Password));
        vals.put (FIELD_ConfirmPassword, HELPER_ConfirmPassword.writeExternal (_ConfirmPassword));
        vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData());
        vals.put (SINGLEREFERENCE_DefaultHiringTeam, _DefaultHiringTeam.writeExternalData());
        vals.put (MULTIPLEREFERENCE_HiringTeams, _HiringTeams.writeExternalData());
        
    }


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

        if (other instanceof BaseCompanyUser)
        {
            BaseCompanyUser otherCompanyUser = (BaseCompanyUser)(other);

            
            if (!HELPER_ForgotPasswordMailSendDate.compare(this._ForgotPasswordMailSendDate, otherCompanyUser._ForgotPasswordMailSendDate))
            {
                listener.notifyFieldChange(this, other, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(this._ForgotPasswordMailSendDate), HELPER_ForgotPasswordMailSendDate.toObject(otherCompanyUser._ForgotPasswordMailSendDate));
            }
            if (!HELPER_ForgotPasswordKey.compare(this._ForgotPasswordKey, otherCompanyUser._ForgotPasswordKey))
            {
                listener.notifyFieldChange(this, other, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(this._ForgotPasswordKey), HELPER_ForgotPasswordKey.toObject(otherCompanyUser._ForgotPasswordKey));
            }
            if (!HELPER_Role.compare(this._Role, otherCompanyUser._Role))
            {
                listener.notifyFieldChange(this, other, FIELD_Role, HELPER_Role.toObject(this._Role), HELPER_Role.toObject(otherCompanyUser._Role));
            }
            if (!HELPER_Roles.compare(this._Roles, otherCompanyUser._Roles))
            {
                listener.notifyFieldChange(this, other, FIELD_Roles, HELPER_Roles.toObject(this._Roles), HELPER_Roles.toObject(otherCompanyUser._Roles));
            }
            if (!HELPER_Phone.compare(this._Phone, otherCompanyUser._Phone))
            {
                listener.notifyFieldChange(this, other, FIELD_Phone, HELPER_Phone.toObject(this._Phone), HELPER_Phone.toObject(otherCompanyUser._Phone));
            }
            if (!HELPER_VerificationMailSendDate.compare(this._VerificationMailSendDate, otherCompanyUser._VerificationMailSendDate))
            {
                listener.notifyFieldChange(this, other, FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.toObject(this._VerificationMailSendDate), HELPER_VerificationMailSendDate.toObject(otherCompanyUser._VerificationMailSendDate));
            }
            if (!HELPER_VerificationKey.compare(this._VerificationKey, otherCompanyUser._VerificationKey))
            {
                listener.notifyFieldChange(this, other, FIELD_VerificationKey, HELPER_VerificationKey.toObject(this._VerificationKey), HELPER_VerificationKey.toObject(otherCompanyUser._VerificationKey));
            }
            if (!HELPER_IsAccountVerified.compare(this._IsAccountVerified, otherCompanyUser._IsAccountVerified))
            {
                listener.notifyFieldChange(this, other, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(this._IsAccountVerified), HELPER_IsAccountVerified.toObject(otherCompanyUser._IsAccountVerified));
            }
            if (!HELPER_IsEmailChanged.compare(this._IsEmailChanged, otherCompanyUser._IsEmailChanged))
            {
                listener.notifyFieldChange(this, other, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(this._IsEmailChanged), HELPER_IsEmailChanged.toObject(otherCompanyUser._IsEmailChanged));
            }
            if (!HELPER_IsDisabled.compare(this._IsDisabled, otherCompanyUser._IsDisabled))
            {
                listener.notifyFieldChange(this, other, FIELD_IsDisabled, HELPER_IsDisabled.toObject(this._IsDisabled), HELPER_IsDisabled.toObject(otherCompanyUser._IsDisabled));
            }

            // Compare single assocs
            _Company.compare (otherCompanyUser._Company, listener);
            _DefaultHiringTeam.compare (otherCompanyUser._DefaultHiringTeam, listener);
            

            // Compare multiple assocs
            _HiringTeams.compare (otherCompanyUser._HiringTeams, listener);
            
        }
    }


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

        visitor.visitField(this, FIELD_Email, HELPER_Email.toObject(getEmail()));
        visitor.visitField(this, FIELD_Password, HELPER_Password.toObject(getPassword()));
        visitor.visitField(this, FIELD_ConfirmPassword, HELPER_ConfirmPassword.toObject(getConfirmPassword()));
        
    }


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

        visitor.visitField(this, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(getForgotPasswordMailSendDate()));
        visitor.visitField(this, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(getForgotPasswordKey()));
        visitor.visitField(this, FIELD_Role, HELPER_Role.toObject(getRole()));
        visitor.visitField(this, FIELD_Roles, HELPER_Roles.toObject(getRoles()));
        visitor.visitField(this, FIELD_Phone, HELPER_Phone.toObject(getPhone()));
        visitor.visitField(this, FIELD_VerificationMailSendDate, HELPER_VerificationMailSendDate.toObject(getVerificationMailSendDate()));
        visitor.visitField(this, FIELD_VerificationKey, HELPER_VerificationKey.toObject(getVerificationKey()));
        visitor.visitField(this, FIELD_IsAccountVerified, HELPER_IsAccountVerified.toObject(getIsAccountVerified()));
        visitor.visitField(this, FIELD_IsEmailChanged, HELPER_IsEmailChanged.toObject(getIsEmailChanged()));
        visitor.visitField(this, FIELD_IsDisabled, HELPER_IsDisabled.toObject(getIsDisabled()));
        visitor.visitAssociation (_Company);
        visitor.visitAssociation (_DefaultHiringTeam);
        visitor.visitAssociation (_HiringTeams);
        
    }


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

        if (scope.includes (_Company))
        {
            visitor.visit (_Company);
        }
        if (scope.includes (_DefaultHiringTeam))
        {
            visitor.visit (_DefaultHiringTeam);
        }
        if (scope.includes (_HiringTeams))
        {
            visitor.visit (_HiringTeams);
        }
        
    }


    public static CompanyUser createCompanyUser (ObjectTransaction transaction) throws StorageException
    {
        CompanyUser     result = new CompanyUser ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static CompanyUser getCompanyUserByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (CompanyUser)(transaction.getObjectByID (REFERENCE_CompanyUser, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return filter.matches (getForgotPasswordMailSendDate ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return filter.matches (getForgotPasswordKey ());
        }
        else if (attribName.equals (FIELD_Role))
        {
            return filter.matches (getRole ());
        }
        else if (attribName.equals (FIELD_Roles))
        {
            return filter.matches (getRoles ());
        }
        else if (attribName.equals (FIELD_Phone))
        {
            return filter.matches (getPhone ());
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            return filter.matches (getVerificationMailSendDate ());
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            return filter.matches (getVerificationKey ());
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            return filter.matches (getIsAccountVerified ());
        }
        else if (attribName.equals (FIELD_IsEmailChanged))
        {
            return filter.matches (getIsEmailChanged ());
        }
        else if (attribName.equals (FIELD_IsDisabled))
        {
            return filter.matches (getIsDisabled ());
        }
        else if (attribName.equals (SINGLEREFERENCE_Company))
        {
            return filter.matches (getCompany ());
        }
        else if (attribName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            return filter.matches (getDefaultHiringTeam ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
            public SearchAll andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchAll andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchAll andRole (QueryFilter<RoleType> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.role_type", "Role");
                return this;
            }
            
            public SearchAll andRoles (QueryFilter<Set<RoleType>> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.roles", "Roles");
                return this;
            }
            
            public SearchAll andPhone (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.phone", "Phone");
                return this;
            }
            
            public SearchAll andVerificationMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_mail_send_date", "VerificationMailSendDate");
                return this;
            }
            
            public SearchAll andVerificationKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_key", "VerificationKey");
                return this;
            }
            
            public SearchAll andIsAccountVerified (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_account_verified", "IsAccountVerified");
                return this;
            }
            
            public SearchAll andIsEmailChanged (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_email_changed", "IsEmailChanged");
                return this;
            }
            
            public SearchAll andIsDisabled (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_disabled", "IsDisabled");
                return this;
            }
            
            public SearchAll andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
            public SearchAll andCompany (QueryFilter<Company> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.company_id", "Company");
                return this;
            }
            
            public SearchAll andDefaultHiringTeam (QueryFilter<HiringTeam> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.default_hiring_team_id", "DefaultHiringTeam");
                return this;
            }
            
                public CompanyUser[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_CompanyUser, SEARCH_All, criteria);
            Set<CompanyUser>   typedResults = new LinkedHashSet <CompanyUser> ();
            for (BaseBusinessClass bbcResult : results)
            {
                CompanyUser aResult = (CompanyUser)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CompanyUser[0]);
                            
        }
    }

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

    public static SearchAllCompanyUsers SearchByAllCompanyUsers () { return new SearchAllCompanyUsers (); }

    public static class SearchAllCompanyUsers extends SearchObject<CompanyUser>
    {
        
        public SearchAllCompanyUsers byReferenceExtension (SecUserExtension ReferenceExtension)
        {
            by ("ReferenceExtension", ReferenceExtension);
            return this;
        }
        
            public SearchAllCompanyUsers andObjectID (QueryFilter<Long> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.object_id", FIELD_ObjectID);
                return this;
            }

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

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

            
            public SearchAllCompanyUsers andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchAllCompanyUsers andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchAllCompanyUsers andRole (QueryFilter<RoleType> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.role_type", "Role");
                return this;
            }
            
            public SearchAllCompanyUsers andRoles (QueryFilter<Set<RoleType>> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.roles", "Roles");
                return this;
            }
            
            public SearchAllCompanyUsers andPhone (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.phone", "Phone");
                return this;
            }
            
            public SearchAllCompanyUsers andVerificationMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_mail_send_date", "VerificationMailSendDate");
                return this;
            }
            
            public SearchAllCompanyUsers andVerificationKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_key", "VerificationKey");
                return this;
            }
            
            public SearchAllCompanyUsers andIsAccountVerified (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_account_verified", "IsAccountVerified");
                return this;
            }
            
            public SearchAllCompanyUsers andIsEmailChanged (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_email_changed", "IsEmailChanged");
                return this;
            }
            
            public SearchAllCompanyUsers andIsDisabled (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_disabled", "IsDisabled");
                return this;
            }
            
            public SearchAllCompanyUsers andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
            public SearchAllCompanyUsers andCompany (QueryFilter<Company> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.company_id", "Company");
                return this;
            }
            
            public SearchAllCompanyUsers andDefaultHiringTeam (QueryFilter<HiringTeam> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.default_hiring_team_id", "DefaultHiringTeam");
                return this;
            }
            
                public CompanyUser[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_CompanyUser, SEARCH_AllCompanyUsers, criteria);
            Set<CompanyUser>   typedResults = new LinkedHashSet <CompanyUser> ();
            for (BaseBusinessClass bbcResult : results)
            {
                CompanyUser aResult = (CompanyUser)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new CompanyUser[0]);
                            
        }
    }

        
                public static CompanyUser[]
             searchAllCompanyUsers (ObjectTransaction transaction, SecUserExtension ReferenceExtension) throws StorageException
        {
            return SearchByAllCompanyUsers ()
            .byReferenceExtension  (ReferenceExtension)
            .search (transaction);
        }

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

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

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

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

            
            public SearchIdPin andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchIdPin andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchIdPin andRole (QueryFilter<RoleType> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.role_type", "Role");
                return this;
            }
            
            public SearchIdPin andRoles (QueryFilter<Set<RoleType>> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.roles", "Roles");
                return this;
            }
            
            public SearchIdPin andPhone (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.phone", "Phone");
                return this;
            }
            
            public SearchIdPin andVerificationMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_mail_send_date", "VerificationMailSendDate");
                return this;
            }
            
            public SearchIdPin andVerificationKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.verification_key", "VerificationKey");
                return this;
            }
            
            public SearchIdPin andIsAccountVerified (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_account_verified", "IsAccountVerified");
                return this;
            }
            
            public SearchIdPin andIsEmailChanged (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_email_changed", "IsEmailChanged");
                return this;
            }
            
            public SearchIdPin andIsDisabled (QueryFilter<Boolean> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.is_disabled", "IsDisabled");
                return this;
            }
            
            public SearchIdPin andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
            public SearchIdPin andCompany (QueryFilter<Company> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.company_id", "Company");
                return this;
            }
            
            public SearchIdPin andDefaultHiringTeam (QueryFilter<HiringTeam> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.default_hiring_team_id", "DefaultHiringTeam");
                return this;
            }
            
                public CompanyUser search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_CompanyUser, SEARCH_IdPin, criteria);
            Set<CompanyUser>   typedResults = new LinkedHashSet <CompanyUser> ();
            for (BaseBusinessClass bbcResult : results)
            {
                CompanyUser aResult = (CompanyUser)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return (CompanyUser)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "CompanyUser", "");
                            
        }
    }

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



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return HELPER_ForgotPasswordMailSendDate.toObject (getForgotPasswordMailSendDate ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return HELPER_ForgotPasswordKey.toObject (getForgotPasswordKey ());
        }
        else if (attribName.equals (FIELD_Role))
        {
            return HELPER_Role.toObject (getRole ());
        }
        else if (attribName.equals (FIELD_Roles))
        {
            return HELPER_Roles.toObject (getRoles ());
        }
        else if (attribName.equals (FIELD_Phone))
        {
            return HELPER_Phone.toObject (getPhone ());
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            return HELPER_VerificationMailSendDate.toObject (getVerificationMailSendDate ());
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            return HELPER_VerificationKey.toObject (getVerificationKey ());
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            return HELPER_IsAccountVerified.toObject (getIsAccountVerified ());
        }
        else if (attribName.equals (FIELD_IsEmailChanged))
        {
            return HELPER_IsEmailChanged.toObject (getIsEmailChanged ());
        }
        else if (attribName.equals (FIELD_IsDisabled))
        {
            return HELPER_IsDisabled.toObject (getIsDisabled ());
        }
        else if (attribName.equals (FIELD_Email))
        {
            return HELPER_Email.toObject (getEmail ());
        }
        else if (attribName.equals (FIELD_Password))
        {
            return HELPER_Password.toObject (getPassword ());
        }
        else if (attribName.equals (FIELD_ConfirmPassword))
        {
            return HELPER_ConfirmPassword.toObject (getConfirmPassword ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return HELPER_ForgotPasswordMailSendDate;
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return HELPER_ForgotPasswordKey;
        }
        else if (attribName.equals (FIELD_Role))
        {
            return HELPER_Role;
        }
        else if (attribName.equals (FIELD_Roles))
        {
            return HELPER_Roles;
        }
        else if (attribName.equals (FIELD_Phone))
        {
            return HELPER_Phone;
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            return HELPER_VerificationMailSendDate;
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            return HELPER_VerificationKey;
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            return HELPER_IsAccountVerified;
        }
        else if (attribName.equals (FIELD_IsEmailChanged))
        {
            return HELPER_IsEmailChanged;
        }
        else if (attribName.equals (FIELD_IsDisabled))
        {
            return HELPER_IsDisabled;
        }
        else if (attribName.equals (FIELD_Email))
        {
            return HELPER_Email;
        }
        else if (attribName.equals (FIELD_Password))
        {
            return HELPER_Password;
        }
        else if (attribName.equals (FIELD_ConfirmPassword))
        {
            return HELPER_ConfirmPassword;
        }
        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_ForgotPasswordMailSendDate))
        {
            setForgotPasswordMailSendDate ((Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, attribValue)));            
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            setForgotPasswordKey ((String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, attribValue)));            
        }
        else if (attribName.equals (FIELD_Role))
        {
            setRole ((RoleType)(HELPER_Role.fromObject (_Role, attribValue)));            
        }
        else if (attribName.equals (FIELD_Roles))
        {
            setRoles ((Set<RoleType>)(HELPER_Roles.fromObject (_Roles, attribValue)));            
        }
        else if (attribName.equals (FIELD_Phone))
        {
            setPhone ((String)(HELPER_Phone.fromObject (_Phone, attribValue)));            
        }
        else if (attribName.equals (FIELD_VerificationMailSendDate))
        {
            setVerificationMailSendDate ((Date)(HELPER_VerificationMailSendDate.fromObject (_VerificationMailSendDate, attribValue)));            
        }
        else if (attribName.equals (FIELD_VerificationKey))
        {
            setVerificationKey ((String)(HELPER_VerificationKey.fromObject (_VerificationKey, attribValue)));            
        }
        else if (attribName.equals (FIELD_IsAccountVerified))
        {
            setIsAccountVerified ((Boolean)(HELPER_IsAccountVerified.fromObject (_IsAccountVerified, attribValue)));            
        }
        else if (attribName.equals (FIELD_IsEmailChanged))
        {
            setIsEmailChanged ((Boolean)(HELPER_IsEmailChanged.fromObject (_IsEmailChanged, attribValue)));            
        }
        else if (attribName.equals (FIELD_IsDisabled))
        {
            setIsDisabled ((Boolean)(HELPER_IsDisabled.fromObject (_IsDisabled, attribValue)));            
        }
        else if (attribName.equals (FIELD_Email))
        {
            setEmail ((String)(HELPER_Email.fromObject (_Email, attribValue)));            
        }
        else if (attribName.equals (FIELD_Password))
        {
            setPassword ((String)(HELPER_Password.fromObject (_Password, attribValue)));            
        }
        else if (attribName.equals (FIELD_ConfirmPassword))
        {
            setConfirmPassword ((String)(HELPER_ConfirmPassword.fromObject (_ConfirmPassword, 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_ForgotPasswordMailSendDate))
        {
            return getWriteability_ForgotPasswordMailSendDate ();
        }
        else if (fieldName.equals (FIELD_ForgotPasswordKey))
        {
            return getWriteability_ForgotPasswordKey ();
        }
        else if (fieldName.equals (FIELD_Role))
        {
            return getWriteability_Role ();
        }
        else if (fieldName.equals (FIELD_Roles))
        {
            return getWriteability_Roles ();
        }
        else if (fieldName.equals (FIELD_Phone))
        {
            return getWriteability_Phone ();
        }
        else if (fieldName.equals (FIELD_VerificationMailSendDate))
        {
            return getWriteability_VerificationMailSendDate ();
        }
        else if (fieldName.equals (FIELD_VerificationKey))
        {
            return getWriteability_VerificationKey ();
        }
        else if (fieldName.equals (FIELD_IsAccountVerified))
        {
            return getWriteability_IsAccountVerified ();
        }
        else if (fieldName.equals (FIELD_IsEmailChanged))
        {
            return getWriteability_IsEmailChanged ();
        }
        else if (fieldName.equals (FIELD_IsDisabled))
        {
            return getWriteability_IsDisabled ();
        }
        else if (fieldName.equals (MULTIPLEREFERENCE_HiringTeams))
        {
            return getWriteability_HiringTeams ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_Company))
        {
            return getWriteability_Company ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_DefaultHiringTeam))
        {
            return getWriteability_DefaultHiringTeam ();
        }
        else if (fieldName.equals (FIELD_Email))
        {
            return getWriteability_Email ();
        }
        else if (fieldName.equals (FIELD_Password))
        {
            return getWriteability_Password ();
        }
        else if (fieldName.equals (FIELD_ConfirmPassword))
        {
            return getWriteability_ConfirmPassword ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ForgotPasswordMailSendDate);
            }
        
            if (getWriteability_ForgotPasswordKey () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ForgotPasswordKey);
            }
        
            if (getWriteability_Role () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Role);
            }
        
            if (getWriteability_Roles () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Roles);
            }
        
            if (getWriteability_Phone () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Phone);
            }
        
            if (getWriteability_VerificationMailSendDate () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_VerificationMailSendDate);
            }
        
            if (getWriteability_VerificationKey () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_VerificationKey);
            }
        
            if (getWriteability_IsAccountVerified () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IsAccountVerified);
            }
        
            if (getWriteability_IsEmailChanged () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IsEmailChanged);
            }
        
            if (getWriteability_IsDisabled () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_IsDisabled);
            }
        
            if (getWriteability_Email () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Email);
            }
        
            if (getWriteability_Password () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_Password);
            }
        
            if (getWriteability_ConfirmPassword () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ConfirmPassword);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_ForgotPasswordMailSendDate.getAttribObject (getClass (), _ForgotPasswordMailSendDate, false, FIELD_ForgotPasswordMailSendDate));
        result.add(HELPER_ForgotPasswordKey.getAttribObject (getClass (), _ForgotPasswordKey, false, FIELD_ForgotPasswordKey));
        result.add(HELPER_Role.getAttribObject (getClass (), _Role, false, FIELD_Role));
        result.add(HELPER_Roles.getAttribObject (getClass (), _Roles, false, FIELD_Roles));
        result.add(HELPER_Phone.getAttribObject (getClass (), _Phone, false, FIELD_Phone));
        result.add(HELPER_VerificationMailSendDate.getAttribObject (getClass (), _VerificationMailSendDate, false, FIELD_VerificationMailSendDate));
        result.add(HELPER_VerificationKey.getAttribObject (getClass (), _VerificationKey, false, FIELD_VerificationKey));
        result.add(HELPER_IsAccountVerified.getAttribObject (getClass (), _IsAccountVerified, false, FIELD_IsAccountVerified));
        result.add(HELPER_IsEmailChanged.getAttribObject (getClass (), _IsEmailChanged, false, FIELD_IsEmailChanged));
        result.add(HELPER_IsDisabled.getAttribObject (getClass (), _IsDisabled, false, FIELD_IsDisabled));
        result.add(HELPER_Email.getAttribObject (getClass (), _Email, false, FIELD_Email));
        result.add(HELPER_Password.getAttribObject (getClass (), _Password, false, FIELD_Password));
        result.add(HELPER_ConfirmPassword.getAttribObject (getClass (), _ConfirmPassword, false, FIELD_ConfirmPassword));

        return result;
    }


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


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

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

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

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

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

    /**
     * Get the attribute Role
     */
    public RoleType getRole (CompanyUser obj, RoleType original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Role.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public RoleType setRole (CompanyUser obj, RoleType newRole) throws FieldException
    {
        return newRole;
    }

    /**
     * Get the attribute Roles
     */
    public Set<RoleType> getRoles (CompanyUser obj, Set<RoleType> original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Roles.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Set<RoleType> setRoles (CompanyUser obj, Set<RoleType> newRoles) throws FieldException
    {
        return newRoles;
    }

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

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

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

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

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

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

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

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

    /**
     * Get the attribute IsEmailChanged
     */
    public Boolean getIsEmailChanged (CompanyUser obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IsEmailChanged.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setIsEmailChanged (CompanyUser obj, Boolean newIsEmailChanged) throws FieldException
    {
        return newIsEmailChanged;
    }

    /**
     * Get the attribute IsDisabled
     */
    public Boolean getIsDisabled (CompanyUser obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IsDisabled.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setIsDisabled (CompanyUser obj, Boolean newIsDisabled) throws FieldException
    {
        return newIsDisabled;
    }

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

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

    /**
     * Get the attribute Password
     */
    public String getPassword (CompanyUser obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Password.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setPassword (CompanyUser obj, String newPassword) throws FieldException
    {
        return newPassword;
    }

    /**
     * Get the attribute ConfirmPassword
     */
    public String getConfirmPassword (CompanyUser obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ConfirmPassword.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setConfirmPassword (CompanyUser obj, String newConfirmPassword) throws FieldException
    {
        return newConfirmPassword;
    }

    }

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

        public CompanyUserPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("HiringTeams"))
            {
                return toHiringTeams ();
            }                
            if (name.equals ("Email"))
            {
                return toEmail ();
            }                
            if (name.equals ("Password"))
            {
                return toPassword ();
            }                
            if (name.equals ("ConfirmPassword"))
            {
                return toConfirmPassword ();
            }                
            if (name.equals ("ForgotPasswordMailSendDate"))
            {
                return toForgotPasswordMailSendDate ();
            }                
            if (name.equals ("ForgotPasswordKey"))
            {
                return toForgotPasswordKey ();
            }                
            if (name.equals ("Role"))
            {
                return toRole ();
            }                
            if (name.equals ("Roles"))
            {
                return toRoles ();
            }                
            if (name.equals ("Phone"))
            {
                return toPhone ();
            }                
            if (name.equals ("VerificationMailSendDate"))
            {
                return toVerificationMailSendDate ();
            }                
            if (name.equals ("VerificationKey"))
            {
                return toVerificationKey ();
            }                
            if (name.equals ("IsAccountVerified"))
            {
                return toIsAccountVerified ();
            }                
            if (name.equals ("IsEmailChanged"))
            {
                return toIsEmailChanged ();
            }                
            if (name.equals ("IsDisabled"))
            {
                return toIsDisabled ();
            }                
            if (name.equals ("Company"))
            {
                return toCompany ();
            }                
            if (name.equals ("DefaultHiringTeam"))
            {
                return toDefaultHiringTeam ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, String> toEmail () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Email));  }
        
        public PipeLine<From, String> toPassword () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Password));  }
        
        public PipeLine<From, String> toConfirmPassword () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ConfirmPassword));  }
        
        public PipeLine<From, Date> toForgotPasswordMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ForgotPasswordMailSendDate));  }
        
        public PipeLine<From, String> toForgotPasswordKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ForgotPasswordKey));  }
        
        public PipeLine<From, RoleType> toRole () { return pipe(new ORMAttributePipe<Me, RoleType>(FIELD_Role));  }
        
        public PipeLine<From, Set<RoleType>> toRoles () { return pipe(new ORMAttributePipe<Me, Set<RoleType>>(FIELD_Roles));  }
        
        public PipeLine<From, String> toPhone () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Phone));  }
        
        public PipeLine<From, Date> toVerificationMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_VerificationMailSendDate));  }
        
        public PipeLine<From, String> toVerificationKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_VerificationKey));  }
        
        public PipeLine<From, Boolean> toIsAccountVerified () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsAccountVerified));  }
        
        public PipeLine<From, Boolean> toIsEmailChanged () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsEmailChanged));  }
        
        public PipeLine<From, Boolean> toIsDisabled () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsDisabled));  }
        public Company.CompanyPipeLineFactory<From, Company> toCompany () { return toCompany (Filter.ALL); }

        public Company.CompanyPipeLineFactory<From, Company> toCompany (Filter<Company> filter) 
        { 
            return Company.REFERENCE_Company.new CompanyPipeLineFactory<From, Company> (this, new ORMSingleAssocPipe<Me, Company>(SINGLEREFERENCE_Company, filter)); 
        }
        public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toDefaultHiringTeam () { return toDefaultHiringTeam (Filter.ALL); }

        public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toDefaultHiringTeam (Filter<HiringTeam> filter) 
        { 
            return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_DefaultHiringTeam, filter)); 
        }
        public CompanyUserHiringTeamLink.CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> toHiringTeams () { return toHiringTeams(Filter.ALL); }        

        public CompanyUserHiringTeamLink.CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> toHiringTeams (Filter<CompanyUserHiringTeamLink> filter)
        {
            return CompanyUserHiringTeamLink.REFERENCE_CompanyUserHiringTeamLink.new CompanyUserHiringTeamLinkPipeLineFactory<From, CompanyUserHiringTeamLink> (this, new ORMMultiAssocPipe<Me, CompanyUserHiringTeamLink>(MULTIPLEREFERENCE_HiringTeams, filter)); 
        }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        
        if(CollectionUtils.equals(attribName, "Email"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "Password"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "ConfirmPassword"))
        {
            return true;
        }
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


    public Company getCompany () throws StorageException
    {
        return (Company)(Company.DUMMY_Company);
    }


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

    public HiringTeam getDefaultHiringTeam () throws StorageException
    {
        return (HiringTeam)(HiringTeam.DUMMY_HiringTeam);
    }


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

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


    public CompanyUserHiringTeamLink getHiringTeamsAt (int index) throws StorageException
    {
        throw new RuntimeException ("No elements in a dummy object in association HiringTeams");
    }


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

}

    
