/* ======================================================================
   Parts Copyright 2006 University of Leeds, Oxford University, University of the Highlands and Islands.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

====================================================================== */

package org.bodington.assessment;

import java.sql.Timestamp;
import java.util.Enumeration;
import java.util.Vector;

import org.bodington.database.*;
import org.bodington.server.*;
import org.bodington.server.resources.*;

public class PigeonHole extends org.bodington.server.resources.Resource
	{
	
	private PrimaryKey pigeonhole_id;
	private int maximum_mark;
	private Timestamp date_open;
	private Timestamp date_deadline;
	private Timestamp date_penalty;
	
	private Vector questionsinorder;
	
	
    public Class sessionClass()
    	{
        // This method is derived from class org.bodington.server.resources.Resource
        // to do: code goes here
        return org.bodington.assessment.PigeonHoleSessionImpl.class;
    	}
    	

   	public static PigeonHole findPigeonHole( PrimaryKey key )
		throws BuildingServerException
		{
		return (PigeonHole)findPersistentObject( key, "org.bodington.assessment.PigeonHole" );
		}
	public static Enumeration findPigeonHoles( String where )
	    throws BuildingServerException
	    {
	    return findPersistentObjects( where, "org.bodington.assessment.PigeonHole" );
	    }
	public static Enumeration findPigeonHoles( String where, String order )
	    throws BuildingServerException
	    {
	    return findPersistentObjects( where, order, "org.bodington.assessment.PigeonHole" );
	    }
	    
	    
	    


    public PrimaryKey getPrimaryKey()
		{
        return getPigeonHoleId();
        }

    public void setPrimaryKey(PrimaryKey key)
    	{
    	setPigeonHoleId( key );
    	}
    	

    public PrimaryKey getPigeonHoleId()
		{
        return pigeonhole_id;
        }

    public void setPigeonHoleId(PrimaryKey key)
    	{
    	pigeonhole_id = key;
    	setResourceId( key );
    	setUnsaved();
    	}
    	
    	
	public int getMaximumMark()
		{
		return maximum_mark;
		}
    	
    	
    public void setMaximumMark( int n )
    	{
    	maximum_mark = n;
		setUnsaved();
    	}
    	
    	

	public Timestamp getDateOpen()
		{
		return date_open;
		}
		
	public void setDateOpen( Timestamp t )
		{
		if ( date_open==null && t==null )
			return;
		if ( date_open!=null && t != null )
			if ( date_open.equals( t ) )
				return;
		date_open= t;
		setUnsaved();
		}

	public Timestamp getDateDeadline()
		{
		return date_deadline;
		}
		
	public void setDateDeadline( Timestamp t )
		{
		if ( date_deadline==null && t==null )
			return;
		if ( date_deadline!=null && t != null )
			if ( date_deadline.equals( t ) )
				return;
		date_deadline = t;
		setUnsaved();
		}
		

	public Timestamp getDatePenalty()
		{
		return date_penalty;
		}
		
	public void setDatePenalty( Timestamp t )
		{
		if ( date_penalty==null && t==null )
			return;
		if ( date_penalty!=null && t != null )
			if ( date_penalty.equals( t ) )
				return;
		date_penalty = t;
		setUnsaved();
		}


    public int getResourceType()
    	{
    	return RESOURCE_PIGEONHOLE;
    	}
		
		
	}
