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

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

import oneit.security.*;



public abstract class BaseAdminUser extends SecUserExtension
{
    // Reference instance for the object
    public static final AdminUser REFERENCE_AdminUser = new AdminUser ();

    // Reference instance for the object
    public static final AdminUser DUMMY_AdminUser = new DummyAdminUser ();

    // Static constants corresponding to field names
    
    public static final String FIELD_ForgotPasswordMailSendDate = "ForgotPasswordMailSendDate";
    public static final String FIELD_ForgotPasswordKey = "ForgotPasswordKey";

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

    // Static constants corresponding to attribute helpers
    private static final DefaultAttributeHelper<AdminUser> HELPER_ForgotPasswordMailSendDate = DefaultAttributeHelper.INSTANCE;
    private static final DefaultAttributeHelper<AdminUser> HELPER_ForgotPasswordKey = DefaultAttributeHelper.INSTANCE;
    

    // Private attributes corresponding to business object data
    private Date _ForgotPasswordMailSendDate;
    private String _ForgotPasswordKey;
    

    // Private attributes corresponding to single references
    

    // Private attributes corresponding to multiple references
    

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

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

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

            FIELD_ForgotPasswordMailSendDate_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordMailSendDate(validatorMapping).toArray (new AttributeValidator[0]);
            FIELD_ForgotPasswordKey_Validators = (AttributeValidator[])setupAttribMetaData_ForgotPasswordKey(validatorMapping).toArray (new AttributeValidator[0]);
            

