/*
 * 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 performa.orm.types.*;
import performa.orm.*;


public abstract class BaseMessageTemplate extends BaseBusinessClass
{
    // Reference instance for the object
    public static final MessageTemplate REFERENCE_MessageTemplate = new MessageTemplate ();

    // Reference instance for the object
    public static final MessageTemplate DUMMY_MessageTemplate = new DummyMessageTemplate ();

    // Static constants corresponding to field names
    
    public static final String FIELD_MessageID = "MessageID";
    public static final String FIELD_TemplateName = "TemplateName";
    public static final String FIELD_Subject = "Subject";
    public static final String FIELD_ApplicationStatus = "ApplicationStatus";
    public static final String FIELD_DelayHrs = "DelayHrs";
    public static final String FIELD_DelayMin = "DelayMin";
    public static final String FIELD_Variance = "Variance";
    public static final String FIELD_BusinessHoursOnly = "BusinessHoursOnly";
    public static final String FIELD_MessageContent = "MessageContent";
    public static final String FIELD_TemplateType = "TemplateType";
    public static final String FIELD_IsGlobalTemplate = "IsGlobalTemplate";
    public static final String FIELD_IsSystemGenerated = "IsSystemGenerated";
    public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
    public static final String BACKREF_HiringTeam = "";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_MessageID = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_TemplateName = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_Subject = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<MessageTemplate, ApplicationStatus> HELPER_ApplicationStatus =  new EnumeratedAttributeHelper<MessageTemplate, ApplicationStatus> (ApplicationStatus.FACTORY_ApplicationStatus);
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_DelayHrs = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_DelayMin = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_Variance = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_BusinessHoursOnly = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_MessageContent = DefaultAttributeHelper.INSTANCE;
    private static final EnumeratedAttributeHelper<MessageTemplate, TemplateType> HELPER_TemplateType =  new EnumeratedAttributeHelper<MessageTemplate, TemplateType> (TemplateType.FACTORY_TemplateType);
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_IsGlobalTemplate = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<MessageTemplate> HELPER_IsSystemGenerated = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private Integer _MessageID;
    private String _TemplateName;
    private String _Subject;
    private ApplicationStatus _ApplicationStatus;
    private Integer _DelayHrs;
    private Integer _DelayMin;
    private Integer _Variance;
    private Boolean _BusinessHoursOnly;
    private String _MessageContent;
    private TemplateType _TemplateType;
    private Boolean _IsGlobalTemplate;
    private Boolean _IsSystemGenerated;
    

    // Private attributes corresponding to single references
    private SingleAssociation<MessageTemplate, HiringTeam> _HiringTeam;
    

    // Private attributes corresponding to multiple references
    

    // Map of maps of metadata
    private static final Map ATTRIBUTES_METADATA_MessageTemplate = new LinkedHashMap ();

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_MessageID_Validators;
    private static final AttributeValidator[] FIELD_TemplateName_Validators;
    private static final AttributeValidator[] FIELD_Subject_Validators;
    private static final AttributeValidator[] FIELD_ApplicationStatus_Validators;
    private static final AttributeValidator[] FIELD_DelayHrs_Validators;
    private static final AttributeValidator[] FIELD_DelayMin_Validators;
    private static final AttributeValidator[] FIELD_Variance_Validators;
    private static final AttributeValidator[] FIELD_BusinessHoursOnly_Validators;
    private static final AttributeValidator[] FIELD_MessageContent_Validators;
    private static final AttributeValidator[] FIELD_TemplateType_Validators;
    private static final AttributeValidator[] FIELD_IsGlobalTemplate_Validators;
    private static final AttributeValidator[] FIELD_IsSystemGenerated_Validators;
    

    // Arrays of AttributeDecorators for each attribute
    private static final AttributeDecorator<MessageTemplate, Integer>[] FIELD_MessageID_Decorators;
    private static final AttributeDecorator<MessageTemplate, String>[] FIELD_TemplateName_Decorators;
    private static final AttributeDecorator<MessageTemplate, String>[] FIELD_Subject_Decorators;
    private static final AttributeDecorator<MessageTemplate, ApplicationStatus>[] FIELD_ApplicationStatus_Decorators;
    private static final AttributeDecorator<MessageTemplate, Integer>[] FIELD_DelayHrs_Decorators;
    private static final AttributeDecorator<MessageTemplate, Integer>[] FIELD_DelayMin_Decorators;
    private static final AttributeDecorator<MessageTemplate, Integer>[] FIELD_Variance_Decorators;
    private static final AttributeDecorator<MessageTemplate, Boolean>[] FIELD_BusinessHoursOnly_Decorators;
    private static final AttributeDecorator<MessageTemplate, String>[] FIELD_MessageContent_Decorators;
    private static final AttributeDecorator<MessageTemplate, TemplateType>[] FIELD_TemplateType_Decorators;
    private static final AttributeDecorator<MessageTemplate, Boolean>[] FIELD_IsGlobalTemplate_Decorators;
    private static final AttributeDecorator<MessageTemplate, Boolean>[] FIELD_IsSystemGenerated_Decorators;
    
    
    // Arrays of SingleAssocDecorators for each attribute
    private static final SingleAssocDecorator<MessageTemplate, HiringTeam>[] SINGLEREFERENCE_HiringTeam_Decorators;
    
    
    // Arrays of MultiAssocDecorators for each attribute
    

    // Arrays of behaviour decorators
    private static final MessageTemplateBehaviourDecorator[] MessageTemplate_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_HiringTeam = HiringTeam.BACKREF_MessageTemplates;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_HiringTeam();
            FIELD_MessageID_Validators = (AttributeValidator[])setupAttribMetaData_MessageID(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_TemplateName_Validators = (AttributeValidator[])setupAttribMetaData_TemplateName(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Subject_Validators = (AttributeValidator[])setupAttribMetaData_Subject(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ApplicationStatus_Validators = (AttributeValidator[])setupAttribMetaData_ApplicationStatus(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_DelayHrs_Validators = (AttributeValidator[])setupAttribMetaData_DelayHrs(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_DelayMin_Validators = (AttributeValidator[])setupAttribMetaData_DelayMin(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_Variance_Validators = (AttributeValidator[])setupAttribMetaData_Variance(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_BusinessHoursOnly_Validators = (AttributeValidator[])setupAttribMetaData_BusinessHoursOnly(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_MessageContent_Validators = (AttributeValidator[])setupAttribMetaData_MessageContent(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_TemplateType_Validators = (AttributeValidator[])setupAttribMetaData_TemplateType(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IsGlobalTemplate_Validators = (AttributeValidator[])setupAttribMetaData_IsGlobalTemplate(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_IsSystemGenerated_Validators = (AttributeValidator[])setupAttribMetaData_IsSystemGenerated(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_MessageID_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_MessageID).toArray (new AttributeDecorator[0]);
            FIELD_TemplateName_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_TemplateName).toArray (new AttributeDecorator[0]);
            FIELD_Subject_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_Subject).toArray (new AttributeDecorator[0]);
            FIELD_ApplicationStatus_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_ApplicationStatus).toArray (new AttributeDecorator[0]);
            FIELD_DelayHrs_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_DelayHrs).toArray (new AttributeDecorator[0]);
            FIELD_DelayMin_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_DelayMin).toArray (new AttributeDecorator[0]);
            FIELD_Variance_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_Variance).toArray (new AttributeDecorator[0]);
            FIELD_BusinessHoursOnly_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_BusinessHoursOnly).toArray (new AttributeDecorator[0]);
            FIELD_MessageContent_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_MessageContent).toArray (new AttributeDecorator[0]);
            FIELD_TemplateType_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_TemplateType).toArray (new AttributeDecorator[0]);
            FIELD_IsGlobalTemplate_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_IsGlobalTemplate).toArray (new AttributeDecorator[0]);
            FIELD_IsSystemGenerated_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_MessageTemplate, FIELD_IsSystemGenerated).toArray (new AttributeDecorator[0]);
            SINGLEREFERENCE_HiringTeam_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_MessageTemplate, SINGLEREFERENCE_HiringTeam).toArray (new SingleAssocDecorator[0]);
            

            REFERENCE_MessageTemplate.initialiseReference ();
            DUMMY_MessageTemplate.initialiseReference ();
            MessageTemplate_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(MessageTemplate.class).toArray(new MessageTemplateBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

    
    private static void setupAssocMetaData_HiringTeam()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "MessageTemplates");
        metaInfo.put ("dbcol", "hiring_team_id");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "HiringTeam");
        metaInfo.put ("type", "HiringTeam");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.HiringTeam:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
    }
    
    
    private static List setupAttribMetaData_MessageID(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "message_id");
        metaInfo.put ("defaultValue", "1");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "MessageID");
        metaInfo.put ("type", "Integer");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.MessageID:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_MessageID, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "template_name");
        metaInfo.put ("length", "200");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "TemplateName");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.TemplateName:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_TemplateName, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "subject");
        metaInfo.put ("length", "200");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "Subject");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.Subject:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_Subject, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "application_status");
        metaInfo.put ("defaultValue", "ApplicationStatus.DRAFT");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "ApplicationStatus");
        metaInfo.put ("type", "ApplicationStatus");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.ApplicationStatus:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_ApplicationStatus, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "delay_hrs");
        metaInfo.put ("defaultValue", "0");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "DelayHrs");
        metaInfo.put ("type", "Integer");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.DelayHrs:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_DelayHrs, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "delay_min");
        metaInfo.put ("defaultValue", "0");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "DelayMin");
        metaInfo.put ("type", "Integer");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.DelayMin:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_DelayMin, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "variance");
        metaInfo.put ("defaultValue", "0");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "Variance");
        metaInfo.put ("type", "Integer");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.Variance:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_Variance, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "business_hours_only");
        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "BusinessHoursOnly");
        metaInfo.put ("type", "Boolean");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.BusinessHoursOnly:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_BusinessHoursOnly, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "message_content");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "MessageContent");
        metaInfo.put ("type", "String");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.MessageContent:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_MessageContent, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("attribHelper", "EnumeratedAttributeHelper");
        metaInfo.put ("dbcol", "template_type");
        metaInfo.put ("defaultValue", "TemplateType.EMAIL");
        metaInfo.put ("mandatory", "true");
        metaInfo.put ("name", "TemplateType");
        metaInfo.put ("type", "TemplateType");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.TemplateType:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_TemplateType, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "is_global_template");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "IsGlobalTemplate");
        metaInfo.put ("type", "Boolean");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.IsGlobalTemplate:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_IsGlobalTemplate, Collections.unmodifiableMap (metaInfo));

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

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

        metaInfo.put ("dbcol", "is_system_generated");
        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("mandatory", "false");
        metaInfo.put ("name", "IsSystemGenerated");
        metaInfo.put ("type", "Boolean");
        metaInfo.put (METADATA_DB_TABLENAME, "tl_message_template");
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for MessageTemplate.IsSystemGenerated:", metaInfo);
        ATTRIBUTES_METADATA_MessageTemplate.put (FIELD_IsSystemGenerated, Collections.unmodifiableMap (metaInfo));

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

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


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

    


    protected void _initialiseNewObjAttributes (ObjectTransaction transaction) throws StorageException
    {
        super._initialiseNewObjAttributes (transaction);

        
        _MessageID = (Integer)(1);
        _TemplateName = (String)(HELPER_TemplateName.initialise (_TemplateName));
        _Subject = (String)(HELPER_Subject.initialise (_Subject));
        _ApplicationStatus = (ApplicationStatus)(ApplicationStatus.DRAFT);
        _DelayHrs = (Integer)(0);
        _DelayMin = (Integer)(0);
        _Variance = (Integer)(0);
        _BusinessHoursOnly = (Boolean)(Boolean.FALSE);
        _MessageContent = (String)(HELPER_MessageContent.initialise (_MessageContent));
        _TemplateType = (TemplateType)(TemplateType.EMAIL);
        _IsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.initialise (_IsGlobalTemplate));
        _IsSystemGenerated = (Boolean)(Boolean.FALSE);
    }


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

        _HiringTeam = new SingleAssociation<MessageTemplate, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_MessageTemplates, HiringTeam.REFERENCE_HiringTeam, "tl_message_template");
        
    }


    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _HiringTeam = new SingleAssociation<MessageTemplate, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, HiringTeam.MULTIPLEREFERENCE_MessageTemplates, HiringTeam.REFERENCE_HiringTeam, "tl_message_template");
        
        
        return this;
    }


    /**
     * Attribute MessageID
     */
    public Integer getMessageID ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_MessageID_Decorators, (MessageTemplate)this, FIELD_MessageID, _MessageID);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getMessageID ((MessageTemplate)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 preMessageIDChange (Integer newMessageID) 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 postMessageIDChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute MessageID.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setMessageID (Integer newMessageID) throws FieldException
    {
        newMessageID = AttributeDecoratorUtils.setValue (FIELD_MessageID_Decorators, (MessageTemplate)this, FIELD_MessageID, newMessageID);

        boolean oldAndNewIdentical = HELPER_MessageID.compare (_MessageID, newMessageID);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newMessageID = bhd.setMessageID ((MessageTemplate)this, newMessageID);
                oldAndNewIdentical = HELPER_MessageID.compare (_MessageID, newMessageID);
            }

            

            if (FIELD_MessageID_Validators.length > 0)
            {
                Object newMessageIDObj = HELPER_MessageID.toObject (newMessageID);

                if (newMessageIDObj != null)
                {
                    int     loopMax = FIELD_MessageID_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_MessageID);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_MessageID_Decorators, (MessageTemplate)this, FIELD_MessageID ,getWriteability_MessageID ()) != FieldWriteability.FALSE, "Field  MessageID is not writeable");
            preMessageIDChange (newMessageID);
            markFieldChange (FIELD_MessageID);
            _MessageID = newMessageID;            
            postFieldChange (FIELD_MessageID);
            postMessageIDChange ();
        }
    }

    /**
     * Attribute TemplateName
     */
    public String getTemplateName ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_TemplateName_Decorators, (MessageTemplate)this, FIELD_TemplateName, _TemplateName);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getTemplateName ((MessageTemplate)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 preTemplateNameChange (String newTemplateName) 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 postTemplateNameChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute TemplateName.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setTemplateName (String newTemplateName) throws FieldException
    {
        newTemplateName = AttributeDecoratorUtils.setValue (FIELD_TemplateName_Decorators, (MessageTemplate)this, FIELD_TemplateName, newTemplateName);

        boolean oldAndNewIdentical = HELPER_TemplateName.compare (_TemplateName, newTemplateName);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newTemplateName = bhd.setTemplateName ((MessageTemplate)this, newTemplateName);
                oldAndNewIdentical = HELPER_TemplateName.compare (_TemplateName, newTemplateName);
            }

            BusinessObjectParser.assertFieldCondition (newTemplateName != null, this, FIELD_TemplateName, "mandatory");
            

            if (FIELD_TemplateName_Validators.length > 0)
            {
                Object newTemplateNameObj = HELPER_TemplateName.toObject (newTemplateName);

                if (newTemplateNameObj != null)
                {
                    int     loopMax = FIELD_TemplateName_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_TemplateName);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_TemplateName_Decorators, (MessageTemplate)this, FIELD_TemplateName ,getWriteability_TemplateName ()) != FieldWriteability.FALSE, "Field  TemplateName is not writeable");
            preTemplateNameChange (newTemplateName);
            markFieldChange (FIELD_TemplateName);
            _TemplateName = newTemplateName;            
            postFieldChange (FIELD_TemplateName);
            postTemplateNameChange ();
        }
    }

    /**
     * Attribute Subject
     */
    public String getSubject ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_Subject_Decorators, (MessageTemplate)this, FIELD_Subject, _Subject);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getSubject ((MessageTemplate)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 preSubjectChange (String newSubject) 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 postSubjectChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Subject.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setSubject (String newSubject) throws FieldException
    {
        newSubject = AttributeDecoratorUtils.setValue (FIELD_Subject_Decorators, (MessageTemplate)this, FIELD_Subject, newSubject);

        boolean oldAndNewIdentical = HELPER_Subject.compare (_Subject, newSubject);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newSubject = bhd.setSubject ((MessageTemplate)this, newSubject);
                oldAndNewIdentical = HELPER_Subject.compare (_Subject, newSubject);
            }

            BusinessObjectParser.assertFieldCondition (newSubject != null, this, FIELD_Subject, "mandatory");
            

            if (FIELD_Subject_Validators.length > 0)
            {
                Object newSubjectObj = HELPER_Subject.toObject (newSubject);

                if (newSubjectObj != null)
                {
                    int     loopMax = FIELD_Subject_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_Subject);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_Subject_Decorators, (MessageTemplate)this, FIELD_Subject ,getWriteability_Subject ()) != FieldWriteability.FALSE, "Field  Subject is not writeable");
            preSubjectChange (newSubject);
            markFieldChange (FIELD_Subject);
            _Subject = newSubject;            
            postFieldChange (FIELD_Subject);
            postSubjectChange ();
        }
    }

    /**
     * Attribute ApplicationStatus
     */
    public ApplicationStatus getApplicationStatus ()
    {
        assertValid();
        ApplicationStatus valToReturn = AttributeDecoratorUtils.getValue (FIELD_ApplicationStatus_Decorators, (MessageTemplate)this, FIELD_ApplicationStatus, _ApplicationStatus);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getApplicationStatus ((MessageTemplate)this, valToReturn);
        }

        return valToReturn;
    }


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


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

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

    /**
     * Set the attribute ApplicationStatus.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setApplicationStatus (ApplicationStatus newApplicationStatus) throws FieldException
    {
        newApplicationStatus = AttributeDecoratorUtils.setValue (FIELD_ApplicationStatus_Decorators, (MessageTemplate)this, FIELD_ApplicationStatus, newApplicationStatus);

        boolean oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newApplicationStatus = bhd.setApplicationStatus ((MessageTemplate)this, newApplicationStatus);
                oldAndNewIdentical = HELPER_ApplicationStatus.compare (_ApplicationStatus, newApplicationStatus);
            }

            

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

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

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

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

    /**
     * Attribute DelayHrs
     */
    public Integer getDelayHrs ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_DelayHrs_Decorators, (MessageTemplate)this, FIELD_DelayHrs, _DelayHrs);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getDelayHrs ((MessageTemplate)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 preDelayHrsChange (Integer newDelayHrs) 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 postDelayHrsChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute DelayHrs.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setDelayHrs (Integer newDelayHrs) throws FieldException
    {
        newDelayHrs = AttributeDecoratorUtils.setValue (FIELD_DelayHrs_Decorators, (MessageTemplate)this, FIELD_DelayHrs, newDelayHrs);

        boolean oldAndNewIdentical = HELPER_DelayHrs.compare (_DelayHrs, newDelayHrs);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newDelayHrs = bhd.setDelayHrs ((MessageTemplate)this, newDelayHrs);
                oldAndNewIdentical = HELPER_DelayHrs.compare (_DelayHrs, newDelayHrs);
            }

            

            if (FIELD_DelayHrs_Validators.length > 0)
            {
                Object newDelayHrsObj = HELPER_DelayHrs.toObject (newDelayHrs);

                if (newDelayHrsObj != null)
                {
                    int     loopMax = FIELD_DelayHrs_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_DelayHrs);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_DelayHrs_Decorators, (MessageTemplate)this, FIELD_DelayHrs ,getWriteability_DelayHrs ()) != FieldWriteability.FALSE, "Field  DelayHrs is not writeable");
            preDelayHrsChange (newDelayHrs);
            markFieldChange (FIELD_DelayHrs);
            _DelayHrs = newDelayHrs;            
            postFieldChange (FIELD_DelayHrs);
            postDelayHrsChange ();
        }
    }

    /**
     * Attribute DelayMin
     */
    public Integer getDelayMin ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_DelayMin_Decorators, (MessageTemplate)this, FIELD_DelayMin, _DelayMin);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getDelayMin ((MessageTemplate)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 preDelayMinChange (Integer newDelayMin) 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 postDelayMinChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute DelayMin.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setDelayMin (Integer newDelayMin) throws FieldException
    {
        newDelayMin = AttributeDecoratorUtils.setValue (FIELD_DelayMin_Decorators, (MessageTemplate)this, FIELD_DelayMin, newDelayMin);

        boolean oldAndNewIdentical = HELPER_DelayMin.compare (_DelayMin, newDelayMin);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newDelayMin = bhd.setDelayMin ((MessageTemplate)this, newDelayMin);
                oldAndNewIdentical = HELPER_DelayMin.compare (_DelayMin, newDelayMin);
            }

            

            if (FIELD_DelayMin_Validators.length > 0)
            {
                Object newDelayMinObj = HELPER_DelayMin.toObject (newDelayMin);

                if (newDelayMinObj != null)
                {
                    int     loopMax = FIELD_DelayMin_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_DelayMin);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_DelayMin_Decorators, (MessageTemplate)this, FIELD_DelayMin ,getWriteability_DelayMin ()) != FieldWriteability.FALSE, "Field  DelayMin is not writeable");
            preDelayMinChange (newDelayMin);
            markFieldChange (FIELD_DelayMin);
            _DelayMin = newDelayMin;            
            postFieldChange (FIELD_DelayMin);
            postDelayMinChange ();
        }
    }

    /**
     * Attribute Variance
     */
    public Integer getVariance ()
    {
        assertValid();
        Integer valToReturn = AttributeDecoratorUtils.getValue (FIELD_Variance_Decorators, (MessageTemplate)this, FIELD_Variance, _Variance);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getVariance ((MessageTemplate)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 preVarianceChange (Integer newVariance) 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 postVarianceChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Variance.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setVariance (Integer newVariance) throws FieldException
    {
        newVariance = AttributeDecoratorUtils.setValue (FIELD_Variance_Decorators, (MessageTemplate)this, FIELD_Variance, newVariance);

        boolean oldAndNewIdentical = HELPER_Variance.compare (_Variance, newVariance);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newVariance = bhd.setVariance ((MessageTemplate)this, newVariance);
                oldAndNewIdentical = HELPER_Variance.compare (_Variance, newVariance);
            }

            

            if (FIELD_Variance_Validators.length > 0)
            {
                Object newVarianceObj = HELPER_Variance.toObject (newVariance);

                if (newVarianceObj != null)
                {
                    int     loopMax = FIELD_Variance_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_Variance);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_Variance_Decorators, (MessageTemplate)this, FIELD_Variance ,getWriteability_Variance ()) != FieldWriteability.FALSE, "Field  Variance is not writeable");
            preVarianceChange (newVariance);
            markFieldChange (FIELD_Variance);
            _Variance = newVariance;            
            postFieldChange (FIELD_Variance);
            postVarianceChange ();
        }
    }

    /**
     * Attribute BusinessHoursOnly
     */
    public Boolean getBusinessHoursOnly ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_BusinessHoursOnly_Decorators, (MessageTemplate)this, FIELD_BusinessHoursOnly, _BusinessHoursOnly);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getBusinessHoursOnly ((MessageTemplate)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 preBusinessHoursOnlyChange (Boolean newBusinessHoursOnly) 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 postBusinessHoursOnlyChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute BusinessHoursOnly.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setBusinessHoursOnly (Boolean newBusinessHoursOnly) throws FieldException
    {
        newBusinessHoursOnly = AttributeDecoratorUtils.setValue (FIELD_BusinessHoursOnly_Decorators, (MessageTemplate)this, FIELD_BusinessHoursOnly, newBusinessHoursOnly);

        boolean oldAndNewIdentical = HELPER_BusinessHoursOnly.compare (_BusinessHoursOnly, newBusinessHoursOnly);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newBusinessHoursOnly = bhd.setBusinessHoursOnly ((MessageTemplate)this, newBusinessHoursOnly);
                oldAndNewIdentical = HELPER_BusinessHoursOnly.compare (_BusinessHoursOnly, newBusinessHoursOnly);
            }

            

            if (FIELD_BusinessHoursOnly_Validators.length > 0)
            {
                Object newBusinessHoursOnlyObj = HELPER_BusinessHoursOnly.toObject (newBusinessHoursOnly);

                if (newBusinessHoursOnlyObj != null)
                {
                    int     loopMax = FIELD_BusinessHoursOnly_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_BusinessHoursOnly);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_BusinessHoursOnly_Decorators, (MessageTemplate)this, FIELD_BusinessHoursOnly ,getWriteability_BusinessHoursOnly ()) != FieldWriteability.FALSE, "Field  BusinessHoursOnly is not writeable");
            preBusinessHoursOnlyChange (newBusinessHoursOnly);
            markFieldChange (FIELD_BusinessHoursOnly);
            _BusinessHoursOnly = newBusinessHoursOnly;            
            postFieldChange (FIELD_BusinessHoursOnly);
            postBusinessHoursOnlyChange ();
        }
    }

    /**
     * Attribute MessageContent
     */
    public String getMessageContent ()
    {
        assertValid();
        String valToReturn = AttributeDecoratorUtils.getValue (FIELD_MessageContent_Decorators, (MessageTemplate)this, FIELD_MessageContent, _MessageContent);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getMessageContent ((MessageTemplate)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 preMessageContentChange (String newMessageContent) 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 postMessageContentChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute MessageContent.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setMessageContent (String newMessageContent) throws FieldException
    {
        newMessageContent = AttributeDecoratorUtils.setValue (FIELD_MessageContent_Decorators, (MessageTemplate)this, FIELD_MessageContent, newMessageContent);

        boolean oldAndNewIdentical = HELPER_MessageContent.compare (_MessageContent, newMessageContent);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newMessageContent = bhd.setMessageContent ((MessageTemplate)this, newMessageContent);
                oldAndNewIdentical = HELPER_MessageContent.compare (_MessageContent, newMessageContent);
            }

            BusinessObjectParser.assertFieldCondition (newMessageContent != null, this, FIELD_MessageContent, "mandatory");
            

            if (FIELD_MessageContent_Validators.length > 0)
            {
                Object newMessageContentObj = HELPER_MessageContent.toObject (newMessageContent);

                if (newMessageContentObj != null)
                {
                    int     loopMax = FIELD_MessageContent_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_MessageContent);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_MessageContent_Decorators, (MessageTemplate)this, FIELD_MessageContent ,getWriteability_MessageContent ()) != FieldWriteability.FALSE, "Field  MessageContent is not writeable");
            preMessageContentChange (newMessageContent);
            markFieldChange (FIELD_MessageContent);
            _MessageContent = newMessageContent;            
            postFieldChange (FIELD_MessageContent);
            postMessageContentChange ();
        }
    }

    /**
     * Attribute TemplateType
     */
    public TemplateType getTemplateType ()
    {
        assertValid();
        TemplateType valToReturn = AttributeDecoratorUtils.getValue (FIELD_TemplateType_Decorators, (MessageTemplate)this, FIELD_TemplateType, _TemplateType);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getTemplateType ((MessageTemplate)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 preTemplateTypeChange (TemplateType newTemplateType) 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 postTemplateTypeChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute TemplateType.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setTemplateType (TemplateType newTemplateType) throws FieldException
    {
        newTemplateType = AttributeDecoratorUtils.setValue (FIELD_TemplateType_Decorators, (MessageTemplate)this, FIELD_TemplateType, newTemplateType);

        boolean oldAndNewIdentical = HELPER_TemplateType.compare (_TemplateType, newTemplateType);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newTemplateType = bhd.setTemplateType ((MessageTemplate)this, newTemplateType);
                oldAndNewIdentical = HELPER_TemplateType.compare (_TemplateType, newTemplateType);
            }

            BusinessObjectParser.assertFieldCondition (newTemplateType != null, this, FIELD_TemplateType, "mandatory");
            

            if (FIELD_TemplateType_Validators.length > 0)
            {
                Object newTemplateTypeObj = HELPER_TemplateType.toObject (newTemplateType);

                if (newTemplateTypeObj != null)
                {
                    int     loopMax = FIELD_TemplateType_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_TemplateType);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_TemplateType_Decorators, (MessageTemplate)this, FIELD_TemplateType ,getWriteability_TemplateType ()) != FieldWriteability.FALSE, "Field  TemplateType is not writeable");
            preTemplateTypeChange (newTemplateType);
            markFieldChange (FIELD_TemplateType);
            _TemplateType = newTemplateType;            
            postFieldChange (FIELD_TemplateType);
            postTemplateTypeChange ();
        }
    }

    /**
     * Attribute IsGlobalTemplate
     */
    public Boolean getIsGlobalTemplate ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsGlobalTemplate_Decorators, (MessageTemplate)this, FIELD_IsGlobalTemplate, _IsGlobalTemplate);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getIsGlobalTemplate ((MessageTemplate)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 preIsGlobalTemplateChange (Boolean newIsGlobalTemplate) 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 postIsGlobalTemplateChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute IsGlobalTemplate.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIsGlobalTemplate (Boolean newIsGlobalTemplate) throws FieldException
    {
        newIsGlobalTemplate = AttributeDecoratorUtils.setValue (FIELD_IsGlobalTemplate_Decorators, (MessageTemplate)this, FIELD_IsGlobalTemplate, newIsGlobalTemplate);

        boolean oldAndNewIdentical = HELPER_IsGlobalTemplate.compare (_IsGlobalTemplate, newIsGlobalTemplate);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newIsGlobalTemplate = bhd.setIsGlobalTemplate ((MessageTemplate)this, newIsGlobalTemplate);
                oldAndNewIdentical = HELPER_IsGlobalTemplate.compare (_IsGlobalTemplate, newIsGlobalTemplate);
            }

            

            if (FIELD_IsGlobalTemplate_Validators.length > 0)
            {
                Object newIsGlobalTemplateObj = HELPER_IsGlobalTemplate.toObject (newIsGlobalTemplate);

                if (newIsGlobalTemplateObj != null)
                {
                    int     loopMax = FIELD_IsGlobalTemplate_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_IsGlobalTemplate);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_IsGlobalTemplate_Decorators, (MessageTemplate)this, FIELD_IsGlobalTemplate ,getWriteability_IsGlobalTemplate ()) != FieldWriteability.FALSE, "Field  IsGlobalTemplate is not writeable");
            preIsGlobalTemplateChange (newIsGlobalTemplate);
            markFieldChange (FIELD_IsGlobalTemplate);
            _IsGlobalTemplate = newIsGlobalTemplate;            
            postFieldChange (FIELD_IsGlobalTemplate);
            postIsGlobalTemplateChange ();
        }
    }

    /**
     * Attribute IsSystemGenerated
     */
    public Boolean getIsSystemGenerated ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_IsSystemGenerated_Decorators, (MessageTemplate)this, FIELD_IsSystemGenerated, _IsSystemGenerated);

        
        for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
        {
            valToReturn = bhd.getIsSystemGenerated ((MessageTemplate)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 preIsSystemGeneratedChange (Boolean newIsSystemGenerated) 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 postIsSystemGeneratedChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute IsSystemGenerated.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setIsSystemGenerated (Boolean newIsSystemGenerated) throws FieldException
    {
        newIsSystemGenerated = AttributeDecoratorUtils.setValue (FIELD_IsSystemGenerated_Decorators, (MessageTemplate)this, FIELD_IsSystemGenerated, newIsSystemGenerated);

        boolean oldAndNewIdentical = HELPER_IsSystemGenerated.compare (_IsSystemGenerated, newIsSystemGenerated);
        
        try
        {
            for (MessageTemplateBehaviourDecorator bhd : MessageTemplate_BehaviourDecorators)
            {
                newIsSystemGenerated = bhd.setIsSystemGenerated ((MessageTemplate)this, newIsSystemGenerated);
                oldAndNewIdentical = HELPER_IsSystemGenerated.compare (_IsSystemGenerated, newIsSystemGenerated);
            }

            

            if (FIELD_IsSystemGenerated_Validators.length > 0)
            {
                Object newIsSystemGeneratedObj = HELPER_IsSystemGenerated.toObject (newIsSystemGenerated);

                if (newIsSystemGeneratedObj != null)
                {
                    int     loopMax = FIELD_IsSystemGenerated_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_MessageTemplate.get (FIELD_IsSystemGenerated);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_IsSystemGenerated_Decorators, (MessageTemplate)this, FIELD_IsSystemGenerated ,getWriteability_IsSystemGenerated ()) != FieldWriteability.FALSE, "Field  IsSystemGenerated is not writeable");
            preIsSystemGeneratedChange (newIsSystemGenerated);
            markFieldChange (FIELD_IsSystemGenerated);
            _IsSystemGenerated = newIsSystemGenerated;            
            postFieldChange (FIELD_IsSystemGenerated);
            postIsSystemGeneratedChange ();
        }
    }



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

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
        {
            return _HiringTeam.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_HiringTeam))
        {
            return HiringTeam.MULTIPLEREFERENCE_MessageTemplates ;
        }
        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_HiringTeam))
        {
            return getHiringTeam ();
        }
        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_HiringTeam))
        {
            return getHiringTeam (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_HiringTeam))
        {
            return getHiringTeamID ();
        }
        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_HiringTeam))
        {
            setHiringTeam ((HiringTeam)(newValue));
        }
        else
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getHiringTeamID ()
    {
        assertValid();
        
        if (_HiringTeam == null)
        {
            return null;
        }
        else
        {
            return _HiringTeam.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 preHiringTeamChange (HiringTeam newHiringTeam) 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 postHiringTeamChange () throws FieldException
    {
    }


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

        
    /**
     * Set the reference HiringTeam.  Checks to ensure a new value
     * has been supplied.  If so, marks the reference as altered and sets it.
     */
    public void setHiringTeam (HiringTeam newHiringTeam) throws StorageException, FieldException
    {
        if (_HiringTeam.wouldReferencedChange (newHiringTeam))
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_HiringTeam_Decorators, (MessageTemplate)this, SINGLEREFERENCE_HiringTeam ,getWriteability_HiringTeam ()) != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
            preHiringTeamChange (newHiringTeam);
            HiringTeam oldHiringTeam = getHiringTeam ();

            if (oldHiringTeam != null)
            {
                // This is to stop validation from triggering when we are removed
                _HiringTeam.set (null);
                oldHiringTeam.removeFromMessageTemplates ((MessageTemplate)(this));
            }

            _HiringTeam.set (newHiringTeam);

            if (newHiringTeam != null)
            {
                newHiringTeam.addToMessageTemplates ((MessageTemplate)(this));
            }
                
            postHiringTeamChange ();
        }
    }

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

        return result;
    }


    /**
     * Get the reference instance for the multi assoc name.
     */
    public BaseBusinessClass getMultiAssocReferenceInstance(String attribName)
    {

        return super.getMultiAssocReferenceInstance(attribName);
    }


    public String getMultiAssocBackReference(String attribName)
    {

        return super.getMultiAssocBackReference(attribName);
    }


    /**
     * Get the assoc count for the multi assoc name.
     */
    public int getMultiAssocCount(String attribName) throws StorageException
    {

        return super.getMultiAssocCount(attribName);
    }


    /**
     * Get the assoc at a particular index
     */
    public BaseBusinessClass getMultiAssocAt(String attribName, int index) throws StorageException
    {

        return super.getMultiAssocAt(attribName, index);
    }


    /**
     * Add to a multi assoc by attribute name
     */
    public void addToMultiAssoc(String attribName, BaseBusinessClass newElement) throws StorageException
    {

        super.addToMultiAssoc(attribName, newElement);
    }

    /**
     * Remove from a multi assoc by attribute name
     */
    public void removeFromMultiAssoc(String attribName, BaseBusinessClass oldElement) throws StorageException
    {

        super.removeFromMultiAssoc(attribName, oldElement);
    }


    protected void __loadMultiAssoc (String attribName, BaseBusinessClass[] elements)
    {

        super.__loadMultiAssoc(attribName, elements);
    }


    protected boolean __isMultiAssocLoaded (String attribName)
    {

        return super.__isMultiAssocLoaded(attribName);
    }




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

                if (referenced != null)
                {
                    // Stop the callback
                    LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Setting backreference to null MessageTemplates from ", getObjectID (), " to ", referenced.getObjectID ());
                    _HiringTeam.set (null);
                    referenced.removeFromMessageTemplates ((MessageTemplate)this);
                }
            }
        
        }
        catch (Exception e)
        {
            throw NestedException.wrap(e);
        }

        super.onDelete ();
    }


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


    public MessageTemplate referenceInstance ()
    {
        return REFERENCE_MessageTemplate;
    }


    public MessageTemplate getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getMessageTemplateByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_MessageTemplate;
    }


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



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

        super.getPersistentSets (allSets);
        
        PersistentSet   tl_message_templatePSet = allSets.getPersistentSet (myID, "tl_message_template", myPSetStatus);

        tl_message_templatePSet.setAttrib (FIELD_ObjectID, myID);
        tl_message_templatePSet.setAttrib (FIELD_MessageID, HELPER_MessageID.toObject (_MessageID)); //
        tl_message_templatePSet.setAttrib (FIELD_TemplateName, HELPER_TemplateName.toObject (_TemplateName)); //
        tl_message_templatePSet.setAttrib (FIELD_Subject, HELPER_Subject.toObject (_Subject)); //
        tl_message_templatePSet.setAttrib (FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject (_ApplicationStatus)); //
        tl_message_templatePSet.setAttrib (FIELD_DelayHrs, HELPER_DelayHrs.toObject (_DelayHrs)); //
        tl_message_templatePSet.setAttrib (FIELD_DelayMin, HELPER_DelayMin.toObject (_DelayMin)); //
        tl_message_templatePSet.setAttrib (FIELD_Variance, HELPER_Variance.toObject (_Variance)); //
        tl_message_templatePSet.setAttrib (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject (_BusinessHoursOnly)); //
        tl_message_templatePSet.setAttrib (FIELD_MessageContent, HELPER_MessageContent.toObject (_MessageContent)); //
        tl_message_templatePSet.setAttrib (FIELD_TemplateType, HELPER_TemplateType.toObject (_TemplateType)); //
        tl_message_templatePSet.setAttrib (FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.toObject (_IsGlobalTemplate)); //
        tl_message_templatePSet.setAttrib (FIELD_IsSystemGenerated, HELPER_IsSystemGenerated.toObject (_IsSystemGenerated)); //
        _HiringTeam.getPersistentSets (allSets);
        
    }


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

        _MessageID = (Integer)(HELPER_MessageID.fromObject (_MessageID, tl_message_templatePSet.getAttrib (FIELD_MessageID))); //
        _TemplateName = (String)(HELPER_TemplateName.fromObject (_TemplateName, tl_message_templatePSet.getAttrib (FIELD_TemplateName))); //
        _Subject = (String)(HELPER_Subject.fromObject (_Subject, tl_message_templatePSet.getAttrib (FIELD_Subject))); //
        _ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, tl_message_templatePSet.getAttrib (FIELD_ApplicationStatus))); //
        _DelayHrs = (Integer)(HELPER_DelayHrs.fromObject (_DelayHrs, tl_message_templatePSet.getAttrib (FIELD_DelayHrs))); //
        _DelayMin = (Integer)(HELPER_DelayMin.fromObject (_DelayMin, tl_message_templatePSet.getAttrib (FIELD_DelayMin))); //
        _Variance = (Integer)(HELPER_Variance.fromObject (_Variance, tl_message_templatePSet.getAttrib (FIELD_Variance))); //
        _BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, tl_message_templatePSet.getAttrib (FIELD_BusinessHoursOnly))); //
        _MessageContent = (String)(HELPER_MessageContent.fromObject (_MessageContent, tl_message_templatePSet.getAttrib (FIELD_MessageContent))); //
        _TemplateType = (TemplateType)(HELPER_TemplateType.fromObject (_TemplateType, tl_message_templatePSet.getAttrib (FIELD_TemplateType))); //
        _IsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.fromObject (_IsGlobalTemplate, tl_message_templatePSet.getAttrib (FIELD_IsGlobalTemplate))); //
        _IsSystemGenerated = (Boolean)(HELPER_IsSystemGenerated.fromObject (_IsSystemGenerated, tl_message_templatePSet.getAttrib (FIELD_IsSystemGenerated))); //
        _HiringTeam.setFromPersistentSets (objectID, allSets);
        
    }


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

        if (other instanceof MessageTemplate)
        {
            MessageTemplate otherMessageTemplate = (MessageTemplate)other;
            

            try
            {
                setMessageID (otherMessageTemplate.getMessageID ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setTemplateName (otherMessageTemplate.getTemplateName ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setSubject (otherMessageTemplate.getSubject ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setApplicationStatus (otherMessageTemplate.getApplicationStatus ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setDelayHrs (otherMessageTemplate.getDelayHrs ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setDelayMin (otherMessageTemplate.getDelayMin ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setVariance (otherMessageTemplate.getVariance ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setBusinessHoursOnly (otherMessageTemplate.getBusinessHoursOnly ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setMessageContent (otherMessageTemplate.getMessageContent ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setTemplateType (otherMessageTemplate.getTemplateType ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setIsGlobalTemplate (otherMessageTemplate.getIsGlobalTemplate ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }

            try
            {
                setIsSystemGenerated (otherMessageTemplate.getIsSystemGenerated ());
            }
            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 BaseMessageTemplate)
        {
            BaseMessageTemplate sourceMessageTemplate = (BaseMessageTemplate)(source);

            _MessageID = sourceMessageTemplate._MessageID;
            _TemplateName = sourceMessageTemplate._TemplateName;
            _Subject = sourceMessageTemplate._Subject;
            _ApplicationStatus = sourceMessageTemplate._ApplicationStatus;
            _DelayHrs = sourceMessageTemplate._DelayHrs;
            _DelayMin = sourceMessageTemplate._DelayMin;
            _Variance = sourceMessageTemplate._Variance;
            _BusinessHoursOnly = sourceMessageTemplate._BusinessHoursOnly;
            _MessageContent = sourceMessageTemplate._MessageContent;
            _TemplateType = sourceMessageTemplate._TemplateType;
            _IsGlobalTemplate = sourceMessageTemplate._IsGlobalTemplate;
            _IsSystemGenerated = sourceMessageTemplate._IsSystemGenerated;
            
        }
    }


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

            _HiringTeam.copyFrom (sourceMessageTemplate._HiringTeam, 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 BaseMessageTemplate)
        {
            BaseMessageTemplate sourceMessageTemplate = (BaseMessageTemplate)(source);

            
        }
    }


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

        _MessageID = (Integer)(HELPER_MessageID.readExternal (_MessageID, vals.get(FIELD_MessageID))); //
        _TemplateName = (String)(HELPER_TemplateName.readExternal (_TemplateName, vals.get(FIELD_TemplateName))); //
        _Subject = (String)(HELPER_Subject.readExternal (_Subject, vals.get(FIELD_Subject))); //
        _ApplicationStatus = (ApplicationStatus)(HELPER_ApplicationStatus.readExternal (_ApplicationStatus, vals.get(FIELD_ApplicationStatus))); //
        _DelayHrs = (Integer)(HELPER_DelayHrs.readExternal (_DelayHrs, vals.get(FIELD_DelayHrs))); //
        _DelayMin = (Integer)(HELPER_DelayMin.readExternal (_DelayMin, vals.get(FIELD_DelayMin))); //
        _Variance = (Integer)(HELPER_Variance.readExternal (_Variance, vals.get(FIELD_Variance))); //
        _BusinessHoursOnly = (Boolean)(HELPER_BusinessHoursOnly.readExternal (_BusinessHoursOnly, vals.get(FIELD_BusinessHoursOnly))); //
        _MessageContent = (String)(HELPER_MessageContent.readExternal (_MessageContent, vals.get(FIELD_MessageContent))); //
        _TemplateType = (TemplateType)(HELPER_TemplateType.readExternal (_TemplateType, vals.get(FIELD_TemplateType))); //
        _IsGlobalTemplate = (Boolean)(HELPER_IsGlobalTemplate.readExternal (_IsGlobalTemplate, vals.get(FIELD_IsGlobalTemplate))); //
        _IsSystemGenerated = (Boolean)(HELPER_IsSystemGenerated.readExternal (_IsSystemGenerated, vals.get(FIELD_IsSystemGenerated))); //
        _HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
        
    }


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

        vals.put (FIELD_MessageID, HELPER_MessageID.writeExternal (_MessageID));
        vals.put (FIELD_TemplateName, HELPER_TemplateName.writeExternal (_TemplateName));
        vals.put (FIELD_Subject, HELPER_Subject.writeExternal (_Subject));
        vals.put (FIELD_ApplicationStatus, HELPER_ApplicationStatus.writeExternal (_ApplicationStatus));
        vals.put (FIELD_DelayHrs, HELPER_DelayHrs.writeExternal (_DelayHrs));
        vals.put (FIELD_DelayMin, HELPER_DelayMin.writeExternal (_DelayMin));
        vals.put (FIELD_Variance, HELPER_Variance.writeExternal (_Variance));
        vals.put (FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.writeExternal (_BusinessHoursOnly));
        vals.put (FIELD_MessageContent, HELPER_MessageContent.writeExternal (_MessageContent));
        vals.put (FIELD_TemplateType, HELPER_TemplateType.writeExternal (_TemplateType));
        vals.put (FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.writeExternal (_IsGlobalTemplate));
        vals.put (FIELD_IsSystemGenerated, HELPER_IsSystemGenerated.writeExternal (_IsSystemGenerated));
        vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
        
    }


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

        if (other instanceof BaseMessageTemplate)
        {
            BaseMessageTemplate otherMessageTemplate = (BaseMessageTemplate)(other);

            
            if (!HELPER_MessageID.compare(this._MessageID, otherMessageTemplate._MessageID))
            {
                listener.notifyFieldChange(this, other, FIELD_MessageID, HELPER_MessageID.toObject(this._MessageID), HELPER_MessageID.toObject(otherMessageTemplate._MessageID));
            }
            if (!HELPER_TemplateName.compare(this._TemplateName, otherMessageTemplate._TemplateName))
            {
                listener.notifyFieldChange(this, other, FIELD_TemplateName, HELPER_TemplateName.toObject(this._TemplateName), HELPER_TemplateName.toObject(otherMessageTemplate._TemplateName));
            }
            if (!HELPER_Subject.compare(this._Subject, otherMessageTemplate._Subject))
            {
                listener.notifyFieldChange(this, other, FIELD_Subject, HELPER_Subject.toObject(this._Subject), HELPER_Subject.toObject(otherMessageTemplate._Subject));
            }
            if (!HELPER_ApplicationStatus.compare(this._ApplicationStatus, otherMessageTemplate._ApplicationStatus))
            {
                listener.notifyFieldChange(this, other, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(this._ApplicationStatus), HELPER_ApplicationStatus.toObject(otherMessageTemplate._ApplicationStatus));
            }
            if (!HELPER_DelayHrs.compare(this._DelayHrs, otherMessageTemplate._DelayHrs))
            {
                listener.notifyFieldChange(this, other, FIELD_DelayHrs, HELPER_DelayHrs.toObject(this._DelayHrs), HELPER_DelayHrs.toObject(otherMessageTemplate._DelayHrs));
            }
            if (!HELPER_DelayMin.compare(this._DelayMin, otherMessageTemplate._DelayMin))
            {
                listener.notifyFieldChange(this, other, FIELD_DelayMin, HELPER_DelayMin.toObject(this._DelayMin), HELPER_DelayMin.toObject(otherMessageTemplate._DelayMin));
            }
            if (!HELPER_Variance.compare(this._Variance, otherMessageTemplate._Variance))
            {
                listener.notifyFieldChange(this, other, FIELD_Variance, HELPER_Variance.toObject(this._Variance), HELPER_Variance.toObject(otherMessageTemplate._Variance));
            }
            if (!HELPER_BusinessHoursOnly.compare(this._BusinessHoursOnly, otherMessageTemplate._BusinessHoursOnly))
            {
                listener.notifyFieldChange(this, other, FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject(this._BusinessHoursOnly), HELPER_BusinessHoursOnly.toObject(otherMessageTemplate._BusinessHoursOnly));
            }
            if (!HELPER_MessageContent.compare(this._MessageContent, otherMessageTemplate._MessageContent))
            {
                listener.notifyFieldChange(this, other, FIELD_MessageContent, HELPER_MessageContent.toObject(this._MessageContent), HELPER_MessageContent.toObject(otherMessageTemplate._MessageContent));
            }
            if (!HELPER_TemplateType.compare(this._TemplateType, otherMessageTemplate._TemplateType))
            {
                listener.notifyFieldChange(this, other, FIELD_TemplateType, HELPER_TemplateType.toObject(this._TemplateType), HELPER_TemplateType.toObject(otherMessageTemplate._TemplateType));
            }
            if (!HELPER_IsGlobalTemplate.compare(this._IsGlobalTemplate, otherMessageTemplate._IsGlobalTemplate))
            {
                listener.notifyFieldChange(this, other, FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.toObject(this._IsGlobalTemplate), HELPER_IsGlobalTemplate.toObject(otherMessageTemplate._IsGlobalTemplate));
            }
            if (!HELPER_IsSystemGenerated.compare(this._IsSystemGenerated, otherMessageTemplate._IsSystemGenerated))
            {
                listener.notifyFieldChange(this, other, FIELD_IsSystemGenerated, HELPER_IsSystemGenerated.toObject(this._IsSystemGenerated), HELPER_IsSystemGenerated.toObject(otherMessageTemplate._IsSystemGenerated));
            }

            // Compare single assocs
            _HiringTeam.compare (otherMessageTemplate._HiringTeam, listener);
            

            // Compare multiple assocs
            
        }
    }


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

        
    }


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

        visitor.visitField(this, FIELD_MessageID, HELPER_MessageID.toObject(getMessageID()));
        visitor.visitField(this, FIELD_TemplateName, HELPER_TemplateName.toObject(getTemplateName()));
        visitor.visitField(this, FIELD_Subject, HELPER_Subject.toObject(getSubject()));
        visitor.visitField(this, FIELD_ApplicationStatus, HELPER_ApplicationStatus.toObject(getApplicationStatus()));
        visitor.visitField(this, FIELD_DelayHrs, HELPER_DelayHrs.toObject(getDelayHrs()));
        visitor.visitField(this, FIELD_DelayMin, HELPER_DelayMin.toObject(getDelayMin()));
        visitor.visitField(this, FIELD_Variance, HELPER_Variance.toObject(getVariance()));
        visitor.visitField(this, FIELD_BusinessHoursOnly, HELPER_BusinessHoursOnly.toObject(getBusinessHoursOnly()));
        visitor.visitField(this, FIELD_MessageContent, HELPER_MessageContent.toObject(getMessageContent()));
        visitor.visitField(this, FIELD_TemplateType, HELPER_TemplateType.toObject(getTemplateType()));
        visitor.visitField(this, FIELD_IsGlobalTemplate, HELPER_IsGlobalTemplate.toObject(getIsGlobalTemplate()));
        visitor.visitField(this, FIELD_IsSystemGenerated, HELPER_IsSystemGenerated.toObject(getIsSystemGenerated()));
        visitor.visitAssociation (_HiringTeam);
        
    }


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

        if (scope.includes (_HiringTeam))
        {
            visitor.visit (_HiringTeam);
        }
        
    }


    public static MessageTemplate createMessageTemplate (ObjectTransaction transaction) throws StorageException
    {
        MessageTemplate     result = new MessageTemplate ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static MessageTemplate getMessageTemplateByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (MessageTemplate)(transaction.getObjectByID (REFERENCE_MessageTemplate, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_MessageID))
        {
            return filter.matches (getMessageID ());
        }
        else if (attribName.equals (FIELD_TemplateName))
        {
            return filter.matches (getTemplateName ());
        }
        else if (attribName.equals (FIELD_Subject))
        {
            return filter.matches (getSubject ());
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            return filter.matches (getApplicationStatus ());
        }
        else if (attribName.equals (FIELD_DelayHrs))
        {
            return filter.matches (getDelayHrs ());
        }
        else if (attribName.equals (FIELD_DelayMin))
        {
            return filter.matches (getDelayMin ());
        }
        else if (attribName.equals (FIELD_Variance))
        {
            return filter.matches (getVariance ());
        }
        else if (attribName.equals (FIELD_BusinessHoursOnly))
        {
            return filter.matches (getBusinessHoursOnly ());
        }
        else if (attribName.equals (FIELD_MessageContent))
        {
            return filter.matches (getMessageContent ());
        }
        else if (attribName.equals (FIELD_TemplateType))
        {
            return filter.matches (getTemplateType ());
        }
        else if (attribName.equals (FIELD_IsGlobalTemplate))
        {
            return filter.matches (getIsGlobalTemplate ());
        }
        else if (attribName.equals (FIELD_IsSystemGenerated))
        {
            return filter.matches (getIsSystemGenerated ());
        }
        else if (attribName.equals (SINGLEREFERENCE_HiringTeam))
        {
            return filter.matches (getHiringTeam ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }


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

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

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

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

            
        public SearchAll andMessageID (QueryFilter<Integer> filter)
        {
            filter.addFilter (context, "tl_message_template.message_id", "MessageID");
            return this;
        }
            
        public SearchAll andTemplateName (QueryFilter<String> filter)
        {
            filter.addFilter (context, "tl_message_template.template_name", "TemplateName");
            return this;
        }
            
        public SearchAll andSubject (QueryFilter<String> filter)
        {
            filter.addFilter (context, "tl_message_template.subject", "Subject");
            return this;
        }
            
        public SearchAll andApplicationStatus (QueryFilter<ApplicationStatus> filter)
        {
            filter.addFilter (context, "tl_message_template.application_status", "ApplicationStatus");
            return this;
        }
            
        public SearchAll andDelayHrs (QueryFilter<Integer> filter)
        {
            filter.addFilter (context, "tl_message_template.delay_hrs", "DelayHrs");
            return this;
        }
            
        public SearchAll andDelayMin (QueryFilter<Integer> filter)
        {
            filter.addFilter (context, "tl_message_template.delay_min", "DelayMin");
            return this;
        }
            
        public SearchAll andVariance (QueryFilter<Integer> filter)
        {
            filter.addFilter (context, "tl_message_template.variance", "Variance");
            return this;
        }
            
        public SearchAll andBusinessHoursOnly (QueryFilter<Boolean> filter)
        {
            filter.addFilter (context, "tl_message_template.business_hours_only", "BusinessHoursOnly");
            return this;
        }
            
        public SearchAll andMessageContent (QueryFilter<String> filter)
        {
            filter.addFilter (context, "tl_message_template.message_content", "MessageContent");
            return this;
        }
            
        public SearchAll andTemplateType (QueryFilter<TemplateType> filter)
        {
            filter.addFilter (context, "tl_message_template.template_type", "TemplateType");
            return this;
        }
            
        public SearchAll andIsGlobalTemplate (QueryFilter<Boolean> filter)
        {
            filter.addFilter (context, "tl_message_template.is_global_template", "IsGlobalTemplate");
            return this;
        }
            
        public SearchAll andIsSystemGenerated (QueryFilter<Boolean> filter)
        {
            filter.addFilter (context, "tl_message_template.is_system_generated", "IsSystemGenerated");
            return this;
        }
            
        public SearchAll andHiringTeam (QueryFilter<HiringTeam> filter)
        {
            filter.addFilter (context, "tl_message_template.hiring_team_id", "HiringTeam");
            return this;
        }
            
        public MessageTemplate[] search (ObjectTransaction transaction) throws StorageException
        {
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_MessageTemplate, SEARCH_All, criteria);
            Set<MessageTemplate>   typedResults = new LinkedHashSet <MessageTemplate> ();
            for (BaseBusinessClass bbcResult : results)
            {
                MessageTemplate aResult = (MessageTemplate)bbcResult;
                
                typedResults.add (aResult);
            }
            
            return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new MessageTemplate[0]);
                            
        }
    }

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



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_MessageID))
        {
            return HELPER_MessageID.toObject (getMessageID ());
        }
        else if (attribName.equals (FIELD_TemplateName))
        {
            return HELPER_TemplateName.toObject (getTemplateName ());
        }
        else if (attribName.equals (FIELD_Subject))
        {
            return HELPER_Subject.toObject (getSubject ());
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            return HELPER_ApplicationStatus.toObject (getApplicationStatus ());
        }
        else if (attribName.equals (FIELD_DelayHrs))
        {
            return HELPER_DelayHrs.toObject (getDelayHrs ());
        }
        else if (attribName.equals (FIELD_DelayMin))
        {
            return HELPER_DelayMin.toObject (getDelayMin ());
        }
        else if (attribName.equals (FIELD_Variance))
        {
            return HELPER_Variance.toObject (getVariance ());
        }
        else if (attribName.equals (FIELD_BusinessHoursOnly))
        {
            return HELPER_BusinessHoursOnly.toObject (getBusinessHoursOnly ());
        }
        else if (attribName.equals (FIELD_MessageContent))
        {
            return HELPER_MessageContent.toObject (getMessageContent ());
        }
        else if (attribName.equals (FIELD_TemplateType))
        {
            return HELPER_TemplateType.toObject (getTemplateType ());
        }
        else if (attribName.equals (FIELD_IsGlobalTemplate))
        {
            return HELPER_IsGlobalTemplate.toObject (getIsGlobalTemplate ());
        }
        else if (attribName.equals (FIELD_IsSystemGenerated))
        {
            return HELPER_IsSystemGenerated.toObject (getIsSystemGenerated ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_MessageID))
        {
            return HELPER_MessageID;
        }
        else if (attribName.equals (FIELD_TemplateName))
        {
            return HELPER_TemplateName;
        }
        else if (attribName.equals (FIELD_Subject))
        {
            return HELPER_Subject;
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            return HELPER_ApplicationStatus;
        }
        else if (attribName.equals (FIELD_DelayHrs))
        {
            return HELPER_DelayHrs;
        }
        else if (attribName.equals (FIELD_DelayMin))
        {
            return HELPER_DelayMin;
        }
        else if (attribName.equals (FIELD_Variance))
        {
            return HELPER_Variance;
        }
        else if (attribName.equals (FIELD_BusinessHoursOnly))
        {
            return HELPER_BusinessHoursOnly;
        }
        else if (attribName.equals (FIELD_MessageContent))
        {
            return HELPER_MessageContent;
        }
        else if (attribName.equals (FIELD_TemplateType))
        {
            return HELPER_TemplateType;
        }
        else if (attribName.equals (FIELD_IsGlobalTemplate))
        {
            return HELPER_IsGlobalTemplate;
        }
        else if (attribName.equals (FIELD_IsSystemGenerated))
        {
            return HELPER_IsSystemGenerated;
        }
        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_MessageID))
        {
            setMessageID ((Integer)(HELPER_MessageID.fromObject (_MessageID, attribValue)));            
        }
        else if (attribName.equals (FIELD_TemplateName))
        {
            setTemplateName ((String)(HELPER_TemplateName.fromObject (_TemplateName, attribValue)));            
        }
        else if (attribName.equals (FIELD_Subject))
        {
            setSubject ((String)(HELPER_Subject.fromObject (_Subject, attribValue)));            
        }
        else if (attribName.equals (FIELD_ApplicationStatus))
        {
            setApplicationStatus ((ApplicationStatus)(HELPER_ApplicationStatus.fromObject (_ApplicationStatus, attribValue)));            
        }
        else if (attribName.equals (FIELD_DelayHrs))
        {
            setDelayHrs ((Integer)(HELPER_DelayHrs.fromObject (_DelayHrs, attribValue)));            
        }
        else if (attribName.equals (FIELD_DelayMin))
        {
            setDelayMin ((Integer)(HELPER_DelayMin.fromObject (_DelayMin, attribValue)));            
        }
        else if (attribName.equals (FIELD_Variance))
        {
            setVariance ((Integer)(HELPER_Variance.fromObject (_Variance, attribValue)));            
        }
        else if (attribName.equals (FIELD_BusinessHoursOnly))
        {
            setBusinessHoursOnly ((Boolean)(HELPER_BusinessHoursOnly.fromObject (_BusinessHoursOnly, attribValue)));            
        }
        else if (attribName.equals (FIELD_MessageContent))
        {
            setMessageContent ((String)(HELPER_MessageContent.fromObject (_MessageContent, attribValue)));            
        }
        else if (attribName.equals (FIELD_TemplateType))
        {
            setTemplateType ((TemplateType)(HELPER_TemplateType.fromObject (_TemplateType, attribValue)));            
        }
        else if (attribName.equals (FIELD_IsGlobalTemplate))
        {
            setIsGlobalTemplate ((Boolean)(HELPER_IsGlobalTemplate.fromObject (_IsGlobalTemplate, attribValue)));            
        }
        else if (attribName.equals (FIELD_IsSystemGenerated))
        {
            setIsSystemGenerated ((Boolean)(HELPER_IsSystemGenerated.fromObject (_IsSystemGenerated, 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_MessageID))
        {
            return getWriteability_MessageID ();
        }
        else if (fieldName.equals (FIELD_TemplateName))
        {
            return getWriteability_TemplateName ();
        }
        else if (fieldName.equals (FIELD_Subject))
        {
            return getWriteability_Subject ();
        }
        else if (fieldName.equals (FIELD_ApplicationStatus))
        {
            return getWriteability_ApplicationStatus ();
        }
        else if (fieldName.equals (FIELD_DelayHrs))
        {
            return getWriteability_DelayHrs ();
        }
        else if (fieldName.equals (FIELD_DelayMin))
        {
            return getWriteability_DelayMin ();
        }
        else if (fieldName.equals (FIELD_Variance))
        {
            return getWriteability_Variance ();
        }
        else if (fieldName.equals (FIELD_BusinessHoursOnly))
        {
            return getWriteability_BusinessHoursOnly ();
        }
        else if (fieldName.equals (FIELD_MessageContent))
        {
            return getWriteability_MessageContent ();
        }
        else if (fieldName.equals (FIELD_TemplateType))
        {
            return getWriteability_TemplateType ();
        }
        else if (fieldName.equals (FIELD_IsGlobalTemplate))
        {
            return getWriteability_IsGlobalTemplate ();
        }
        else if (fieldName.equals (FIELD_IsSystemGenerated))
        {
            return getWriteability_IsSystemGenerated ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_HiringTeam))
        {
            return getWriteability_HiringTeam ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        if (getWriteability_MessageID () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_MessageID);
        }
        
        if (getWriteability_TemplateName () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_TemplateName);
        }
        
        if (getWriteability_Subject () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_Subject);
        }
        
        if (getWriteability_ApplicationStatus () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_ApplicationStatus);
        }
        
        if (getWriteability_DelayHrs () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_DelayHrs);
        }
        
        if (getWriteability_DelayMin () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_DelayMin);
        }
        
        if (getWriteability_Variance () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_Variance);
        }
        
        if (getWriteability_BusinessHoursOnly () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_BusinessHoursOnly);
        }
        
        if (getWriteability_MessageContent () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_MessageContent);
        }
        
        if (getWriteability_TemplateType () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_TemplateType);
        }
        
        if (getWriteability_IsGlobalTemplate () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_IsGlobalTemplate);
        }
        
        if (getWriteability_IsSystemGenerated () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_IsSystemGenerated);
        }
        

        super.putUnwriteable (fields);
    }

    public String[] getAllTableNames()
    {
        return new String[] {"tl_message_template"};
    }
    
    public boolean isPolymorphic(String tableName)
    {
        return super.isPolymorphic(tableName);
    }


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

        
        result.add(HELPER_MessageID.getAttribObject (getClass (), _MessageID, false, FIELD_MessageID));
        result.add(HELPER_TemplateName.getAttribObject (getClass (), _TemplateName, true, FIELD_TemplateName));
        result.add(HELPER_Subject.getAttribObject (getClass (), _Subject, true, FIELD_Subject));
        result.add(HELPER_ApplicationStatus.getAttribObject (getClass (), _ApplicationStatus, false, FIELD_ApplicationStatus));
        result.add(HELPER_DelayHrs.getAttribObject (getClass (), _DelayHrs, false, FIELD_DelayHrs));
        result.add(HELPER_DelayMin.getAttribObject (getClass (), _DelayMin, false, FIELD_DelayMin));
        result.add(HELPER_Variance.getAttribObject (getClass (), _Variance, false, FIELD_Variance));
        result.add(HELPER_BusinessHoursOnly.getAttribObject (getClass (), _BusinessHoursOnly, false, FIELD_BusinessHoursOnly));
        result.add(HELPER_MessageContent.getAttribObject (getClass (), _MessageContent, true, FIELD_MessageContent));
        result.add(HELPER_TemplateType.getAttribObject (getClass (), _TemplateType, true, FIELD_TemplateType));
        result.add(HELPER_IsGlobalTemplate.getAttribObject (getClass (), _IsGlobalTemplate, false, FIELD_IsGlobalTemplate));
        result.add(HELPER_IsSystemGenerated.getAttribObject (getClass (), _IsSystemGenerated, false, FIELD_IsSystemGenerated));

        return result;
    }


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


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

    public void copyAllAttributeMetadata (Map copyInto)
    {
        super.copyAllAttributeMetadata(copyInto);

        copyInto.putAll(ATTRIBUTES_METADATA_MessageTemplate);
    }
            

    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 MessageTemplateBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<MessageTemplate>
    {

    /**
     * Get the attribute MessageID
     */
    public Integer getMessageID (MessageTemplate obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute MessageID.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setMessageID (MessageTemplate obj, Integer newMessageID) throws FieldException
    {
        return newMessageID;
    }

    /**
     * Get the attribute TemplateName
     */
    public String getTemplateName (MessageTemplate obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute TemplateName.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setTemplateName (MessageTemplate obj, String newTemplateName) throws FieldException
    {
        return newTemplateName;
    }

    /**
     * Get the attribute Subject
     */
    public String getSubject (MessageTemplate obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Subject.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setSubject (MessageTemplate obj, String newSubject) throws FieldException
    {
        return newSubject;
    }

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

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

    /**
     * Get the attribute DelayHrs
     */
    public Integer getDelayHrs (MessageTemplate obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute DelayHrs.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setDelayHrs (MessageTemplate obj, Integer newDelayHrs) throws FieldException
    {
        return newDelayHrs;
    }

    /**
     * Get the attribute DelayMin
     */
    public Integer getDelayMin (MessageTemplate obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute DelayMin.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setDelayMin (MessageTemplate obj, Integer newDelayMin) throws FieldException
    {
        return newDelayMin;
    }

    /**
     * Get the attribute Variance
     */
    public Integer getVariance (MessageTemplate obj, Integer original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Variance.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Integer setVariance (MessageTemplate obj, Integer newVariance) throws FieldException
    {
        return newVariance;
    }

    /**
     * Get the attribute BusinessHoursOnly
     */
    public Boolean getBusinessHoursOnly (MessageTemplate obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute BusinessHoursOnly.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setBusinessHoursOnly (MessageTemplate obj, Boolean newBusinessHoursOnly) throws FieldException
    {
        return newBusinessHoursOnly;
    }

    /**
     * Get the attribute MessageContent
     */
    public String getMessageContent (MessageTemplate obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute MessageContent.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setMessageContent (MessageTemplate obj, String newMessageContent) throws FieldException
    {
        return newMessageContent;
    }

    /**
     * Get the attribute TemplateType
     */
    public TemplateType getTemplateType (MessageTemplate obj, TemplateType original)
    {
        return original;
    }

    /**
     * Change the value set for attribute TemplateType.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public TemplateType setTemplateType (MessageTemplate obj, TemplateType newTemplateType) throws FieldException
    {
        return newTemplateType;
    }

    /**
     * Get the attribute IsGlobalTemplate
     */
    public Boolean getIsGlobalTemplate (MessageTemplate obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IsGlobalTemplate.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setIsGlobalTemplate (MessageTemplate obj, Boolean newIsGlobalTemplate) throws FieldException
    {
        return newIsGlobalTemplate;
    }

    /**
     * Get the attribute IsSystemGenerated
     */
    public Boolean getIsSystemGenerated (MessageTemplate obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute IsSystemGenerated.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setIsSystemGenerated (MessageTemplate obj, Boolean newIsSystemGenerated) throws FieldException
    {
        return newIsSystemGenerated;
    }

    }

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

    @Override
    public ORMPipeLine pipes(Collection _items)
    {
        return pipesMessageTemplate(_items);
    }
      
    /**
     * Use this instead of pipes() to get rid of type casting.
     */  
    public MessageTemplatePipeLineFactory<MessageTemplate, MessageTemplate> pipelineMessageTemplate()
    {
        return (MessageTemplatePipeLineFactory<MessageTemplate, MessageTemplate>) pipes();
    }
    
    public static MessageTemplatePipeLineFactory<MessageTemplate, MessageTemplate> pipesMessageTemplate(Collection<MessageTemplate> items)
    {
        return REFERENCE_MessageTemplate.new MessageTemplatePipeLineFactory<MessageTemplate, MessageTemplate> (items);
    }
    
    public static MessageTemplatePipeLineFactory<MessageTemplate, MessageTemplate> pipesMessageTemplate(MessageTemplate[] _items)
    {
        return pipesMessageTemplate(Arrays.asList (_items));
    }
    
    public static MessageTemplatePipeLineFactory<MessageTemplate, MessageTemplate> pipesMessageTemplate()
    {
        return pipesMessageTemplate((Collection)null);
    }
    
    
    public class MessageTemplatePipeLineFactory<From extends BaseBusinessClass, Me extends MessageTemplate> extends BaseBusinessClass.ORMPipeLine<From, Me>    
    {
        public <Prev> MessageTemplatePipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public MessageTemplatePipeLineFactory (From seed)
        {
            super(seed);
        }

        public MessageTemplatePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("MessageID"))
            {
                return toMessageID ();
            }                
            if (name.equals ("TemplateName"))
            {
                return toTemplateName ();
            }                
            if (name.equals ("Subject"))
            {
                return toSubject ();
            }                
            if (name.equals ("ApplicationStatus"))
            {
                return toApplicationStatus ();
            }                
            if (name.equals ("DelayHrs"))
            {
                return toDelayHrs ();
            }                
            if (name.equals ("DelayMin"))
            {
                return toDelayMin ();
            }                
            if (name.equals ("Variance"))
            {
                return toVariance ();
            }                
            if (name.equals ("BusinessHoursOnly"))
            {
                return toBusinessHoursOnly ();
            }                
            if (name.equals ("MessageContent"))
            {
                return toMessageContent ();
            }                
            if (name.equals ("TemplateType"))
            {
                return toTemplateType ();
            }                
            if (name.equals ("IsGlobalTemplate"))
            {
                return toIsGlobalTemplate ();
            }                
            if (name.equals ("IsSystemGenerated"))
            {
                return toIsSystemGenerated ();
            }                
            if (name.equals ("HiringTeam"))
            {
                return toHiringTeam ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Integer> toMessageID () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_MessageID));  }
        
        public PipeLine<From, String> toTemplateName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_TemplateName));  }
        
        public PipeLine<From, String> toSubject () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Subject));  }
        
        public ApplicationStatus.ApplicationStatusPipeLineFactory<From, ApplicationStatus> toApplicationStatus () 
        { 
            return new ApplicationStatus.ApplicationStatusPipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_ApplicationStatus));
        }
        
        public PipeLine<From, Integer> toDelayHrs () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_DelayHrs));  }
        
        public PipeLine<From, Integer> toDelayMin () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_DelayMin));  }
        
        public PipeLine<From, Integer> toVariance () { return pipe(new ORMAttributePipe<Me, Integer>(FIELD_Variance));  }
        
        public PipeLine<From, Boolean> toBusinessHoursOnly () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_BusinessHoursOnly));  }
        
        public PipeLine<From, String> toMessageContent () { return pipe(new ORMAttributePipe<Me, String>(FIELD_MessageContent));  }
        
        public TemplateType.TemplateTypePipeLineFactory<From, TemplateType> toTemplateType () 
        { 
            return new TemplateType.TemplateTypePipeLineFactory<> (this, new ORMAttributePipe<>(FIELD_TemplateType));
        }
        
        public PipeLine<From, Boolean> toIsGlobalTemplate () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsGlobalTemplate));  }
        
        public PipeLine<From, Boolean> toIsSystemGenerated () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsSystemGenerated));  }

        public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam () { return toHiringTeam (Filter.ALL); }

        public HiringTeam.HiringTeamPipeLineFactory<From, HiringTeam> toHiringTeam (Filter<HiringTeam> filter) 
        { 
            return HiringTeam.REFERENCE_HiringTeam.new HiringTeamPipeLineFactory<From, HiringTeam> (this, new ORMSingleAssocPipe<Me, HiringTeam>(SINGLEREFERENCE_HiringTeam, filter)); 
        }
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


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


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

}

