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

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

import oneit.servlets.orm.*;
import performa.orm.*;

// __#BUILD_NO_TABLE_NAME#: No table name == No persistence manager and scripts required.

public abstract class BaseSearchHome extends SearchExecutor
{
    // Reference instance for the object
    public static final SearchHome REFERENCE_SearchHome = new SearchHome ();

    // Reference instance for the object
    public static final SearchHome DUMMY_SearchHome = new DummySearchHome ();

    // Static constants corresponding to field names
    
    public static final String FIELD_ShowAllJobs = "ShowAllJobs";
    public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
    public static final String SINGLEREFERENCE_CompanyUser = "CompanyUser";

    // Static constants corresponding to searches
    

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<SearchHome> HELPER_ShowAllJobs = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private Boolean _ShowAllJobs;
    

    // Private attributes corresponding to single references
    private SingleAssociation<SearchHome, HiringTeam> _HiringTeam;
    private SingleAssociation<SearchHome, CompanyUser> _CompanyUser;
    

    // Private attributes corresponding to multiple references
    

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

    // Arrays of validators for each attribute
    private static final AttributeValidator[] FIELD_ShowAllJobs_Validators;
    

    // Arrays of AttributeDecorators for each attribute
    private static final AttributeDecorator<SearchHome, Boolean>[] FIELD_ShowAllJobs_Decorators;
    
    
    // Arrays of SingleAssocDecorators for each attribute
    private static final SingleAssocDecorator<SearchHome, HiringTeam>[] SINGLEREFERENCE_HiringTeam_Decorators;
    private static final SingleAssocDecorator<SearchHome, CompanyUser>[] SINGLEREFERENCE_CompanyUser_Decorators;
    
    
    // Arrays of MultiAssocDecorators for each attribute
    

    // Arrays of behaviour decorators
    private static final SearchHomeBehaviourDecorator[] SearchHome_BehaviourDecorators;
    
    static
    {
        try
        {
            
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_HiringTeam();
            setupAssocMetaData_CompanyUser();
            FIELD_ShowAllJobs_Validators = (AttributeValidator[])setupAttribMetaData_ShowAllJobs(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ShowAllJobs_Decorators = (AttributeDecorator[])AttributeDecoratorUtils.getAttributeDecorators(REFERENCE_SearchHome, FIELD_ShowAllJobs).toArray (new AttributeDecorator[0]);
            SINGLEREFERENCE_HiringTeam_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_SearchHome, SINGLEREFERENCE_HiringTeam).toArray (new SingleAssocDecorator[0]);
            SINGLEREFERENCE_CompanyUser_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_SearchHome, SINGLEREFERENCE_CompanyUser).toArray (new SingleAssocDecorator[0]);
            

            REFERENCE_SearchHome.initialiseReference ();
            DUMMY_SearchHome.initialiseReference ();
            SearchHome_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(SearchHome.class).toArray(new SearchHomeBehaviourDecorator[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 ("dbcol", "xxxx");
        metaInfo.put ("name", "HiringTeam");
        metaInfo.put ("type", "HiringTeam");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHome.HiringTeam:", metaInfo);
        ATTRIBUTES_METADATA_SearchHome.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
    }
    
    
    private static void setupAssocMetaData_CompanyUser()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("dbcol", "xxxx");
        metaInfo.put ("name", "CompanyUser");
        metaInfo.put ("type", "CompanyUser");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHome.CompanyUser:", metaInfo);
        ATTRIBUTES_METADATA_SearchHome.put (SINGLEREFERENCE_CompanyUser, Collections.unmodifiableMap (metaInfo));
    }
    
    
    private static List setupAttribMetaData_ShowAllJobs(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "xxxx");
        metaInfo.put ("defaultValue", "Boolean.FALSE");
        metaInfo.put ("name", "ShowAllJobs");
        metaInfo.put ("type", "Boolean");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHome.ShowAllJobs:", metaInfo);
        ATTRIBUTES_METADATA_SearchHome.put (FIELD_ShowAllJobs, Collections.unmodifiableMap (metaInfo));

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

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


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

    


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

        
        _ShowAllJobs = (Boolean)(Boolean.FALSE);
    }


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

