/*
 * IMPORTANT!!!! XSL Autogenerated class, DO NOT EDIT!!!!!
 * Template: Infrastructure9.0 [oneit.objstore.BusinessObjectTemplate.xsl]
 *   Vendor: Apache Software Foundation (Xalan XSLTC) (Version: 1.0)
 */

    
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 FIELD_PrivacyPolicyAgreed = "PrivacyPolicyAgreed";
    public static final String FIELD_ConditionsAgreed = "ConditionsAgreed";
    public static final String SINGLEREFERENCE_SelectedTeam = "SelectedTeam";
    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 static final DefaultAttributeHelper<CompanyUser> HELPER_PrivacyPolicyAgreed = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<CompanyUser> HELPER_ConditionsAgreed = 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 Boolean _PrivacyPolicyAgreed;
    private Boolean _ConditionsAgreed;
    

    // Private attributes corresponding to single references
    private SingleAssociation<CompanyUser, HiringTeam> _SelectedTeam;
    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 LinkedHashMap ();

    // 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_PrivacyPolicyAgreed_Validators;
    private static final AttributeValidator[] FIELD_ConditionsAgreed_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 AttributeDecorators for each attribute
    private static final AttributeDecorator<CompanyUser, String>[] FIELD_Email_Decorators;
    private static final AttributeDecorator<CompanyUser, String>[] FIELD_Password_Decorators;
    private static final AttributeDecorator<CompanyUser, String>[] FIELD_ConfirmPassword_Decorators;
    private static final AttributeDecorator<CompanyUser, Boolean>[] FIELD_PrivacyPolicyAgreed_Decorators;
    private static final AttributeDecorator<CompanyUser, Boolean>[] FIELD_ConditionsAgreed_Decorators;
    private static final AttributeDecorator<CompanyUser, Date>[] FIELD_ForgotPasswordMailSendDate_Decorators;
    private static final AttributeDecorator<CompanyUser, String>[] FIELD_ForgotPasswordKey_Decorators;
    private static final AttributeDecorator<CompanyUser, RoleType>[] FIELD_Role_Decorators;
    private static final AttributeDecorator<CompanyUser, Set<RoleType>>[] FIELD_Roles_Decorators;
    private static final AttributeDecorator<CompanyUser, String>[] FIELD_Phone_Decorators;
    private static final AttributeDecorator<CompanyUser, Date>[] FIELD_VerificationMailSendDate_Decorators;
    private static final AttributeDecorator<CompanyUser, String>[] FIELD_VerificationKey_Decorators;
    private static final AttributeDecorator<CompanyUser, Boolean>[] FIELD_IsAccountVerified_Decorators;
    private static final AttributeDecorator<CompanyUser, Boolean>[] FIELD_IsEmailChanged_Decorators;
    private static final AttributeDecorator<CompanyUser, Boolean>[] FIELD_IsDisabled_Decorators;
    
    
    // Arrays of SingleAssocDecorators for each attribute
    private static final SingleAssocDecorator<CompanyUser, HiringTeam>[] SINGLEREFERENCE_SelectedTeam_Decorators;
    private static final SingleAssocDecorator<CompanyUser, Company>[] SINGLEREFERENCE_Company_Decorators;
    private static final SingleAssocDecorator<CompanyUser, HiringTeam>[] SINGLEREFERENCE_DefaultHiringTeam_Decorators;
    
    
    // Arrays of MultiAssocDecorators for each attribute
    private static final MultiAssocDecorator<CompanyUser, CompanyUserHiringTeamLink>[] MULTIPLEREFERENCE_HiringTeams_Decorators;
    

    // 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_SelectedTeam();
            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_PrivacyPolicyAgreed_Validators = (AttributeValidator[])setupAttribMetaData_PrivacyPolicyAgreed(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ConditionsAgreed_Validators = (AttributeValidator[])setupAttribMetaData_ConditionsAgreed(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]);
            FIELD_Email_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_Email).toArray (new AttributeDecorator[0]);
            FIELD_Password_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_Password).toArray (new AttributeDecorator[0]);
            FIELD_ConfirmPassword_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_ConfirmPassword).toArray (new AttributeDecorator[0]);
            FIELD_PrivacyPolicyAgreed_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_PrivacyPolicyAgreed).toArray (new AttributeDecorator[0]);
            FIELD_ConditionsAgreed_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_ConditionsAgreed).toArray (new AttributeDecorator[0]);
            FIELD_ForgotPasswordMailSendDate_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_ForgotPasswordMailSendDate).toArray (new AttributeDecorator[0]);
            FIELD_ForgotPasswordKey_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_ForgotPasswordKey).toArray (new AttributeDecorator[0]);
            FIELD_Role_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_Role).toArray (new AttributeDecorator[0]);
            FIELD_Roles_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_Roles).toArray (new AttributeDecorator[0]);
            FIELD_Phone_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_Phone).toArray (new AttributeDecorator[0]);
            FIELD_VerificationMailSendDate_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_VerificationMailSendDate).toArray (new AttributeDecorator[0]);
            FIELD_VerificationKey_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_VerificationKey).toArray (new AttributeDecorator[0]);
            FIELD_IsAccountVerified_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_IsAccountVerified).toArray (new AttributeDecorator[0]);
            FIELD_IsEmailChanged_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_IsEmailChanged).toArray (new AttributeDecorator[0]);
            FIELD_IsDisabled_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_CompanyUser, FIELD_IsDisabled).toArray (new AttributeDecorator[0]);
            SINGLEREFERENCE_SelectedTeam_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_CompanyUser, SINGLEREFERENCE_SelectedTeam).toArray (new SingleAssocDecorator[0]);
            SINGLEREFERENCE_Company_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_CompanyUser, SINGLEREFERENCE_Company).toArray (new SingleAssocDecorator[0]);
            SINGLEREFERENCE_DefaultHiringTeam_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_CompanyUser, SINGLEREFERENCE_DefaultHiringTeam).toArray (new SingleAssocDecorator[0]);
            MULTIPLEREFERENCE_HiringTeams_Decorators = (MultiAssocDecorator[])AttributeDecoratorUtils.getMultiAssocDecorators(REFERENCE_CompanyUser, MULTIPLEREFERENCE_HiringTeams).toArray (new MultiAssocDecorator[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;
        }
    }

    
    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));
    }
    
    
    private static void setupAssocMetaData_SelectedTeam()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("name", "SelectedTeam");
        metaInfo.put ("type", "HiringTeam");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.SelectedTeam:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (SINGLEREFERENCE_SelectedTeam, Collections.unmodifiableMap (metaInfo));
    }
    
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.Company:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (SINGLEREFERENCE_Company, Collections.unmodifiableMap (metaInfo));
    }
    
    
    private static void setupAssocMetaData_DefaultHiringTeam()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "default_hiring_team_id");
        metaInfo.put ("name", "DefaultHiringTeam");
        metaInfo.put ("type", "HiringTeam");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for CompanyUser.DefaultHiringTeam:", metaInfo);
        ATTRIBUTES_METADATA_CompanyUser.put (SINGLEREFERENCE_DefaultHiringTeam, Collections.unmodifiableMap (metaInfo));
    }
    
    
    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;
    }
    
    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;
    }
    
    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;
    }
    
    private static List setupAttribMetaData_PrivacyPolicyAgreed(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

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

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

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

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

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

        return validators;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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>");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }
    
    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");
        metaInfo.put (METADATA_DB_TABLENAME, "oneit_sec_user_extension");
        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;
    }

    


    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));
        _PrivacyPolicyAgreed = (Boolean)(Boolean.FALSE);
        _ConditionsAgreed = (Boolean)(Boolean.FALSE);
    }


    protected void _initialiseAssociations ()
    {
        super._initialiseAssociations ();

        _SelectedTeam = new SingleAssociation<CompanyUser, HiringTeam> (this, SINGLEREFERENCE_SelectedTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
        _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);
    }


    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _SelectedTeam = new SingleAssociation<CompanyUser, HiringTeam> (this, SINGLEREFERENCE_SelectedTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
        _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;
    }


    /**
     * Attribute ForgotPasswordMailSendDate
     */
    public Date getForgotPasswordMailSendDate ()
    {
        assertValid();
        Date valToReturn = AttributeDecoratorUtils.getValue (FIELD_ForgotPasswordMailSendDate_Decorators, (CompanyUser)this, FIELD_ForgotPasswordMailSendDate, _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
    {
        newForgotPasswordMailSendDate = AttributeDecoratorUtils.setValue (FIELD_ForgotPasswordMailSendDate_Decorators, (CompanyUser)this, FIELD_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_ForgotPasswordMailSendDate_Decorators, (CompanyUser)this, FIELD_ForgotPasswordMailSendDate ,getWriteability_ForgotPasswordMailSendDate ()) != FieldWriteability.FALSE, "Field  ForgotPasswordMailSendDate is not writeable");
            preForgotPasswordMailSendDateChange (newForgotPasswordMailSendDate);
            markFieldChange (FIELD_ForgotPasswordMailSendDate);
            _ForgotPasswordMailSendDate = newForgotPasswordMailSendDate;            
            postFieldChange (FIELD_ForgotPasswordMailSendDate);
            postForgotPasswordMailSendDateChange ();
        }
    }

    /**
     * Attribute ForgotPasswordKey
     */
    public String getForgotPasswordKey ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_ForgotPasswordKey_Decorators, (CompanyUser)this, FIELD_ForgotPasswordKey, _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
    {
        newForgotPasswordKey = AttributeDecoratorUtils.setValue (FIELD_ForgotPasswordKey_Decorators, (CompanyUser)this, FIELD_ForgotPasswordKey, newForgotPasswordKey);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_ForgotPasswordKey_Decorators, (CompanyUser)this, FIELD_ForgotPasswordKey ,getWriteability_ForgotPasswordKey ()) != FieldWriteability.FALSE, "Field  ForgotPasswordKey is not writeable");
            preForgotPasswordKeyChange (newForgotPasswordKey);
            markFieldChange (FIELD_ForgotPasswordKey);
            _ForgotPasswordKey = newForgotPasswordKey;            
            postFieldChange (FIELD_ForgotPasswordKey);
            postForgotPasswordKeyChange ();
        }
    }

    /**
     * Attribute Role
     */
    public RoleType getRole ()
    {
        assertValid();
        RoleType valToReturn = AttributeDecoratorUtils.getValue (FIELD_Role_Decorators, (CompanyUser)this, FIELD_Role, _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
    {
        newRole = AttributeDecoratorUtils.setValue (FIELD_Role_Decorators, (CompanyUser)this, FIELD_Role, newRole);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Role_Decorators, (CompanyUser)this, FIELD_Role ,getWriteability_Role ()) != FieldWriteability.FALSE, "Field  Role is not writeable");
            preRoleChange (newRole);
            markFieldChange (FIELD_Role);
            _Role = newRole;            
            postFieldChange (FIELD_Role);
            postRoleChange ();
        }
    }

    /**
     * Attribute Roles
     */
    public Set<RoleType> getRoles ()
    {
        assertValid();
        Set<RoleType> valToReturn = AttributeDecoratorUtils.getValue (FIELD_Roles_Decorators, (CompanyUser)this, FIELD_Roles, _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
    {
        newRoles = AttributeDecoratorUtils.setValue (FIELD_Roles_Decorators, (CompanyUser)this, FIELD_Roles, newRoles);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Roles_Decorators, (CompanyUser)this, FIELD_Roles ,getWriteability_Roles ()) != FieldWriteability.FALSE, "Field  Roles is not writeable");
            preRolesChange (newRoles);
            markFieldChange (FIELD_Roles);
            _Roles = newRoles;            
            postFieldChange (FIELD_Roles);
            postRolesChange ();
        }
    }

    /**
     * Attribute Phone
     */
    public String getPhone ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Phone_Decorators, (CompanyUser)this, FIELD_Phone, _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
    {
        newPhone = AttributeDecoratorUtils.setValue (FIELD_Phone_Decorators, (CompanyUser)this, FIELD_Phone, newPhone);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Phone_Decorators, (CompanyUser)this, FIELD_Phone ,getWriteability_Phone ()) != FieldWriteability.FALSE, "Field  Phone is not writeable");
            prePhoneChange (newPhone);
            markFieldChange (FIELD_Phone);
            _Phone = newPhone;            
            postFieldChange (FIELD_Phone);
            postPhoneChange ();
        }
    }

    /**
     * Attribute VerificationMailSendDate
     */
    public Date getVerificationMailSendDate ()
    {
        assertValid();
        Date valToReturn = AttributeDecoratorUtils.getValue (FIELD_VerificationMailSendDate_Decorators, (CompanyUser)this, FIELD_VerificationMailSendDate, _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
    {
        newVerificationMailSendDate = AttributeDecoratorUtils.setValue (FIELD_VerificationMailSendDate_Decorators, (CompanyUser)this, FIELD_VerificationMailSendDate, newVerificationMailSendDate);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_VerificationMailSendDate_Decorators, (CompanyUser)this, FIELD_VerificationMailSendDate ,getWriteability_VerificationMailSendDate ()) != FieldWriteability.FALSE, "Field  VerificationMailSendDate is not writeable");
            preVerificationMailSendDateChange (newVerificationMailSendDate);
            markFieldChange (FIELD_VerificationMailSendDate);
            _VerificationMailSendDate = newVerificationMailSendDate;            
            postFieldChange (FIELD_VerificationMailSendDate);
            postVerificationMailSendDateChange ();
        }
    }

    /**
     * Attribute VerificationKey
     */
    public String getVerificationKey ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_VerificationKey_Decorators, (CompanyUser)this, FIELD_VerificationKey, _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
    {
        newVerificationKey = AttributeDecoratorUtils.setValue (FIELD_VerificationKey_Decorators, (CompanyUser)this, FIELD_VerificationKey, newVerificationKey);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_VerificationKey_Decorators, (CompanyUser)this, FIELD_VerificationKey ,getWriteability_VerificationKey ()) != FieldWriteability.FALSE, "Field  VerificationKey is not writeable");
            preVerificationKeyChange (newVerificationKey);
            markFieldChange (FIELD_VerificationKey);
            _VerificationKey = newVerificationKey;            
            postFieldChange (FIELD_VerificationKey);
            postVerificationKeyChange ();
        }
    }

    /**
     * Attribute IsAccountVerified
     */
    public Boolean getIsAccountVerified ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsAccountVerified_Decorators, (CompanyUser)this, FIELD_IsAccountVerified, _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
    {
        newIsAccountVerified = AttributeDecoratorUtils.setValue (FIELD_IsAccountVerified_Decorators, (CompanyUser)this, FIELD_IsAccountVerified, newIsAccountVerified);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_IsAccountVerified_Decorators, (CompanyUser)this, FIELD_IsAccountVerified ,getWriteability_IsAccountVerified ()) != FieldWriteability.FALSE, "Field  IsAccountVerified is not writeable");
            preIsAccountVerifiedChange (newIsAccountVerified);
            markFieldChange (FIELD_IsAccountVerified);
            _IsAccountVerified = newIsAccountVerified;            
            postFieldChange (FIELD_IsAccountVerified);
            postIsAccountVerifiedChange ();
        }
    }

    /**
     * Attribute IsEmailChanged
     */
    public Boolean getIsEmailChanged ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsEmailChanged_Decorators, (CompanyUser)this, FIELD_IsEmailChanged, _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
    {
        newIsEmailChanged = AttributeDecoratorUtils.setValue (FIELD_IsEmailChanged_Decorators, (CompanyUser)this, FIELD_IsEmailChanged, newIsEmailChanged);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_IsEmailChanged_Decorators, (CompanyUser)this, FIELD_IsEmailChanged ,getWriteability_IsEmailChanged ()) != FieldWriteability.FALSE, "Field  IsEmailChanged is not writeable");
            preIsEmailChangedChange (newIsEmailChanged);
            markFieldChange (FIELD_IsEmailChanged);
            _IsEmailChanged = newIsEmailChanged;            
            postFieldChange (FIELD_IsEmailChanged);
            postIsEmailChangedChange ();
        }
    }

    /**
     * Attribute IsDisabled
     */
    public Boolean getIsDisabled ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsDisabled_Decorators, (CompanyUser)this, FIELD_IsDisabled, _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
    {
        newIsDisabled = AttributeDecoratorUtils.setValue (FIELD_IsDisabled_Decorators, (CompanyUser)this, FIELD_IsDisabled, newIsDisabled);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_IsDisabled_Decorators, (CompanyUser)this, FIELD_IsDisabled ,getWriteability_IsDisabled ()) != FieldWriteability.FALSE, "Field  IsDisabled is not writeable");
            preIsDisabledChange (newIsDisabled);
            markFieldChange (FIELD_IsDisabled);
            _IsDisabled = newIsDisabled;            
            postFieldChange (FIELD_IsDisabled);
            postIsDisabledChange ();
        }
    }

    /**
     * Attribute Email
     */
    public String getEmail ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Email_Decorators, (CompanyUser)this, FIELD_Email, _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
    {
        newEmail = AttributeDecoratorUtils.setValue (FIELD_Email_Decorators, (CompanyUser)this, FIELD_Email, newEmail);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Email_Decorators, (CompanyUser)this, FIELD_Email ,getWriteability_Email ()) != FieldWriteability.FALSE, "Field  Email is not writeable");
            preEmailChange (newEmail);
            markFieldChange (FIELD_Email);
            _Email = newEmail;            
            postFieldChange (FIELD_Email);
            postEmailChange ();
        }
    }

    /**
     * Attribute Password
     */
    public String getPassword ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Password_Decorators, (CompanyUser)this, FIELD_Password, _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
    {
        newPassword = AttributeDecoratorUtils.setValue (FIELD_Password_Decorators, (CompanyUser)this, FIELD_Password, newPassword);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_Password_Decorators, (CompanyUser)this, FIELD_Password ,getWriteability_Password ()) != FieldWriteability.FALSE, "Field  Password is not writeable");
            prePasswordChange (newPassword);
            markFieldChange (FIELD_Password);
            _Password = newPassword;            
            postFieldChange (FIELD_Password);
            postPasswordChange ();
        }
    }

    /**
     * Attribute ConfirmPassword
     */
    public String getConfirmPassword ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_ConfirmPassword_Decorators, (CompanyUser)this, FIELD_ConfirmPassword, _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
    {
        newConfirmPassword = AttributeDecoratorUtils.setValue (FIELD_ConfirmPassword_Decorators, (CompanyUser)this, FIELD_ConfirmPassword, newConfirmPassword);

        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 (AttributeDecoratorUtils.getWriteability (FIELD_ConfirmPassword_Decorators, (CompanyUser)this, FIELD_ConfirmPassword ,getWriteability_ConfirmPassword ()) != FieldWriteability.FALSE, "Field  ConfirmPassword is not writeable");
            preConfirmPasswordChange (newConfirmPassword);
            markFieldChange (FIELD_ConfirmPassword);
            _ConfirmPassword = newConfirmPassword;            
            postFieldChange (FIELD_ConfirmPassword);
            postConfirmPasswordChange ();
        }
    }

    /**
     * Attribute PrivacyPolicyAgreed
     */
    public Boolean getPrivacyPolicyAgreed ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_PrivacyPolicyAgreed_Decorators, (CompanyUser)this, FIELD_PrivacyPolicyAgreed, _PrivacyPolicyAgreed);

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


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

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

    /**
     * Set the attribute PrivacyPolicyAgreed.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setPrivacyPolicyAgreed (Boolean newPrivacyPolicyAgreed) throws FieldException
    {
        newPrivacyPolicyAgreed = AttributeDecoratorUtils.setValue (FIELD_PrivacyPolicyAgreed_Decorators, (CompanyUser)this, FIELD_PrivacyPolicyAgreed, newPrivacyPolicyAgreed);

        boolean oldAndNewIdentical = HELPER_PrivacyPolicyAgreed.compare (_PrivacyPolicyAgreed, newPrivacyPolicyAgreed);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newPrivacyPolicyAgreed = bhd.setPrivacyPolicyAgreed ((CompanyUser)this, newPrivacyPolicyAgreed);
                oldAndNewIdentical = HELPER_PrivacyPolicyAgreed.compare (_PrivacyPolicyAgreed, newPrivacyPolicyAgreed);
            }

            

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

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

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

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

    /**
     * Attribute ConditionsAgreed
     */
    public Boolean getConditionsAgreed ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_ConditionsAgreed_Decorators, (CompanyUser)this, FIELD_ConditionsAgreed, _ConditionsAgreed);

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


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

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

    /**
     * Set the attribute ConditionsAgreed.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setConditionsAgreed (Boolean newConditionsAgreed) throws FieldException
    {
        newConditionsAgreed = AttributeDecoratorUtils.setValue (FIELD_ConditionsAgreed_Decorators, (CompanyUser)this, FIELD_ConditionsAgreed, newConditionsAgreed);

        boolean oldAndNewIdentical = HELPER_ConditionsAgreed.compare (_ConditionsAgreed, newConditionsAgreed);
        
        try
        {
            for (CompanyUserBehaviourDecorator bhd : CompanyUser_BehaviourDecorators)
            {
                newConditionsAgreed = bhd.setConditionsAgreed ((CompanyUser)this, newConditionsAgreed);
                oldAndNewIdentical = HELPER_ConditionsAgreed.compare (_ConditionsAgreed, newConditionsAgreed);
            }

            

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

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

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

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



    /**
     * A list of multi assoc names e.g. list of strings.
     */
    public List<String> getSingleAssocs()
    {
        List result = super.getSingleAssocs ();
        
        result.add("SelectedTeam");
        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_SelectedTeam))
        {
            return _SelectedTeam.getReferencedType ();
        }
        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_SelectedTeam))
        {
            return getSelectedTeam ();
        }
        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_SelectedTeam))
        {
            return getSelectedTeam (getType);
        }
        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_SelectedTeam))
        {
            return getSelectedTeamID ();
        }
        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_SelectedTeam))
        {
            setSelectedTeam ((HiringTeam)(newValue));
        }
        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 SelectedTeam
     */
    public HiringTeam getSelectedTeam () throws StorageException
    {
        assertValid();
        
        try
        {
            return (HiringTeam)(_SelectedTeam.get ());
        }
        catch (ClassCastException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in CompanyUser:", this.getObjectID (), ", was trying to get HiringTeam:",  getSelectedTeamID ());
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _SelectedTeam.get ().getClass ());
            throw e;
        }
    }


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getSelectedTeamID ()
    {
        assertValid();
        
        if (_SelectedTeam == null)
        {
            return null;
        }
        else
        {
            return _SelectedTeam.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 preSelectedTeamChange (HiringTeam newSelectedTeam) 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 postSelectedTeamChange () throws FieldException
    {
    }


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

        
    /**
     * Set the reference SelectedTeam.  Checks to ensure a new value
     * has been supplied.  If so, marks the reference as altered and sets it.
     */
    public void setSelectedTeam (HiringTeam newSelectedTeam) throws StorageException, FieldException
    {
        if (_SelectedTeam.wouldReferencedChange (newSelectedTeam))
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_SelectedTeam_Decorators, (CompanyUser)this, SINGLEREFERENCE_SelectedTeam ,getWriteability_SelectedTeam ()) != FieldWriteability.FALSE, "Assoc SelectedTeam is not writeable");
            preSelectedTeamChange (newSelectedTeam);
            
            _SelectedTeam.set (newSelectedTeam);
                
            postSelectedTeamChange ();
        }
    }

    /**
     * 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 (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_Company_Decorators, (CompanyUser)this, SINGLEREFERENCE_Company ,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 (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_DefaultHiringTeam_Decorators, (CompanyUser)this, SINGLEREFERENCE_DefaultHiringTeam ,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 (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_HiringTeams_Decorators, (CompanyUser)this, MULTIPLEREFERENCE_HiringTeams ,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 (AttributeDecoratorUtils.getWriteability (MULTIPLEREFERENCE_HiringTeams_Decorators, (CompanyUser)this, MULTIPLEREFERENCE_HiringTeams ,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;
            _PrivacyPolicyAgreed = sourceCompanyUser._PrivacyPolicyAgreed;
            _ConditionsAgreed = sourceCompanyUser._ConditionsAgreed;
            
        }
    }


    /**
     * Set the associations in this to copies of the attributes in source.
     */
    public void copySingleAssociationsFrom (BaseBusinessClass source, boolean linkToGhosts)
    {
        super.copySingleAssociationsFrom (source, linkToGhosts);

        if (source instanceof BaseCompanyUser)
        {
            BaseCompanyUser sourceCompanyUser = (BaseCompanyUser)(source);

            _SelectedTeam.copyFrom (sourceCompanyUser._SelectedTeam, linkToGhosts);
            _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))); //
        _PrivacyPolicyAgreed = (Boolean)(HELPER_PrivacyPolicyAgreed.readExternal (_PrivacyPolicyAgreed, vals.get(FIELD_PrivacyPolicyAgreed))); //
        _ConditionsAgreed = (Boolean)(HELPER_ConditionsAgreed.readExternal (_ConditionsAgreed, vals.get(FIELD_ConditionsAgreed))); //
        _SelectedTeam.readExternalData(vals.get(SINGLEREFERENCE_SelectedTeam));
        _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 (FIELD_PrivacyPolicyAgreed, HELPER_PrivacyPolicyAgreed.writeExternal (_PrivacyPolicyAgreed));
        vals.put (FIELD_ConditionsAgreed, HELPER_ConditionsAgreed.writeExternal (_ConditionsAgreed));
        vals.put (SINGLEREFERENCE_SelectedTeam, _SelectedTeam.writeExternalData());
        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
            _SelectedTeam.compare (otherCompanyUser._SelectedTeam, listener);
            _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()));
        visitor.visitField(this, FIELD_PrivacyPolicyAgreed, HELPER_PrivacyPolicyAgreed.toObject(getPrivacyPolicyAgreed()));
        visitor.visitField(this, FIELD_ConditionsAgreed, HELPER_ConditionsAgreed.toObject(getConditionsAgreed()));
        
    }


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

        visitor.visitField(this, FIELD_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 (_SelectedTeam);
        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 (_SelectedTeam))
        {
            visitor.visit (_SelectedTeam);
        }
        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 if (attribName.equals (FIELD_PrivacyPolicyAgreed))
        {
            return HELPER_PrivacyPolicyAgreed.toObject (getPrivacyPolicyAgreed ());
        }
        else if (attribName.equals (FIELD_ConditionsAgreed))
        {
            return HELPER_ConditionsAgreed.toObject (getConditionsAgreed ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_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 if (attribName.equals (FIELD_PrivacyPolicyAgreed))
        {
            return HELPER_PrivacyPolicyAgreed;
        }
        else if (attribName.equals (FIELD_ConditionsAgreed))
        {
            return HELPER_ConditionsAgreed;
        }
        else
        {
            return super.getAttributeHelper (attribName);
        }
    }


    public void setAttribute (String attribName, Object attribValue) throws FieldException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_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 if (attribName.equals (FIELD_PrivacyPolicyAgreed))
        {
            setPrivacyPolicyAgreed ((Boolean)(HELPER_PrivacyPolicyAgreed.fromObject (_PrivacyPolicyAgreed, attribValue)));            
        }
        else if (attribName.equals (FIELD_ConditionsAgreed))
        {
            setConditionsAgreed ((Boolean)(HELPER_ConditionsAgreed.fromObject (_ConditionsAgreed, attribValue)));            
        }
        else
        {
            super.setAttribute (attribName, attribValue);
        }
    }

    

    public boolean isWriteable (String fieldName)
    {        
        return getWriteable (fieldName) == FieldWriteability.TRUE;
    }

    public boolean isReadable ()
    {
        return super.isReadable();
    }

    public boolean isReadable (String fieldName)
    {
        return super.isReadable(fieldName);
    }


    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 if (fieldName.equals (FIELD_PrivacyPolicyAgreed))
        {
            return getWriteability_PrivacyPolicyAgreed ();
        }
        else if (fieldName.equals (FIELD_ConditionsAgreed))
        {
            return getWriteability_ConditionsAgreed ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_SelectedTeam))
        {
            return getWriteability_SelectedTeam ();
        }
        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);
        }
        
        if (getWriteability_PrivacyPolicyAgreed () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_PrivacyPolicyAgreed);
        }
        
        if (getWriteability_ConditionsAgreed () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_ConditionsAgreed);
        }
        

        super.putUnwriteable (fields);
    }

    public String[] getAllTableNames()
    {
        return new String[] {"oneit_sec_user_extension"};
    }
    
    public boolean isPolymorphic(String tableName)
    {        if(CollectionUtils.equals(tableName, "oneit_sec_user_extension"))
        {
            return true;
        }
        return super.isPolymorphic(tableName);
    }


    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));
        result.add(HELPER_PrivacyPolicyAgreed.getAttribObject (getClass (), _PrivacyPolicyAgreed, false, FIELD_PrivacyPolicyAgreed));
        result.add(HELPER_ConditionsAgreed.getAttribObject (getClass (), _ConditionsAgreed, false, FIELD_ConditionsAgreed));

        return result;
    }


    public Map getAttributeMetadata (String attribute)
    {
        if (ATTRIBUTES_METADATA_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 copyAllAttributeMetadata (Map copyInto)
    {
        super.copyAllAttributeMetadata(copyInto);

        copyInto.putAll(ATTRIBUTES_METADATA_CompanyUser);
    }
            

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

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

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

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

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

    }

    @Override
    public ORMPipeLine pipes()
    {
        return new CompanyUserPipeLineFactory<CompanyUser, CompanyUser> ((CompanyUser)this);
    }

    @Override
    public ORMPipeLine pipes(Collection _items)
    {
        return pipesCompanyUser(_items);
    }
      
    /**
     * 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 ("PrivacyPolicyAgreed"))
            {
                return toPrivacyPolicyAgreed ();
            }                
            if (name.equals ("ConditionsAgreed"))
            {
                return toConditionsAgreed ();
            }                
            if (name.equals ("SelectedTeam"))
            {
                return toSelectedTeam ();
            }                
            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, Boolean> toPrivacyPolicyAgreed () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_PrivacyPolicyAgreed));  }
        
        public PipeLine<From, Boolean> toConditionsAgreed () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ConditionsAgreed));  }
        
        public PipeLine<From, Date> toForgotPasswordMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ForgotPasswordMailSendDate));  }
        
        public PipeLine<From, String> toForgotPasswordKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ForgotPasswordKey));  }
        
        public RoleType.RoleTypePipeLineFactory<From, RoleType> toRole () 
        { 
            return new RoleType.RoleTypePipeLineFactory<> (this, new ORMAttributePipe<>(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 HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toSelectedTeam () { return toSelectedTeam (Filter.ALL); }

        public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toSelectedTeam (Filter<HiringTeam> filter) 
        { 
            return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_SelectedTeam, filter)); 
        }

        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;
        }
        
        if(CollectionUtils.equals(attribName, "PrivacyPolicyAgreed"))
        {
            return true;
        }
        
        if(CollectionUtils.equals(attribName, "ConditionsAgreed"))
        {
            return true;
        }
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        
        if(CollectionUtils.equals(assocName, "SelectedTeam"))
        {
            return true;
        }
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


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


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

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

}

    
