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

    
package performa.orm;

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

import oneit.servlets.orm.*;

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

public abstract class BaseHiringTeamLinkNPO extends NonPersistentBO
{
    // Reference instance for the object
    public static final HiringTeamLinkNPO REFERENCE_HiringTeamLinkNPO = new HiringTeamLinkNPO ();

    // Reference instance for the object
    public static final HiringTeamLinkNPO DUMMY_HiringTeamLinkNPO = new DummyHiringTeamLinkNPO ();

    // Static constants corresponding to field names
    
    public static final String SINGLEREFERENCE_HiringTeam = "HiringTeam";
    public static final String SINGLEREFERENCE_InviteTeammate = "InviteTeammate";
    public static final String BACKREF_InviteTeammate = "";

    // Static constants corresponding to searches
    

    // Static constants corresponding to attribute helpers
    

    // Private attributes corresponding to business object data
    

    // Private attributes corresponding to single references
    private SingleAssociation<HiringTeamLinkNPO, HiringTeam> _HiringTeam;
    private SingleAssociation<HiringTeamLinkNPO, InviteTeammateNPO> _InviteTeammate;
    

    // Private attributes corresponding to multiple references
    

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

    // Arrays of validators for each attribute
    

    // Arrays of AttributeDecorators for each attribute
    
    
    // Arrays of SingleAssocDecorators for each attribute
    private static final SingleAssocDecorator<HiringTeamLinkNPO, HiringTeam>[] SINGLEREFERENCE_HiringTeam_Decorators;
    private static final SingleAssocDecorator<HiringTeamLinkNPO, InviteTeammateNPO>[] SINGLEREFERENCE_InviteTeammate_Decorators;
    
    
    // Arrays of MultiAssocDecorators for each attribute
    

    // Arrays of behaviour decorators
    private static final HiringTeamLinkNPOBehaviourDecorator[] HiringTeamLinkNPO_BehaviourDecorators;
    