        _HiringTeam = new SingleAssociation<SearchHome, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
        _CompanyUser = new SingleAssociation<SearchHome, CompanyUser> (this, SINGLEREFERENCE_CompanyUser, null, CompanyUser.REFERENCE_CompanyUser, "");
        
    }


    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _HiringTeam = new SingleAssociation<SearchHome, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
        _CompanyUser = new SingleAssociation<SearchHome, CompanyUser> (this, SINGLEREFERENCE_CompanyUser, null, CompanyUser.REFERENCE_CompanyUser, "");
        
        
        return this;
    }


    /**
     * Attribute ShowAllJobs
     */
    public Boolean getShowAllJobs ()
    {
        assertValid();
        Boolean valToReturn = AttributeDecoratorUtils.getValue (FIELD_ShowAllJobs_Decorators, (SearchHome)this, FIELD_ShowAllJobs, _ShowAllJobs);

        
        for (SearchHomeBehaviourDecorator bhd : SearchHome_BehaviourDecorators)
        {
            valToReturn = bhd.getShowAllJobs ((SearchHome)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 preShowAllJobsChange (Boolean newShowAllJobs) 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 postShowAllJobsChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute ShowAllJobs.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setShowAllJobs (Boolean newShowAllJobs) throws FieldException
    {
        newShowAllJobs = AttributeDecoratorUtils.setValue (FIELD_ShowAllJobs_Decorators, (SearchHome)this, FIELD_ShowAllJobs, newShowAllJobs);

        boolean oldAndNewIdentical = HELPER_ShowAllJobs.compare (_ShowAllJobs, newShowAllJobs);
        
        try
        {
            for (SearchHomeBehaviourDecorator bhd : SearchHome_BehaviourDecorators)
            {
                newShowAllJobs = bhd.setShowAllJobs ((SearchHome)this, newShowAllJobs);
                oldAndNewIdentical = HELPER_ShowAllJobs.compare (_ShowAllJobs, newShowAllJobs);
            }

            

            if (FIELD_ShowAllJobs_Validators.length > 0)
            {
                Object newShowAllJobsObj = HELPER_ShowAllJobs.toObject (newShowAllJobs);

                if (newShowAllJobsObj != null)
                {
                    int     loopMax = FIELD_ShowAllJobs_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_SearchHome.get (FIELD_ShowAllJobs);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (FIELD_ShowAllJobs_Decorators, (SearchHome)this, FIELD_ShowAllJobs ,getWriteability_ShowAllJobs ()) != FieldWriteability.FALSE, "Field  ShowAllJobs is not writeable");
            preShowAllJobsChange (newShowAllJobs);
            markFieldChange (FIELD_ShowAllJobs);
            _ShowAllJobs = newShowAllJobs;            
            postFieldChange (FIELD_ShowAllJobs);
            postShowAllJobsChange ();
        }
    }



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

        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 if (assocName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return _CompanyUser.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 null ;
        }
        else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return null ;
        }
        else
        {
            return super.getSingleAssocBackReference (assocName);
        }
    }
    
    
    public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        else if (assocName.equals (SINGLEREFERENCE_HiringTeam))
        {
            return getHiringTeam ();
        }
        else if (assocName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return getCompanyUser ();
        }
        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 if (assocName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return getCompanyUser (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 if (assocName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return getCompanyUserID ();
        }
        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 if (assocName.equals (SINGLEREFERENCE_CompanyUser))
        {
            setCompanyUser ((CompanyUser)(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 SearchHome:", 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, (SearchHome)this, SINGLEREFERENCE_HiringTeam ,getWriteability_HiringTeam ()) != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
            preHiringTeamChange (newHiringTeam);
            
            _HiringTeam.set (newHiringTeam);
                
            postHiringTeamChange ();
        }
    }

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


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getCompanyUserID ()
    {
        assertValid();
        
        if (_CompanyUser == null)
        {
            return null;
        }
        else
        {
            return _CompanyUser.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 preCompanyUserChange (CompanyUser newCompanyUser) 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 postCompanyUserChange () throws FieldException
    {
    }


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

        
    /**
     * Set the reference CompanyUser.  Checks to ensure a new value
     * has been supplied.  If so, marks the reference as altered and sets it.
     */
    public void setCompanyUser (CompanyUser newCompanyUser) throws StorageException, FieldException
    {
        if (_CompanyUser.wouldReferencedChange (newCompanyUser))
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_CompanyUser_Decorators, (SearchHome)this, SINGLEREFERENCE_CompanyUser ,getWriteability_CompanyUser ()) != FieldWriteability.FALSE, "Assoc CompanyUser is not writeable");
            preCompanyUserChange (newCompanyUser);
            
            _CompanyUser.set (newCompanyUser);
                
            postCompanyUserChange ();
        }
    }

    /**
     * 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 
        {
        }
        catch (Exception e)
        {
            throw NestedException.wrap(e);
        }

        super.onDelete ();
    }


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


    public SearchHome referenceInstance ()
    {
        return REFERENCE_SearchHome;
    }


    public SearchHome getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getSearchHomeByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_SearchHome;
    }


    public String getBaseSetName ()
    {
        return "";
    }



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

        PSet.setAttrib (FIELD_ObjectID, myID);
        PSet.setAttrib (FIELD_ShowAllJobs, HELPER_ShowAllJobs.toObject (_ShowAllJobs)); //
        _HiringTeam.getPersistentSets (allSets);
        _CompanyUser.getPersistentSets (allSets);
        
    }


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

        _ShowAllJobs = (Boolean)(HELPER_ShowAllJobs.fromObject (_ShowAllJobs, PSet.getAttrib (FIELD_ShowAllJobs))); //
        _HiringTeam.setFromPersistentSets (objectID, allSets);
        _CompanyUser.setFromPersistentSets (objectID, allSets);
        
    }


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

        if (other instanceof SearchHome)
        {
            SearchHome otherSearchHome = (SearchHome)other;
            

            try
            {
                setShowAllJobs (otherSearchHome.getShowAllJobs ());
            }
            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 BaseSearchHome)
        {
            BaseSearchHome sourceSearchHome = (BaseSearchHome)(source);

            _ShowAllJobs = sourceSearchHome._ShowAllJobs;
            
        }
    }


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

            _HiringTeam.copyFrom (sourceSearchHome._HiringTeam, linkToGhosts);
            _CompanyUser.copyFrom (sourceSearchHome._CompanyUser, 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 BaseSearchHome)
        {
            BaseSearchHome sourceSearchHome = (BaseSearchHome)(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);

        _ShowAllJobs = (Boolean)(HELPER_ShowAllJobs.readExternal (_ShowAllJobs, vals.get(FIELD_ShowAllJobs))); //
        _HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
        _CompanyUser.readExternalData(vals.get(SINGLEREFERENCE_CompanyUser));
        
    }


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

        vals.put (FIELD_ShowAllJobs, HELPER_ShowAllJobs.writeExternal (_ShowAllJobs));
        vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
        vals.put (SINGLEREFERENCE_CompanyUser, _CompanyUser.writeExternalData());
        
    }


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

        if (other instanceof BaseSearchHome)
        {
            BaseSearchHome otherSearchHome = (BaseSearchHome)(other);

            
            if (!HELPER_ShowAllJobs.compare(this._ShowAllJobs, otherSearchHome._ShowAllJobs))
            {
                listener.notifyFieldChange(this, other, FIELD_ShowAllJobs, HELPER_ShowAllJobs.toObject(this._ShowAllJobs), HELPER_ShowAllJobs.toObject(otherSearchHome._ShowAllJobs));
            }

            // Compare single assocs
            _HiringTeam.compare (otherSearchHome._HiringTeam, listener);
            _CompanyUser.compare (otherSearchHome._CompanyUser, 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_ShowAllJobs, HELPER_ShowAllJobs.toObject(getShowAllJobs()));
        visitor.visitAssociation (_HiringTeam);
        visitor.visitAssociation (_CompanyUser);
        
    }


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

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


    public static SearchHome createSearchHome (ObjectTransaction transaction) throws StorageException
    {
        SearchHome     result = new SearchHome ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static SearchHome getSearchHomeByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (SearchHome)(transaction.getObjectByID (REFERENCE_SearchHome, objectID));
    }

    public boolean testFilter (String attribName, QueryFilter filter) throws StorageException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ShowAllJobs))
        {
            return filter.matches (getShowAllJobs ());
        }
        else if (attribName.equals (SINGLEREFERENCE_HiringTeam))
        {
            return filter.matches (getHiringTeam ());
        }
        else if (attribName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return filter.matches (getCompanyUser ());
        }
        else
        {
            return super.testFilter (attribName, filter);
        }
    }




    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ShowAllJobs))
        {
            return HELPER_ShowAllJobs.toObject (getShowAllJobs ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ShowAllJobs))
        {
            return HELPER_ShowAllJobs;
        }
        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_ShowAllJobs))
        {
            setShowAllJobs ((Boolean)(HELPER_ShowAllJobs.fromObject (_ShowAllJobs, 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_ShowAllJobs))
        {
            return getWriteability_ShowAllJobs ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_HiringTeam))
        {
            return getWriteability_HiringTeam ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_CompanyUser))
        {
            return getWriteability_CompanyUser ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        if (getWriteability_ShowAllJobs () != FieldWriteability.TRUE)
        {
            fields.add (FIELD_ShowAllJobs);
        }
        

        super.putUnwriteable (fields);
    }

    // This generally means there's no specific persistence manager and we don't read or write from a table
    public boolean hasNoTable()
    {
        return true;
    }


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

        
        result.add(HELPER_ShowAllJobs.getAttribObject (getClass (), _ShowAllJobs, false, FIELD_ShowAllJobs));

        return result;
    }


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


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

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

        copyInto.putAll(ATTRIBUTES_METADATA_SearchHome);
    }
            

    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 SearchHomeBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<SearchHome>
    {

    /**
     * Get the attribute ShowAllJobs
     */
    public Boolean getShowAllJobs (SearchHome obj, Boolean original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ShowAllJobs.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Boolean setShowAllJobs (SearchHome obj, Boolean newShowAllJobs) throws FieldException
    {
        return newShowAllJobs;
    }

    }

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

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

        public SearchHomePipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("ShowAllJobs"))
            {
                return toShowAllJobs ();
            }                
            if (name.equals ("HiringTeam"))
            {
                return toHiringTeam ();
            }                
            if (name.equals ("CompanyUser"))
            {
                return toCompanyUser ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Boolean> toShowAllJobs () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_ShowAllJobs));  }

        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 CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toCompanyUser () { return toCompanyUser (Filter.ALL); }

        public CompanyUser.CompanyUserPipeLineFactory<From, CompanyUser> toCompanyUser (Filter<CompanyUser> filter) 
        { 
            return CompanyUser.REFERENCE_CompanyUser.new CompanyUserPipeLineFactory<From, CompanyUser> (this, new ORMSingleAssocPipe<Me, CompanyUser>(SINGLEREFERENCE_CompanyUser, filter)); 
        }
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

class DummySearchHome extends SearchHome
{
    // Default constructor primarily to support Externalisable
    public DummySearchHome()
    {
        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();
    }

    public CompanyUser getCompanyUser () throws StorageException
    {
        return (CompanyUser)(CompanyUser.DUMMY_CompanyUser);
    }


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

}

    
