steve.pums.assess.process
Class ProjectService

java.lang.Object
  extended by steve.pums.assess.process.ProjectService

public class ProjectService
extends java.lang.Object

Provides methods for the registration and mainteneance of student projects


Constructor Summary
ProjectService(java.sql.Connection conn)
          Creates a new instance of ProjectService
 
Method Summary
 Project addProject(Project project)
          Registers a new project in the SUMS database
 java.lang.String alreadyAssigned(int newmarker, java.util.HashMap markers)
          Checks if a person is assigned to a Project as a marker
 java.util.Vector getAllocations(int person)
          Searches the projects held in the SUMS database associated with a particular staff member
 java.util.Vector getCohorts()
          Returns all cohorts for the project registration form
 int getMarkerType(java.lang.String type)
          Retrieves the ID of the marking capacity string
 java.util.Vector getStaff()
          Returns all staff for the project registration form
 java.util.Vector getStudentProjects(int student)
          Used to retrieve all projects assocaited with a particular student
 java.util.Vector getStudents()
          Returns all students for the project registration form
 java.util.Vector getUnits()
          Returns all units for the project registration form
 Project loadCoordinators(Project project)
          Loads details of the co-ordinators associated with the selected project
 Project loadMarkers(Project project)
          Retrieves details of the project markers from the SUMS database
 Project loadProject(Project project)
          Populates a Project with data retrieved from the SUMS database
 java.lang.String populateStudentTxt(java.lang.String studentid)
          Retrieves the student text field of the Project
 java.lang.String populateUnitTxt(java.lang.String unitid)
          Retrieves the student text field of the Project
 void saveProjectStatus(Project project, int userid)
          Saves changes in the project status (status code, mark and comments)
 Project setMarker(Project project, int person, java.lang.String type)
          Sets a person in a marking role for a specified project
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectService

public ProjectService(java.sql.Connection conn)
Creates a new instance of ProjectService

Parameters:
conn - SUMS database connection
Method Detail

getStudents

public java.util.Vector getStudents()
                             throws java.sql.SQLException
Returns all students for the project registration form

Returns:
Collection of students
Throws:
java.sql.SQLException - in the event of SQL errors

getCohorts

public java.util.Vector getCohorts()
                            throws java.sql.SQLException
Returns all cohorts for the project registration form

Returns:
Collection of cohorts
Throws:
java.sql.SQLException - in the event of SQL errors

getUnits

public java.util.Vector getUnits()
                          throws java.sql.SQLException
Returns all units for the project registration form

Returns:
Collection of units
Throws:
java.sql.SQLException - in the event of SQL errors

getStaff

public java.util.Vector getStaff()
                          throws java.sql.SQLException
Returns all staff for the project registration form

Returns:
Collection of staff
Throws:
java.sql.SQLException - in the event of SQL errors

addProject

public Project addProject(Project project)
                   throws java.sql.SQLException,
                          java.text.ParseException,
                          javax.mail.MessagingException,
                          jim.common.JimFatalException
Registers a new project in the SUMS database

Parameters:
project - the new project
Returns:
project populated with marker and other related information
Throws:
java.sql.SQLException - in the event of SQL errors
java.text.ParseException - in the event of date parsing error
javax.mail.MessagingException - As a result of error in sending emails
jim.common.JimFatalException - As a result of fatal exception

setMarker

public Project setMarker(Project project,
                         int person,
                         java.lang.String type)
                  throws java.sql.SQLException,
                         java.text.ParseException,
                         javax.mail.MessagingException,
                         jim.common.JimFatalException
Sets a person in a marking role for a specified project

Parameters:
project - Project to assign marker to
person - Person to assign as marker
type - Role to assign marker to
Returns:
Updated project
Throws:
java.sql.SQLException - In the event of SQL errors
javax.mail.MessagingException - As a result of errors in sending emails
java.text.ParseException - As a result of date parsing error
jim.common.JimFatalException - As a result of fatal exception

getMarkerType

public int getMarkerType(java.lang.String type)
                  throws java.sql.SQLException
Retrieves the ID of the marking capacity string

Parameters:
type - String identifier of marking role e.g. Supervisor
Returns:
ID of marker type
Throws:
java.sql.SQLException - As a result of SQL errors

loadProject

public Project loadProject(Project project)
                    throws java.sql.SQLException
Populates a Project with data retrieved from the SUMS database

Parameters:
project - Project to be populated
Returns:
Returns the populated project
Throws:
java.sql.SQLException - As a result of SQL error

loadMarkers

public Project loadMarkers(Project project)
                    throws java.sql.SQLException
Retrieves details of the project markers from the SUMS database

Parameters:
project - Project to load markers for
Returns:
Project with marker information populated
Throws:
java.sql.SQLException - In the event of SQL errors

loadCoordinators

public Project loadCoordinators(Project project)
                         throws java.sql.SQLException
Loads details of the co-ordinators associated with the selected project

Parameters:
project - Project to retrieve co-ordinators for
Returns:
Project with co-ordinator details inserted
Throws:
java.sql.SQLException - In the event of SQL errors

populateStudentTxt

public java.lang.String populateStudentTxt(java.lang.String studentid)
                                    throws java.sql.SQLException
Retrieves the student text field of the Project

Parameters:
studentid - ID of student
Returns:
Name of student
Throws:
java.sql.SQLException - In the event of SQL errors

populateUnitTxt

public java.lang.String populateUnitTxt(java.lang.String unitid)
                                 throws java.sql.SQLException
Retrieves the student text field of the Project

Parameters:
unitid - ID of unit
Returns:
Name of project unit
Throws:
java.sql.SQLException - In the event of SQL errors

saveProjectStatus

public void saveProjectStatus(Project project,
                              int userid)
                       throws java.sql.SQLException,
                              java.text.ParseException,
                              java.lang.Exception
Saves changes in the project status (status code, mark and comments)

Parameters:
project - Project to save status for
userid - User triggering state change
Throws:
java.sql.SQLException - In the event of SQL errors
java.text.ParseException - In the event of date parsing errors
java.lang.Exception - In the event of errors in sending emails

alreadyAssigned

public java.lang.String alreadyAssigned(int newmarker,
                                        java.util.HashMap markers)
Checks if a person is assigned to a Project as a marker

Parameters:
newmarker - ID of new marker
markers - Map of existing markers
Returns:
String of current capacity if marker already assigned, otherwise null

getAllocations

public java.util.Vector getAllocations(int person)
                                throws java.sql.SQLException
Searches the projects held in the SUMS database associated with a particular staff member

Parameters:
person - The ID of the staff member to retrieve marking allocations for
Returns:
Vector of Projects allocated to the staff member
Throws:
java.sql.SQLException - in the event of SQL errors

getStudentProjects

public java.util.Vector getStudentProjects(int student)
                                    throws java.sql.SQLException
Used to retrieve all projects assocaited with a particular student

Parameters:
student - ID of student
Returns:
Vector of student projects
Throws:
java.sql.SQLException - As a result of SQL errors