            REFERENCE_AdminUser.initialiseReference ();
            DUMMY_AdminUser.initialiseReference ();
            AdminUser_BehaviourDecorators = BaseBusinessClass.getBBCBehaviours(AdminUser.class).toArray(new AdminUserBehaviourDecorator[0]);
        }
        catch (RuntimeException e)
        {
            LogMgr.log (BUSINESS_OBJECTS, LogLevel.SYSTEMERROR1, e, "Error initialising");
            throw e;
        }
    }

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

        metaInfo.put ("dbcol", "forgot_password_mail_send_date");
        metaInfo.put ("name", "ForgotPasswordMailSendDate");
        metaInfo.put ("type", "Date");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AdminUser.ForgotPasswordMailSendDate:", metaInfo);
        ATTRIBUTES_METADATA_AdminUser.put (FIELD_ForgotPasswordMailSendDate, Collections.unmodifiableMap (metaInfo));

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

        return validators;
    }
    
    // Meta Info setup
    private static List setupAttribMetaData_ForgotPasswordKey(Map validatorMapping)
    {
        Map  metaInfo   = new HashMap ();

        metaInfo.put ("dbcol", "forgot_password_key");
        metaInfo.put ("length", "10");
        metaInfo.put ("name", "ForgotPasswordKey");
        metaInfo.put ("type", "String");
        
        LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for AdminUser.ForgotPasswordKey:", metaInfo);
        ATTRIBUTES_METADATA_AdminUser.put (FIELD_ForgotPasswordKey, Collections.unmodifiableMap (metaInfo));

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

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


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


    


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

        
        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.initialise (_ForgotPasswordMailSendDate));
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.initialise (_ForgotPasswordKey));
    }


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

        
    }


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

    

    /**
     * Get the attribute ForgotPasswordMailSendDate
     */
    public Date getForgotPasswordMailSendDate ()
    {
        assertValid();
        Date valToReturn = _ForgotPasswordMailSendDate;

            for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
            {
                valToReturn = bhd.getForgotPasswordMailSendDate ((AdminUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

    /**
     * Set the attribute ForgotPasswordMailSendDate.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setForgotPasswordMailSendDate (Date newForgotPasswordMailSendDate) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ForgotPasswordMailSendDate.compare (_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);
        
        try
        {
            for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
            {
                newForgotPasswordMailSendDate = bhd.setForgotPasswordMailSendDate ((AdminUser)this, newForgotPasswordMailSendDate);
                oldAndNewIdentical = HELPER_ForgotPasswordMailSendDate.compare (_ForgotPasswordMailSendDate, newForgotPasswordMailSendDate);
            }

            

            if (FIELD_ForgotPasswordMailSendDate_Validators.length > 0)
            {
                Object newForgotPasswordMailSendDateObj = HELPER_ForgotPasswordMailSendDate.toObject (newForgotPasswordMailSendDate);

                if (newForgotPasswordMailSendDateObj != null)
                {
                    int     loopMax = FIELD_ForgotPasswordMailSendDate_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_AdminUser.get (FIELD_ForgotPasswordMailSendDate);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.FALSE, "Field  ForgotPasswordMailSendDate is not writeable");
            preForgotPasswordMailSendDateChange (newForgotPasswordMailSendDate);
            markFieldChange (FIELD_ForgotPasswordMailSendDate);
            _ForgotPasswordMailSendDate = newForgotPasswordMailSendDate;            
            postFieldChange (FIELD_ForgotPasswordMailSendDate);
            postForgotPasswordMailSendDateChange ();
        }
    }

    /**
     * Get the attribute ForgotPasswordKey
     */
    public String getForgotPasswordKey ()
    {
        assertValid();
        String valToReturn = _ForgotPasswordKey;

            for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
            {
                valToReturn = bhd.getForgotPasswordKey ((AdminUser)this, valToReturn);
            }
            
            return valToReturn;
        
    }


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


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

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

    /**
     * Set the attribute ForgotPasswordKey.  Checks to ensure a new value
     * has been supplied.  If so, marks the field as altered and sets the attribute.
     */
    public void setForgotPasswordKey (String newForgotPasswordKey) throws FieldException
    {
        boolean oldAndNewIdentical = HELPER_ForgotPasswordKey.compare (_ForgotPasswordKey, newForgotPasswordKey);
        
        try
        {
            for (AdminUserBehaviourDecorator bhd : AdminUser_BehaviourDecorators)
            {
                newForgotPasswordKey = bhd.setForgotPasswordKey ((AdminUser)this, newForgotPasswordKey);
                oldAndNewIdentical = HELPER_ForgotPasswordKey.compare (_ForgotPasswordKey, newForgotPasswordKey);
            }

            

            if (FIELD_ForgotPasswordKey_Validators.length > 0)
            {
                Object newForgotPasswordKeyObj = HELPER_ForgotPasswordKey.toObject (newForgotPasswordKey);

                if (newForgotPasswordKeyObj != null)
                {
                    int     loopMax = FIELD_ForgotPasswordKey_Validators.length;
                    Map     metadata = (Map)ATTRIBUTES_METADATA_AdminUser.get (FIELD_ForgotPasswordKey);

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

        if (!oldAndNewIdentical)
        {
            assertValid();
            Debug.assertion (getWriteability_ForgotPasswordKey () != FieldWriteability.FALSE, "Field  ForgotPasswordKey is not writeable");
            preForgotPasswordKeyChange (newForgotPasswordKey);
            markFieldChange (FIELD_ForgotPasswordKey);
            _ForgotPasswordKey = newForgotPasswordKey;            
            postFieldChange (FIELD_ForgotPasswordKey);
            postForgotPasswordKeyChange ();
        }
    }



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


    public AdminUser referenceInstance ()
    {
        return REFERENCE_AdminUser;
    }


    public AdminUser getInTransaction (ObjectTransaction t) throws StorageException
    {
        return getAdminUserByID (t, getObjectID());
    }
    
    
    public BaseBusinessClass dummyInstance ()
    {
        return DUMMY_AdminUser;
    }


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





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

        super.getPersistentSets (allSets);

        
        PersistentSet   oneit_sec_user_extensionPSet = allSets.getPersistentSet (myID, "oneit_sec_user_extension", myPSetStatus);

        oneit_sec_user_extensionPSet.setAttrib (FIELD_ObjectID, myID);
        oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject (_ForgotPasswordMailSendDate)); //
        oneit_sec_user_extensionPSet.setAttrib (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject (_ForgotPasswordKey)); //
        
    }


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

        
        PersistentSet   oneit_sec_user_extensionPSet = allSets.getPersistentSet (objectID, "oneit_sec_user_extension");

        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordMailSendDate))); //
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, oneit_sec_user_extensionPSet.getAttrib (FIELD_ForgotPasswordKey))); //
        
    }





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

        if (other instanceof AdminUser)
        {
            AdminUser otherAdminUser = (AdminUser)other;
            
            try
            {
                setForgotPasswordMailSendDate (otherAdminUser.getForgotPasswordMailSendDate ());
            }
            catch (FieldException ex)
            {
                e.addException (ex);
            }
            
            try
            {
                setForgotPasswordKey (otherAdminUser.getForgotPasswordKey ());
            }
            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 BaseAdminUser)
        {
            BaseAdminUser sourceAdminUser = (BaseAdminUser)(source);

            _ForgotPasswordMailSendDate = sourceAdminUser._ForgotPasswordMailSendDate;
            _ForgotPasswordKey = sourceAdminUser._ForgotPasswordKey;
            
        }
    }


    /**
     * 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 BaseAdminUser)
        {
            BaseAdminUser sourceAdminUser = (BaseAdminUser)(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 BaseAdminUser)
        {
            BaseAdminUser sourceAdminUser = (BaseAdminUser)(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);

        _ForgotPasswordMailSendDate = (Date)(HELPER_ForgotPasswordMailSendDate.readExternal (_ForgotPasswordMailSendDate, vals.get(FIELD_ForgotPasswordMailSendDate))); //
        _ForgotPasswordKey = (String)(HELPER_ForgotPasswordKey.readExternal (_ForgotPasswordKey, vals.get(FIELD_ForgotPasswordKey))); //
        
    }


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

        vals.put (FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.writeExternal (_ForgotPasswordMailSendDate));
        vals.put (FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.writeExternal (_ForgotPasswordKey));
        
    }


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

        if (other instanceof BaseAdminUser)
        {
            BaseAdminUser otherAdminUser = (BaseAdminUser)(other);

            
            if (!HELPER_ForgotPasswordMailSendDate.compare(this._ForgotPasswordMailSendDate, otherAdminUser._ForgotPasswordMailSendDate))
            {
                listener.notifyFieldChange(this, other, FIELD_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(this._ForgotPasswordMailSendDate), HELPER_ForgotPasswordMailSendDate.toObject(otherAdminUser._ForgotPasswordMailSendDate));
            }
            if (!HELPER_ForgotPasswordKey.compare(this._ForgotPasswordKey, otherAdminUser._ForgotPasswordKey))
            {
                listener.notifyFieldChange(this, other, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(this._ForgotPasswordKey), HELPER_ForgotPasswordKey.toObject(otherAdminUser._ForgotPasswordKey));
            }

            // 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_ForgotPasswordMailSendDate, HELPER_ForgotPasswordMailSendDate.toObject(getForgotPasswordMailSendDate()));
        visitor.visitField(this, FIELD_ForgotPasswordKey, HELPER_ForgotPasswordKey.toObject(getForgotPasswordKey()));
        
    }


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

        
    }


    public static AdminUser createAdminUser (ObjectTransaction transaction) throws StorageException
    {
        AdminUser     result = new AdminUser ();

        result.initialiseNewObject (transaction);

        return result;
    }


    public static AdminUser getAdminUserByID (ObjectTransaction transaction, Long objectID) throws StorageException
    {
        return (AdminUser)(transaction.getObjectByID (REFERENCE_AdminUser, objectID));
    }

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


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

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

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

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

            
            public SearchAll andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchAll andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchAll andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
                public AdminUser[]
             search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_AdminUser, SEARCH_All, criteria);
            Set<AdminUser>   typedResults = new LinkedHashSet <AdminUser> ();
            for (BaseBusinessClass bbcResult : results)
            {
                AdminUser aResult = (AdminUser)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return ObjstoreUtils.removeDeleted(transaction, typedResults).toArray (new AdminUser[0]);
                            
        }
    }

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

    public static SearchIdPin SearchByIdPin () { return new SearchIdPin (); }

    public static class SearchIdPin extends SearchObject<AdminUser>
    {
        
        public SearchIdPin byID (Long ID)
        {
            by ("ID", ID);
            return this;
        }
        
        public SearchIdPin byPin (String Pin)
        {
            by ("Pin", Pin);
            return this;
        }
        
            public SearchIdPin andObjectID (QueryFilter<Long> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.object_id", FIELD_ObjectID);
                return this;
            }

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

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

            
            public SearchIdPin andForgotPasswordMailSendDate (QueryFilter<Date> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_mail_send_date", "ForgotPasswordMailSendDate");
                return this;
            }
            
            public SearchIdPin andForgotPasswordKey (QueryFilter<String> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.forgot_password_key", "ForgotPasswordKey");
                return this;
            }
            
            public SearchIdPin andUser (QueryFilter<SecUser> filter)
            {
                filter.addFilter (context, "oneit_sec_user_extension.user_id", "User");
                return this;
            }
            
                public AdminUser search (ObjectTransaction transaction) throws StorageException
        {
            
            
            BaseBusinessClass[]     results = super.search (transaction, REFERENCE_AdminUser, SEARCH_IdPin, criteria);
            Set<AdminUser>   typedResults = new LinkedHashSet <AdminUser> ();
            for (BaseBusinessClass bbcResult : results)
            {
                AdminUser aResult = (AdminUser)bbcResult;
                
                typedResults.add (aResult);
            }
            
                    return (AdminUser)singletonResult(ObjstoreUtils.removeDeleted(transaction, typedResults).toArray(new BaseBusinessClass[0]), "AdminUser", "");
                            
        }
    }

        
                public static AdminUser searchIdPin (ObjectTransaction transaction, Long ID, String Pin) throws StorageException
        {
            return SearchByIdPin ()
            .byID  (ID)
            .byPin  (Pin)
            .search (transaction);
        }



    public Object getAttribute (String attribName)
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            return HELPER_ForgotPasswordMailSendDate.toObject (getForgotPasswordMailSendDate ());
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            return HELPER_ForgotPasswordKey.toObject (getForgotPasswordKey ());
        }
        else
        {
            return super.getAttribute (attribName);
        }
    }


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


    public void setAttribute (String attribName, Object attribValue) throws FieldException
    {
        if (false)
        {
            throw new RuntimeException ("Game over man!!");
        }
        else if (attribName.equals (FIELD_ForgotPasswordMailSendDate))
        {
            setForgotPasswordMailSendDate ((Date)(HELPER_ForgotPasswordMailSendDate.fromObject (_ForgotPasswordMailSendDate, attribValue)));            
        }
        else if (attribName.equals (FIELD_ForgotPasswordKey))
        {
            setForgotPasswordKey ((String)(HELPER_ForgotPasswordKey.fromObject (_ForgotPasswordKey, attribValue)));            
        }
        else
        {
            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_ForgotPasswordMailSendDate))
        {
            return getWriteability_ForgotPasswordMailSendDate ();
        }
        else if (fieldName.equals (FIELD_ForgotPasswordKey))
        {
            return getWriteability_ForgotPasswordKey ();
        }
        else
        {
            return super.getWriteable (fieldName);
        }
    }


    public void putUnwriteable (Set<String> fields)
    {
        
            if (getWriteability_ForgotPasswordMailSendDate () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ForgotPasswordMailSendDate);
            }
        
            if (getWriteability_ForgotPasswordKey () != FieldWriteability.TRUE)
            {
                fields.add (FIELD_ForgotPasswordKey);
            }
        

        super.putUnwriteable (fields);
    }

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

        
        result.add(HELPER_ForgotPasswordMailSendDate.getAttribObject (getClass (), _ForgotPasswordMailSendDate, false, FIELD_ForgotPasswordMailSendDate));
        result.add(HELPER_ForgotPasswordKey.getAttribObject (getClass (), _ForgotPasswordKey, false, FIELD_ForgotPasswordKey));

        return result;
    }


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


    public Object getAttributeMetadata (String attribute, String metadata)
    {
        if (ATTRIBUTES_METADATA_AdminUser.containsKey (attribute))
        {
            return ((Map)ATTRIBUTES_METADATA_AdminUser.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 AdminUserBehaviourDecorator extends BaseBusinessClass.BBCBehaviourDecorator<AdminUser>
    {

    /**
     * Get the attribute ForgotPasswordMailSendDate
     */
    public Date getForgotPasswordMailSendDate (AdminUser obj, Date original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ForgotPasswordMailSendDate.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public Date setForgotPasswordMailSendDate (AdminUser obj, Date newForgotPasswordMailSendDate) throws FieldException
    {
        return newForgotPasswordMailSendDate;
    }

    /**
     * Get the attribute ForgotPasswordKey
     */
    public String getForgotPasswordKey (AdminUser obj, String original)
    {
        return original;
    }

    /**
     * Change the value set for attribute ForgotPasswordKey.
     * May modify the field beforehand
     * Occurs before validation.
     */
    public String setForgotPasswordKey (AdminUser obj, String newForgotPasswordKey) throws FieldException
    {
        return newForgotPasswordKey;
    }

    }

    
    public ORMPipeLine pipes()
    {
        return new AdminUserPipeLineFactory<AdminUser, AdminUser> ((AdminUser)this);
    }
      
    /**
     * Use this instead of pipes() to get rid of type casting.
     */  
    public AdminUserPipeLineFactory<AdminUser, AdminUser> pipelineAdminUser()
    {
        return (AdminUserPipeLineFactory<AdminUser, AdminUser>) pipes();
    }
    
    public static AdminUserPipeLineFactory<AdminUser, AdminUser> pipesAdminUser(Collection<AdminUser> items)
    {
        return REFERENCE_AdminUser.new AdminUserPipeLineFactory<AdminUser, AdminUser> (items);
    }
    
    public static AdminUserPipeLineFactory<AdminUser, AdminUser> pipesAdminUser(AdminUser[] _items)
    {
        return pipesAdminUser(Arrays.asList (_items));
    }
    
    public static AdminUserPipeLineFactory<AdminUser, AdminUser> pipesAdminUser()
    {
        return pipesAdminUser((Collection)null);
    }
    
    
    public class AdminUserPipeLineFactory<From extends BaseBusinessClass, Me extends AdminUser> extends SecUserExtensionPipeLineFactory<From, Me>    
    {
        public <Prev> AdminUserPipeLineFactory (PipeLine<From, Prev> pipeLine, Pipe<Prev, Me> nextPipe)
        {
            super (pipeLine, nextPipe);
        }
        
        public AdminUserPipeLineFactory (From seed)
        {
            super(seed);
        }

        public AdminUserPipeLineFactory (Collection<From> seed)
        {
            super(seed);
        }
        
        
        public PipeLine<From, ? extends Object> to(String name)
        {
            if (name.equals ("ForgotPasswordMailSendDate"))
            {
                return toForgotPasswordMailSendDate ();
            }                
            if (name.equals ("ForgotPasswordKey"))
            {
                return toForgotPasswordKey ();
            }                
            
            
            return super.to(name);
        }
        
        
        public PipeLine<From, Date> toForgotPasswordMailSendDate () { return pipe(new ORMAttributePipe<Me, Date>(FIELD_ForgotPasswordMailSendDate));  }
        
        public PipeLine<From, String> toForgotPasswordKey () { return pipe(new ORMAttributePipe<Me, String>(FIELD_ForgotPasswordKey));  }
        
    }
    
    public boolean isTransientAttrib(String attribName)
    {
        

        return super.isTransientAttrib(attribName);
    }

    public boolean isTransientSingleReference(String assocName)
    {
        

        return super.isTransientSingleReference(assocName);
    }
}

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

    public void assertValid ()
    {
    }


}

    