    static
    {
        try
        {
            
            String tmp_InviteTeammate = InviteTeammateNPO.BACKREF_HiringTeams;
            
            Map  validatorMapping = ((Map)ConfigMgr.getConfigObject ("CONFIG.ORMVALIDATOR", "ValidatorMapping"));

            setupAssocMetaData_HiringTeam();
            setupAssocMetaData_InviteTeammate();
            SINGLEREFERENCE_HiringTeam_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_HiringTeamLinkNPO, SINGLEREFERENCE_HiringTeam).toArray (new SingleAssocDecorator[0]);
            SINGLEREFERENCE_InviteTeammate_Decorators = (SingleAssocDecorator[])AttributeDecoratorUtils.getSingleAssocDecorators(REFERENCE_HiringTeamLinkNPO, SINGLEREFERENCE_InviteTeammate).toArray (new SingleAssocDecorator[0]);
            

            REFERENCE_HiringTeamLinkNPO.initialiseReference ();
            DUMMY_HiringTeamLinkNPO.initialiseReference ();
            HiringTeamLinkNPO_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(HiringTeamLinkNPO.class).toArray(new HiringTeamLinkNPOBehaviourDecorator[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 ("name", "HiringTeam");
        metaInfo.put ("type", "HiringTeam");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeamLinkNPO.HiringTeam:", metaInfo);
        ATTRIBUTES_METADATA_HiringTeamLinkNPO.put (SINGLEREFERENCE_HiringTeam, Collections.unmodifiableMap (metaInfo));
    }
    
    
    private static void setupAssocMetaData_InviteTeammate()
    {
        Map metaInfo = new HashMap ();

        metaInfo.put ("backreferenceName", "HiringTeams");
        metaInfo.put ("name", "InviteTeammate");
        metaInfo.put ("type", "InviteTeammateNPO");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeamLinkNPO.InviteTeammate:", metaInfo);
        ATTRIBUTES_METADATA_HiringTeamLinkNPO.put (SINGLEREFERENCE_InviteTeammate, Collections.unmodifiableMap (metaInfo));
    }
    
    
    // END OF STATIC METADATA DEFINITION    
    
    
    
    // This constructor should not be called
    protected BaseHiringTeamLinkNPO ()
    {
    }


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

    


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

        
    }


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

        _HiringTeam = new SingleAssociation<HiringTeamLinkNPO, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
        _InviteTeammate = new SingleAssociation<HiringTeamLinkNPO, InviteTeammateNPO> (this, SINGLEREFERENCE_InviteTeammate, InviteTeammateNPO.MULTIPLEREFERENCE_HiringTeams, InviteTeammateNPO.REFERENCE_InviteTeammateNPO, "");
        
    }


    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        _HiringTeam = new SingleAssociation<HiringTeamLinkNPO, HiringTeam> (this, SINGLEREFERENCE_HiringTeam, null, HiringTeam.REFERENCE_HiringTeam, "");
        _InviteTeammate = new SingleAssociation<HiringTeamLinkNPO, InviteTeammateNPO> (this, SINGLEREFERENCE_InviteTeammate, InviteTeammateNPO.MULTIPLEREFERENCE_HiringTeams, InviteTeammateNPO.REFERENCE_InviteTeammateNPO, "");
        
        
        return this;
    }




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

        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_InviteTeammate))
        {
            return _InviteTeammate.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_InviteTeammate))
        {
            return InviteTeammateNPO.MULTIPLEREFERENCE_HiringTeams ;
        }
        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_InviteTeammate))
        {
            return getInviteTeammate ();
        }
        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_InviteTeammate))
        {
            return getInviteTeammate (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_InviteTeammate))
        {
            return getInviteTeammateID ();
        }
        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_InviteTeammate))
        {
            setInviteTeammate ((InviteTeammateNPO)(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 HiringTeamLinkNPO:", 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, (HiringTeamLinkNPO)this, SINGLEREFERENCE_HiringTeam ,getWriteability_HiringTeam ()) != FieldWriteability.FALSE, "Assoc HiringTeam is not writeable");
            preHiringTeamChange (newHiringTeam);
            
            _HiringTeam.set (newHiringTeam);
                
            postHiringTeamChange ();
        }
    }

    /**
     * Get the reference InviteTeammate
     */
    public InviteTeammateNPO getInviteTeammate () throws StorageException
    {
        assertValid();
        
        try
        {
            return (InviteTeammateNPO)(_InviteTeammate.get ());
        }
        catch (ClassCastException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Cache collision in HiringTeamLinkNPO:", this.getObjectID (), ", was trying to get InviteTeammateNPO:",  getInviteTeammateID ());
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR2, "Instead I got:", _InviteTeammate.get ().getClass ());
            throw e;
        }
    }


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


    /**
     * Get the object id for the referenced object.  Does not force a DB access.
     */
    public Long getInviteTeammateID ()
    {
        assertValid();
        
        if (_InviteTeammate == null)
        {
            return null;
        }
        else
        {
            return _InviteTeammate.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 preInviteTeammateChange (InviteTeammateNPO newInviteTeammate) 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 postInviteTeammateChange () throws FieldException
    {
    }


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

        
    /**
     * Set the reference InviteTeammate.  Checks to ensure a new value
     * has been supplied.  If so, marks the reference as altered and sets it.
     */
    public void setInviteTeammate (InviteTeammateNPO newInviteTeammate) throws StorageException, FieldException
    {
        if (_InviteTeammate.wouldReferencedChange (newInviteTeammate))
        {
            assertValid();
            Debug.assertion (AttributeDecoratorUtils.getWriteability (SINGLEREFERENCE_InviteTeammate_Decorators, (HiringTeamLinkNPO)this, SINGLEREFERENCE_InviteTeammate ,getWriteability_InviteTeammate ()) != FieldWriteability.FALSE, "Assoc InviteTeammate is not writeable");
            preInviteTeammateChange (newInviteTeammate);
            InviteTeammateNPO oldInviteTeammate = getInviteTeammate ();

            if (oldInviteTeammate != null)
            {
                // This is to stop validation from triggering when we are removed
                _InviteTeammate.set (null);
                oldInviteTeammate.removeFromHiringTeams ((HiringTeamLinkNPO)(this));
            }

            _InviteTeammate.set (newInviteTeammate);

            if (newInviteTeammate != null)
            {
                newInviteTeammate.addToHiringTeams ((HiringTeamLinkNPO)(this));
            }
                
            postInviteTeammateChange ();
        }
    }

    /**
     * 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 (_InviteTeammate.isLoaded () || getTransaction ().isObjectLoaded (_InviteTeammate.getReferencedType (), getInviteTeammateID ()))
            {
                InviteTeammateNPO  referenced = getInviteTeammate ();

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

        super.onDelete ();
    }


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


    public HiringTeamLinkNPO referenceInstance ()
    {
        return REFERENCE_HiringTeamLinkNPO;
    }


    public HiringTeamLinkNPO getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getHiringTeamLinkNPOByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_HiringTeamLinkNPO;
    }


    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);
        _HiringTeam.getPersistentSets (allSets);
        _InviteTeammate.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, "");

        _HiringTeam.setFromPersistentSets (objectID, allSets);
        _InviteTeammate.setFromPersistentSets (objectID, allSets);
        
    }


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

        if (other instanceof HiringTeamLinkNPO)
        {
            HiringTeamLinkNPO otherHiringTeamLinkNPO = (HiringTeamLinkNPO)other;
            
        }
    }


    /**
     * Set the attributes in this to copies of the attributes in source.
     */
    public void copyAttributesFrom (BaseBusinessClass source)
    {
        super.copyAttributesFrom (source);

        if (source instanceof BaseHiringTeamLinkNPO)
        {
            BaseHiringTeamLinkNPO sourceHiringTeamLinkNPO = (BaseHiringTeamLinkNPO)(source);

            
        }
    }


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

            _HiringTeam.copyFrom (sourceHiringTeamLinkNPO._HiringTeam, linkToGhosts);
            _InviteTeammate.copyFrom (sourceHiringTeamLinkNPO._InviteTeammate, 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 BaseHiringTeamLinkNPO)
        {
            BaseHiringTeamLinkNPO sourceHiringTeamLinkNPO = (BaseHiringTeamLinkNPO)(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);

        _HiringTeam.readExternalData(vals.get(SINGLEREFERENCE_HiringTeam));
        _InviteTeammate.readExternalData(vals.get(SINGLEREFERENCE_InviteTeammate));
        
    }


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

        vals.put (SINGLEREFERENCE_HiringTeam, _HiringTeam.writeExternalData());
        vals.put (SINGLEREFERENCE_InviteTeammate, _InviteTeammate.writeExternalData());
        
    }


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

        if (other instanceof BaseHiringTeamLinkNPO)
        {
            BaseHiringTeamLinkNPO otherHiringTeamLinkNPO = (BaseHiringTeamLinkNPO)(other);

            

            // Compare single assocs
            _HiringTeam.compare (otherHiringTeamLinkNPO._HiringTeam, listener);
            _InviteTeammate.compare (otherHiringTeamLinkNPO._InviteTeammate, 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.visitAssociation (_HiringTeam);
        visitor.visitAssociation (_InviteTeammate);
        
    }


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

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


    public static HiringTeamLinkNPO createHiringTeamLinkNPO (ObjectTransaction transaction) throws StorageException
    {
        HiringTeamLinkNPO     result = new HiringTeamLinkNPO ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static HiringTeamLinkNPO getHiringTeamLinkNPOByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (HiringTeamLinkNPO)(transaction.getObjectByID (REFERENCE_HiringTeamLinkNPO, objectID));
    }

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




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


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else
        {
            return super.getAttributeHelper (attribName);
        }
    }


    public void setAttribute (String attribName, Object attribValue) throws FieldException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        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 (SINGLEREFERENCE_HiringTeam))
        {
            return getWriteability_HiringTeam ();
        }
        else if (fieldName.equals (SINGLEREFERENCE_InviteTeammate))
        {
            return getWriteability_InviteTeammate ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {

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

        

        return result;
    }


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


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

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

        copyInto.putAll(ATTRIBUTES_METADATA_HiringTeamLinkNPO);
    }
            

    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 HiringTeamLinkNPOBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<HiringTeamLinkNPO>
    {

    }

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

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

        public HiringTeamLinkNPOPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("HiringTeam"))
            {
                return toHiringTeam ();
            }                
            if (name.equals ("InviteTeammate"))
            {
                return toInviteTeammate ();
            }                
            
            
            return super.to(name);
        }
        

        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 InviteTeammateNPO.InviteTeammateNPOPipeLineFactory<From, InviteTeammateNPO> toInviteTeammate () { return toInviteTeammate (Filter.ALL); }

        public InviteTeammateNPO.InviteTeammateNPOPipeLineFactory<From, InviteTeammateNPO> toInviteTeammate (Filter<InviteTeammateNPO> filter) 
        { 
            return InviteTeammateNPO.REFERENCE_InviteTeammateNPO.new InviteTeammateNPOPipeLineFactory<From, InviteTeammateNPO> (this, new ORMSingleAssocPipe<Me, InviteTeammateNPO>(SINGLEREFERENCE_InviteTeammate, filter)); 
        }
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

class DummyHiringTeamLinkNPO extends HiringTeamLinkNPO
{
    // Default constructor primarily to support Externalisable
    public DummyHiringTeamLinkNPO()
    {
        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 InviteTeammateNPO getInviteTeammate () throws StorageException
    {
        return (InviteTeammateNPO)(InviteTeammateNPO.DUMMY_InviteTeammateNPO);
    }


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

}

    
