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

    
    package performa.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.*;



public abstract class BaseSearchHiringTeam extends SearchExecutor
{
    // Reference instance for the object
    public static final SearchHiringTeam REFERENCE_SearchHiringTeam = new SearchHiringTeam ();

    // Reference instance for the object
    public static final SearchHiringTeam DUMMY_SearchHiringTeam = new DummySearchHiringTeam ();

    // Static constants corresponding to field names
    
    public static final String FIELD_Details = "Details";

    // Static constants corresponding to searches
    

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

    // Private attributes corresponding to business object data
    private String _Details;
    

    // Private attributes corresponding to single references
    

    // Private attributes corresponding to multiple references
    

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

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

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

            FIELD_Details_Validators = (AttributeValidator[])setupAttribMetaData_Details(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_SearchHiringTeam.initialiseReference ();
            DUMMY_SearchHiringTeam.initialiseReference ();
            SearchHiringTeam_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(SearchHiringTeam.class).toArray(new SearchHiringTeamBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

    
    // Meta Info setup
    private static List setupAttribMetaData_Details(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "xxxx");
        metaInfo.put ("name", "Details");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for SearchHiringTeam.Details:", metaInfo);
        ATTRIBUTES_METADATA_SearchHiringTeam.put (FIELD_Details, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _Details = (String)(HELPER_Details.initialise (_Details));
    }


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

        
    }


    // Initialise the associations
    protected BaseBusinessClass initialiseReference ()
    {
        super.initialiseReference ();
        
        
        
        return this;
    }

    

    /**
     * Get the attribute Details
     */
    public String getDetails ()
    {
        assertValid();
        String valToReturn = _Details;

            for (SearchHiringTeamBehaviourDecorator bhd : SearchHiringTeam_BehaviourDecorators)
            {
                valToReturn = bhd.getDetails ((SearchHiringTeam)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 preDetailsChange (String newDetails) 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 postDetailsChange () throws FieldException
    {
    }

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

    /**
     * Set the attribute Details.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setDetails (String newDetails) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_Details.compare (_Details, newDetails);
        
        try
        {
            for (SearchHiringTeamBehaviourDecorator bhd : SearchHiringTeam_BehaviourDecorators)
            {
                newDetails = bhd.setDetails ((SearchHiringTeam)this, newDetails);
                oldAndNewIdentical = HELPER_Details.compare (_Details, newDetails);
            }

            

            if (FIELD_Details_Validators.length > 0)
            {
                Object newDetailsObj = HELPER_Details.toObject (newDetails);

                if (newDetailsObj != null)
                {
                    int     loopMax = FIELD_Details_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_SearchHiringTeam.get (FIELD_Details);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_Details () != FieldWriteability.FALSE, "Field  Details is not writeable");
            preDetailsChange (newDetails);
            markFieldChange (FIELD_Details);
            _Details = newDetails;            
            postFieldChange (FIELD_Details);
            postDetailsChange ();
        }
    }



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

        

        return result;
    }
    
    
    public BaseBusinessClass getSingleAssocReferenceInstance (String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssocReferenceInstance (assocName);
        }
    }


    public String getSingleAssocBackReference(String assocName)
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssocBackReference (assocName);
        }
    }
    
    
    public BaseBusinessClass getSingleAssoc (String assocName) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssoc (assocName);
        }
    }


    public BaseBusinessClass getSingleAssoc (String assocName, Get getType) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        else
        {
            return super.getSingleAssoc (assocName, getType);
        }
    }


    public Long getSingleAssocID (String assocName) throws StorageException
    {
        if (assocName == null)
        {
            throw new RuntimeException ("Game over == null!");
        }
        
        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
        {
            super.setSingleAssoc (assocName, newValue);
        }
    }



    /**
     * 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 SearchHiringTeam newInstance ()
    {
        return new SearchHiringTeam ();
    }


    public SearchHiringTeam referenceInstance ()
    {
        return REFERENCE_SearchHiringTeam;
    }


    public SearchHiringTeam getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getSearchHiringTeamByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_SearchHiringTeam;
    }


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





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

        it_does_not_matterPSet.setAttrib (FIELD_ObjectID, myID);
        it_does_not_matterPSet.setAttrib (FIELD_Details, HELPER_Details.toObject (_Details)); //
        
    }


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

        
        PersistentSet   it_does_not_matterPSet = allSets.getPersistentSet (objectID, "it_does_not_matter");

        _Details = (String)(HELPER_Details.fromObject (_Details, it_does_not_matterPSet.getAttrib (FIELD_Details))); //
        
    }





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

        if (other instanceof SearchHiringTeam)
        {
            SearchHiringTeam otherSearchHiringTeam = (SearchHiringTeam)other;
            
            try
            {
                setDetails (otherSearchHiringTeam.getDetails ());
            }
            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 BaseSearchHiringTeam)
        {
            BaseSearchHiringTeam sourceSearchHiringTeam = (BaseSearchHiringTeam)(source);

            _Details = sourceSearchHiringTeam._Details;
            
        }
    }


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

            
        }
    }


    /**
     * 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 BaseSearchHiringTeam)
        {
            BaseSearchHiringTeam sourceSearchHiringTeam = (BaseSearchHiringTeam)(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);

        _Details = (String)(HELPER_Details.readExternal (_Details, vals.get(FIELD_Details))); //
        
    }


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

        vals.put (FIELD_Details, HELPER_Details.writeExternal (_Details));
        
    }


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

        if (other instanceof BaseSearchHiringTeam)
        {
            BaseSearchHiringTeam otherSearchHiringTeam = (BaseSearchHiringTeam)(other);

            
            if (!HELPER_Details.compare(this._Details, otherSearchHiringTeam._Details))
            {
                listener.notifyFieldChange(this, other, FIELD_Details, HELPER_Details.toObject(this._Details), HELPER_Details.toObject(otherSearchHiringTeam._Details));
            }

            // Compare single assocs
            

            // 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_Details, HELPER_Details.toObject(getDetails()));
        
    }


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

        
    }


    public static SearchHiringTeam createSearchHiringTeam (ObjectTransaction transaction) throws StorageException
    {
        SearchHiringTeam     result = new SearchHiringTeam ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static SearchHiringTeam getSearchHiringTeamByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (SearchHiringTeam)(transaction.getObjectByID (REFERENCE_SearchHiringTeam, objectID));
    }

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




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


    public AttributeHelper getAttributeHelper (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_Details))
        {
            return HELPER_Details;
        }
        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_Details))
        {
            setDetails ((String)(HELPER_Details.fromObject (_Details, attribValue)));            
        }
        else
        {
            super.setAttribute (attribName, attribValue);
        }
    }



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


    public FieldWriteability getWriteable (String fieldName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (fieldName.equals (FIELD_Details))
        {
            return getWriteability_Details ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


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

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_Details.getAttribObject (getClass (), _Details, false, FIELD_Details));

        return result;
    }


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


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

    public void preCommit (boolean willBeStored) throws Exception
    {
        super.preCommit(willBeStored);
        
        if(willBeStored)
        {
        
        }
    }

    public oneit.servlets.objstore.binary.BinaryContentHandler getBinaryContentHandler(String attribName)
    {
        
        
        return super.getBinaryContentHandler(attribName);
    }

    public static class SearchHiringTeamBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<SearchHiringTeam>
    {

    /**
     * Get the attribute Details
     */
    public String getDetails (SearchHiringTeam obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute Details.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setDetails (SearchHiringTeam obj, String newDetails) throws FieldException
    {
        return newDetails;
    }

    }

    
    public ORMPipeLine pipes()
    {
        return new SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> ((SearchHiringTeam)this);
    }
      
    /**
     * Use this instead of pipes() to get rid of type casting.
     */  
    public SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipelineSearchHiringTeam()
    {
        return (SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam>) pipes();
    }
    
    public static SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipesSearchHiringTeam(Collection<SearchHiringTeam> items)
    {
        return REFERENCE_SearchHiringTeam.new SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> (items);
    }
    
    public static SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipesSearchHiringTeam(SearchHiringTeam[] _items)
    {
        return pipesSearchHiringTeam(Arrays.asList (_items));
    }
    
    public static SearchHiringTeamPipeLineFactory<SearchHiringTeam, SearchHiringTeam> pipesSearchHiringTeam()
    {
        return pipesSearchHiringTeam((Collection)null);
    }
    
    
    public class SearchHiringTeamPipeLineFactory<From extends BaseBusinessClass, Me extends SearchHiringTeam> extends SearchExecutorPipeLineFactory<From, Me>    
    {
        public <Prev> SearchHiringTeamPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public SearchHiringTeamPipeLineFactory (From seed)
        {
            super(seed);
        }

        public SearchHiringTeamPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("Details"))
            {
                return toDetails ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, String> toDetails () { return pipe(new ORMAttributePipe<Me, String>(FIELD_Details));  }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


}

    
