kotkabeans
Class cSQL

java.lang.Object
  |
  +--kotkabeans.cSQL

public class cSQL
extends java.lang.Object

Stores SQL-sentences used by another beans.


Constructor Summary
cSQL()
          Dummy empty constructor, does nothing.
 
Method Summary
static java.lang.String addNewFunction(java.lang.String courseID, java.lang.String name, java.lang.String description, int usergroupid)
          Returns SQL-sentence that adds new evaluationfunction to course.
static java.lang.String addNewTable(java.lang.String courseID, java.lang.String name, java.util.Hashtable points)
          Returns SQL-sentence that adds new evaluationtable to course.
static java.lang.String changeFunction(java.lang.String courseID, java.lang.String function)
          Returns SQL-sentence that updates course's evaluationfunction.
static java.lang.String changeFunctionAttributes(java.lang.String courseID, java.lang.String filename, java.lang.String name, java.lang.String description, int usergroupid)
          Returns SQL-sentence that updates usergroup of course's function.
static java.lang.String changeFunctionUsergroup(java.lang.String courseID, java.lang.String functionFilename, int usergroupid)
          Returns SQL-sentence that updates usergroup of course's function.
static boolean deleteGrade(int studentID, java.lang.String courseID)
           
static int evaluatedStudents(java.lang.String courseID)
          Retrieves amount of course's students that have been evaluated.
static java.lang.String exceptionalJore(java.lang.String courseID)
          Deprecated. 3.10.2002 by KK -no use for this method(?)
static java.lang.String exceptionalStudent(int studentID)
          Returns file extension where to add student if student is exceptional.
static RS2 getAccessRightLevels(User user)
          Returns all accessrightlevels & ids with user's language
static java.lang.String getAllFields(java.lang.String courseID, java.lang.String students, java.lang.String fieldNames)
          Returns SQL-sentence that gets course's students' wanted fields.
static RS2 getAllFunctions()
          Retrieves all evaluation functions from DB.
static java.util.ArrayList getAllowedGrades()
          Fetches all allowed gradenames (a.k.a. belongsingroup<5) from db.
static RS2 getAllTables()
          Retrieves all evaluation tables from DB and returns them in RS2 object
static RS2 getAllTranslationPages()
          Returns all pages from translationkey table.
static java.util.Hashtable getAllTranslations()
          Gets all translations from database and returns them in Hashtable (langID_FinnisText as key-value)
static java.util.ArrayList getArvosanat(int tableType, int langID)
          Gets grades and returns them in ArrayList.
static java.lang.String getCalculatePoints()
          Deprecated. 23.9.2002 by KK
static java.lang.String getCandidates(java.lang.String courseID, int langID)
           
static java.util.ArrayList getChangedFinished(java.lang.String courseID, int langID)
          Deprecated. 3.10.2002 by KK
static RS2 getChangedFinishedStudents(java.lang.String courseID, int langID)
          Retrieves from DB students who have finished course and/or whose finished data has changed since last evaluation.
static java.lang.String getCode(java.lang.String courseID)
          Deprecated. 25.9.2002 by KK
static java.lang.String getCourseCode(java.lang.String courseID)
          Retrieves course's code from DB.
static RS2 getCourseData(int courseID, int langID)
           
static java.util.ArrayList getCourseEvaltables(java.lang.String courseID)
          Deprecated. 3.10.2002 by KK -no new version yet!
static RS2 getCourseEvaluationtables(java.lang.String courseID)
          Returns course's evaluation tables in RS2 object.
static java.lang.String getCourseFunctions(java.lang.String courseID)
          Returns SQL-sentence that gets all evaluation functions defined to course.
static java.lang.String getCourseFunctions(java.lang.String courseID, int personID)
          Returns SQL-sentence that gets evaluationfunctions defined to course that person can use.
static java.lang.String getCourseName(int courseID, int langID)
           
static RS2 getCourseObjectgroups(int courseID)
           
static RS2 getCourseObjectgroups(java.lang.String courseID)
           
static int getCoursepartisipants(java.lang.String courseID, java.lang.String usergroups)
          Returns SQL-sentence that gets count of course's participants.
static RS2 getCourseTeachers(java.lang.String courseID)
          Return course instance's teachers in RS2 object.
static java.lang.String getCourseTime(java.lang.String courseInstanceID)
           
static java.lang.String getEvalFunction(java.lang.String courseID)
          Deprecated. 25.9.2002 KK
static java.lang.String getEvalTable(java.lang.String courseID)
          Deprecated. 30.9.2002 by KK
static java.lang.String getEvalTableName(java.lang.String tableID)
          Deprecated. 4.10.2002 by KK
static java.lang.String getEvaluationFunction(java.lang.String courseID)
          Retrieves course's evaluation function from DB and returns it's filename.
static java.lang.String getEvaluationFunctionName(java.lang.String courseID)
          Retrieves name of course's evaluation function from db.
static java.lang.String getEvaluationFunctions()
          Deprecated. 25.9.2002 by KK
static RS2 getEvaluationTable(java.lang.String courseID)
          Retrieves course's evaluation table from DB and returns it's name and id in RS2 object
static java.lang.String getEvaluationTableName(java.lang.String tableID)
          Retrieves name of the certain evaluation table.
static int getFieldID(java.lang.String courseID, java.lang.String fieldName)
          Gets wanted field's id.
static RS2 getFieldName(java.lang.String fieldID, int langID)
          Returns SQL-sentence that gets wanted fields' names in certain language.
static java.lang.String getFieldValue(int studentID, java.lang.String courseID, java.lang.String fieldName)
          Returns SQL-sentence that gets course's field's value for student.
static java.lang.String getFinished(java.lang.String courseID)
          Returns SQL-sentence that retrieves students who have finished course.
static RS2 getFinTexts(java.lang.String page)
          Returns finnish text in certain page
static java.lang.String getFunctionFilename(java.lang.String courseID, java.lang.String name)
          Deprecated. 4.10.2002 by KK
static java.lang.String getFunctionFileName(java.lang.String courseID, java.lang.String name)
          Retrieves course's certain evaluation function's filename from DB
static java.lang.String getFunctionID(java.lang.String courseID, java.lang.String name)
          Returns SQL-sentence that .
static java.lang.String getFunctionName(java.lang.String functionFilename)
           
static java.lang.String getFunctions()
          Deprecated. 25.9.2002 by KK
static java.lang.String getFunctionUsergroup(java.lang.String courseID, java.lang.String functionFilename)
          Returns SQL-sentence that gets usergroup of course's function.
static java.lang.String getGrade(double points, int language, java.lang.String table)
          Deprecated. 25.9.2002 by KK
static java.lang.String getGrade(int studentID, java.lang.String courseID, int langID)
          Returns SQL-sentence that gets student's grade for the course.
static java.lang.String getGradeName(double points, int languageID, java.lang.String tableID)
          Retrieves grade corresponding to given points in given language in certain calculatepointstable.
static RS2 getGrades(int type, int langID)
          Retrieves type of grades from DB.
static java.lang.String getGroupParticipants(int groupID, int langID)
           
static RS2 getJoreData(java.lang.String courseID, int teachID)
          Returns data needed in JORE-files, such as coursecode courseleveltype organisationparamname (organisation code, responsible person) organisationparamvalue teacher's name
static java.util.ArrayList getJoreInfo(java.lang.String courseID, int teachID)
          Deprecated. 3.10.2002 by KK
static java.lang.String getLanguage(int personID)
          Returns SQL-sentence that gets person's language.
static RS2 getObjectgroupTypes(int langID)
           
static java.lang.String getOrganisationById(DB db, int id, User user)
          Returns organisation's translated name.
static RS2 getOrgCourses(int orgID, int langID)
           
static java.lang.String getParticipants(java.lang.String courseID, int langID, java.lang.String userGroups)
          Returns SQL-sentence that gets course's teachers.
static java.lang.String getPerson(int personID)
          Returns SQL-sentence that .
static java.lang.String getPerson(int personID, int langID)
          Returns SQL-sentence that gets person's info in certain language.
static java.lang.String getPersonAddress(int personID, int langID)
           
static RS2 getPointsGradeTable(java.lang.String evalTableID, int langID)
          Retrieves evaluation table from DB.
static RS2 getQueuingMethods(int langID)
           
static java.lang.String getRegistrationTimeForCourse(java.lang.String personID, java.lang.String courseInstanceID, java.lang.String userGroupID)
           
static java.util.HashMap getStudent(java.lang.String courseID, int studentID)
          Deprecated. 3.10.2002 by KK
static java.lang.String getStudentAllFields(java.lang.String courseID, int studentID, java.lang.String fieldNames)
          Returns SQL-sentence that gets one student's wanted fields in course.
static java.lang.String getStudents(java.lang.String courseID, int langID)
           
static int getTableType(int tableID)
          Retrieves certain table's type (belongsingroup) from DB.
static java.lang.String getTeachers(java.lang.String courseID, int langID)
           
static java.lang.String getTentatorsAndExaminers(java.lang.String courseID, int langID)
           
static RS2 getText(int trID, int langID)
          Return translation text to certain translationkey in certain language.
static Kaannos getTranslation(java.lang.String page, java.lang.String sentence, java.lang.String meaning)
          Gets translation to sentence in wanted language.
static java.lang.String getType(int tableID)
          Deprecated. 4.10.2002 by KK
static boolean hasCourseFunction(java.lang.String courseID, java.lang.String name)
          Returns whether or not course already has function named name.
static java.lang.String insertFieldValue(int personID, int studentID, java.lang.String courseID, Field f)
          Returns SQL-sentence that inserts new field to student.
static java.lang.String insertGrades(int teacherID, java.lang.String courseID, java.lang.String courseCode)
          Returns prepared SQL-sentence that inserts student's grade and credits.
static void insertNewCourseInstance(CourseInstance newCI, User user)
           
static boolean isEditable(java.lang.String courseID, int tableID)
          Checks if evaluation table is editable.
static java.lang.String isEvaluer(java.lang.String courseID, int personID)
          Returns SQL-sentence that .
static int notYetInJore(java.lang.String courseID)
           
static void removeEvalTable(java.lang.String courseID, int tableID)
          Removes evaluation table from course and if no-one else uses it removes it completely.
static boolean removeScript(java.lang.String courseID, java.lang.String script_filename)
          Removes selected evaluation script..
static java.lang.String saveEvalTable(java.lang.String courseID, int tableID)
          Returns SQL-sentence that saves selected evaluation table for course.
static java.lang.String saveEvalTable(java.lang.String courseID, java.lang.String evalTableID)
          Deprecated. 26.8.02 by KK
static java.lang.String setEvalFunction(java.lang.String courseID, java.lang.String evalFunction)
          Returns SQL-sentence that saves wanted evaluationfunction for course.
static java.lang.String setFieldValue(int personID, int studentID, java.lang.String courseID, Field f)
          Returns SQL-sentence that makes field-update.
static java.lang.String setTranslation(Kaannos k)
          Updates translation.
static java.lang.String updateFieldValue(int studentID, java.lang.String courseID, Field f)
          Returns SQL-sentence that updates field to student.
static java.lang.String updateFinished(java.lang.String courseID, java.lang.String finishDate)
          Returns prepared SQL-sentence that saves finishing date to students who have finished course.
static java.lang.String updateGrades(int teacherID, java.lang.String courseID)
          Returns SQL-sentence that saves student's grade and credits for course.
static boolean updateTable(java.lang.String courseID, int tableID, java.lang.String newTableName, java.util.Hashtable newPoints)
          Updates selected evaluation table's points.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

cSQL

public cSQL()
Dummy empty constructor, does nothing.

Method Detail

getCode

public static java.lang.String getCode(java.lang.String courseID)
Deprecated. 25.9.2002 by KK

Returns SQL-sentence that gets course's code.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that gets course's code
See Also:
getCourseCode(String)

getCourseCode

public static java.lang.String getCourseCode(java.lang.String courseID)
Retrieves course's code from DB.

Parameters:
courseID - courseinstanceid
Returns:
course's code

getCourseName

public static java.lang.String getCourseName(int courseID,
                                             int langID)

getGrade

public static java.lang.String getGrade(double points,
                                        int language,
                                        java.lang.String table)
Deprecated. 25.9.2002 by KK

Returns SQL-sentence which gets the points greater or equal to the given points amount.

Parameters:
points - points amount
language - languageid
table - calculatepointsid
Returns:
SQL-sentence which gets the points greater or equal to the given points amount
See Also:
getGradeName(double, int, String)

getGradeName

public static java.lang.String getGradeName(double points,
                                            int languageID,
                                            java.lang.String tableID)
Retrieves grade corresponding to given points in given language in certain calculatepointstable.

Parameters:
points - points amount
languageID - languageid
Returns:
grade corresponding to given points in given language in certain calculatepointstable

getEvaluationFunctions

public static java.lang.String getEvaluationFunctions()
Deprecated. 25.9.2002 by KK

Returns SQL-sentence that retrieves all defined evaluation functions.

Returns:
SQL-sentence that retrieves all defined evaluation functions
See Also:
getFunctions()

getEvalFunction

public static java.lang.String getEvalFunction(java.lang.String courseID)
Deprecated. 25.9.2002 KK

Returns SQL-sentence that retrieves course's evaluation function.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that retrieves course's evaluation function
See Also:
getEvaluationFunction(String)

getEvaluationFunction

public static java.lang.String getEvaluationFunction(java.lang.String courseID)
Retrieves course's evaluation function from DB and returns it's filename.

Parameters:
courseID - courseinstanceid
Returns:
filename of course's evaluation function

getEvaluationFunctionName

public static java.lang.String getEvaluationFunctionName(java.lang.String courseID)
Retrieves name of course's evaluation function from db.

Parameters:
courseID - courseinstanceid
Returns:
name of course's evaluation function

getEvalTable

public static java.lang.String getEvalTable(java.lang.String courseID)
Deprecated. 30.9.2002 by KK

Returns SQL-sentence that gets selected course's evaluation table.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that gets course's evaluation table
See Also:
getEvaluationTable(String)

getEvaluationTable

public static RS2 getEvaluationTable(java.lang.String courseID)
Retrieves course's evaluation table from DB and returns it's name and id in RS2 object

Parameters:
courseID - courseinstanceid
Returns:
name and id of course's evaluation table in RS2 object

getEvalTableName

public static java.lang.String getEvalTableName(java.lang.String tableID)
Deprecated. 4.10.2002 by KK

Returns SQL-sentence that gets evaluation table's name.

Parameters:
tableID - evaluation table's ID
Returns:
SQL-sentence that gets evaluation's table's name
See Also:
getEvaluationTableName(String)

getEvaluationTableName

public static java.lang.String getEvaluationTableName(java.lang.String tableID)
Retrieves name of the certain evaluation table.

Returns:
name of the wanted evaluation table

getPointsGradeTable

public static RS2 getPointsGradeTable(java.lang.String evalTableID,
                                      int langID)
Retrieves evaluation table from DB.

Parameters:
evalTableID - evaluationtable's id number
langID - in what language table is wanted
Returns:
evaluation table in RS2 object

setEvalFunction

public static java.lang.String setEvalFunction(java.lang.String courseID,
                                               java.lang.String evalFunction)
Returns SQL-sentence that saves wanted evaluationfunction for course.

Parameters:
courseID - courseinstanceid
evalFunction - evaluationfunction's name
Returns:
SQL-sentence that saves wanted evaluationfunction for course

getCalculatePoints

public static java.lang.String getCalculatePoints()
Deprecated. 23.9.2002 by KK

Returns SQL-sentence that returns calculatepointstables' names.

Returns:
SQL-sentence that returns calculatepointstables' names in wanted language
See Also:
getAllTables()

getAllTables

public static RS2 getAllTables()
Retrieves all evaluation tables from DB and returns them in RS2 object

Returns:
all evaluation tables in RS2 object

getFunctionName

public static java.lang.String getFunctionName(java.lang.String functionFilename)

saveEvalTable

public static java.lang.String saveEvalTable(java.lang.String courseID,
                                             java.lang.String evalTableID)
Deprecated. 26.8.02 by KK

Returns SQL-sentence that saves selected evaluation table evalTable for course courseID to database.

Parameters:
courseID - selected courseinstance ID
evalTableID - selected evaluation table's ID for course
Returns:
SQL-sentence that saves evaluation table for course
See Also:
saveEvalTable(String, int)

saveEvalTable

public static java.lang.String saveEvalTable(java.lang.String courseID,
                                             int tableID)
Returns SQL-sentence that saves selected evaluation table for course.

Parameters:
courseID - selected courseinstance ID
Returns:
SQL-sentence that saves evaluation table for course

changeFunction

public static java.lang.String changeFunction(java.lang.String courseID,
                                              java.lang.String function)
Returns SQL-sentence that updates course's evaluationfunction.

Parameters:
courseID - courseinstanceID
function - name of course's evaluationfunction
Returns:
SQL-sentence that updates course's evaluationfunction

getFieldValue

public static java.lang.String getFieldValue(int studentID,
                                             java.lang.String courseID,
                                             java.lang.String fieldName)
Returns SQL-sentence that gets course's field's value for student.

Parameters:
studentID - student's personid
courseID - courseinstanceid
fieldName - wanted field's name
Returns:
SQL-sentence that gets course's field's value for student

setFieldValue

public static java.lang.String setFieldValue(int personID,
                                             int studentID,
                                             java.lang.String courseID,
                                             Field f)
Returns SQL-sentence that makes field-update.

Parameters:
personID - teacher's personID who is making this update
studentID - student's personID to whom update is made
courseID - course's courseinstanceID
f - field to update or insert if it doesn't already exist
Returns:
SQL-sentence that makes update

insertFieldValue

public static java.lang.String insertFieldValue(int personID,
                                                int studentID,
                                                java.lang.String courseID,
                                                Field f)
Returns SQL-sentence that inserts new field to student.

Parameters:
personID - teacher's personID who is making this update
studentID - student's personID to whom update is made
courseID - course's courseinstanceID
f - field to update or insert if it doesn't already exist
Returns:
SQL-sentence that makes update

updateFieldValue

public static java.lang.String updateFieldValue(int studentID,
                                                java.lang.String courseID,
                                                Field f)
Returns SQL-sentence that updates field to student.

Parameters:
studentID - student's personID to whom update is made
courseID - course's courseinstanceID
f - field to update or insert if it doesn't already exist
Returns:
SQL-sentence that makes update

getTeachers

public static java.lang.String getTeachers(java.lang.String courseID,
                                           int langID)

getTentatorsAndExaminers

public static java.lang.String getTentatorsAndExaminers(java.lang.String courseID,
                                                        int langID)

getStudents

public static java.lang.String getStudents(java.lang.String courseID,
                                           int langID)

getCandidates

public static java.lang.String getCandidates(java.lang.String courseID,
                                             int langID)

getParticipants

public static java.lang.String getParticipants(java.lang.String courseID,
                                               int langID,
                                               java.lang.String userGroups)
Returns SQL-sentence that gets course's teachers.

Parameters:
courseID - courseinstanceid
langID - languageID / 1=eng, 2=fin, ...
Returns:
SQL-sentence that

getGroupParticipants

public static java.lang.String getGroupParticipants(int groupID,
                                                    int langID)

getGrade

public static java.lang.String getGrade(int studentID,
                                        java.lang.String courseID,
                                        int langID)
Returns SQL-sentence that gets student's grade for the course.

Parameters:
studentID - student's personid
courseID - courseinstanceid
Returns:
SQL-sentence that

getLanguage

public static java.lang.String getLanguage(int personID)
Returns SQL-sentence that gets person's language.

Parameters:
personID - person's id-number
Returns:
SQL-sentence that gets person's language

updateGrades

public static java.lang.String updateGrades(int teacherID,
                                            java.lang.String courseID)
Returns SQL-sentence that saves student's grade and credits for course.

Parameters:
teacherID - teacher's personid
courseID - courseinstanceid
Returns:
SQL-sentence that saves student's grade and credits for course
See Also:
updateGrades(int, java.lang.String), public static String saveGrade(int studentID, int teacherID, String courseID, int gradeID, double credits) throws Exception { Log.log("******* cSQL.saveGrade(int,int,String,int,double) deprecated method *******"); Log.logStack(); String str = ""; String courseCode = ""; DB db = new DB("cSQL.saveGrade(int,int,String,int,double) db"); db.connect(); try { //Haetaan kurssin koodi ihan ensin: ResultSet rs = db.executeQuery( getCode(courseID) ); if ( rs.next() ) courseCode = rs.getString("code"); //Tarkastetaan ensin, onko opiskelijalla jo arvosana ko. kurssista str = "SELECT gradeid FROM finished WHERE person1id="+studentID+" AND courseinstanceid="+courseID+";"; rs = db.executeQuery(str); int oldGrade = 0; if ( rs.next() ) { //arvosana löytyi => päivitetään se //oldGrade = rs.getInt("gradeid"); if ( courseCode.equals("") ) return "UPDATE finished " +"SET " +"deleted=FALSE, " +"person2id="+teacherID+", " +"gradeid="+gradeID+", " +"credits="+credits+", " +"finishedon='now' " +"WHERE " +"person1id="+studentID+" AND " +"courseinstanceid="+courseID+";"; else return "UPDATE finished " +"SET " +"deleted=FALSE, " +"person2id="+teacherID+", " +"gradeid="+gradeID+", " +"credits="+credits+", " +"code='"+courseCode+"', " +"finishedon='now' " +"WHERE " +"person1id="+studentID+" AND " +"courseinstanceid="+courseID+";"; } else { //arvosanaa ei löytynyt => lisätään uusi return "INSERT INTO finished (" +"deleted, " +"person1id, " +"person2id, " +"courseinstanceid, " +"gradeid, " +"credits, " +"code, " +"finishedon) " +"VALUES (" +"FALSE, " +studentID+", " +teacherID+", " +courseID+", " +gradeID+", " +credits+", " +"'"+courseCode+"', " +"'now' " +");"; } } catch (Exception e) { Log.log("cSQL.saveGrade(int,int,String,int,double) ERROR",e); throw e; } finally { db.disconnect(); } } /** Returns prepared SQL-sentence that updates student's grade and credits.

insertGrades

public static java.lang.String insertGrades(int teacherID,
                                            java.lang.String courseID,
                                            java.lang.String courseCode)
Returns prepared SQL-sentence that inserts student's grade and credits.

Parameters:
teacherID - teacher's personid who id making insert
courseID - courseinstanceid
courseCode - course's code
Returns:
SQL-sentence that inserts student's grade and credits

deleteGrade

public static boolean deleteGrade(int studentID,
                                  java.lang.String courseID)

updateFinished

public static java.lang.String updateFinished(java.lang.String courseID,
                                              java.lang.String finishDate)
Returns prepared SQL-sentence that saves finishing date to students who have finished course.

Parameters:
courseID - courseinstanceid
finishDate - finishing date in normal finnish-format (pp.kk.vvvv)
Returns:
prepared SQL-sentence that saves finishing date to students who have finished course

getFieldName

public static RS2 getFieldName(java.lang.String fieldID,
                               int langID)
Returns SQL-sentence that gets wanted fields' names in certain language.

Parameters:
fieldID - fieldid or several separated by comma
langID - languageid
Returns:
SQL-sentence that gets wanted field's name in certain language

getFieldID

public static int getFieldID(java.lang.String courseID,
                             java.lang.String fieldName)
Gets wanted field's id.

Parameters:
courseID - courseinstanceid
fieldName - wanted field's name
Returns:
wanted field's id

getAllFields

public static java.lang.String getAllFields(java.lang.String courseID,
                                            java.lang.String students,
                                            java.lang.String fieldNames)
Returns SQL-sentence that gets course's students' wanted fields.

Parameters:
courseID - courseinstanceid
students - students' IDs whose fields are wanted separated by comma
fieldNames - wanted fields' (generic)names separated by comma
Returns:
SQL-sentence that gets course's students' wanted fields
See Also:
getStudentAllFields(java.lang.String, int, java.lang.String)

getStudentAllFields

public static java.lang.String getStudentAllFields(java.lang.String courseID,
                                                   int studentID,
                                                   java.lang.String fieldNames)
Returns SQL-sentence that gets one student's wanted fields in course.

Parameters:
courseID - courseinstanceid
fieldNames - wanted fields' names separated by comma
Returns:
SQL-sentence that gets course's students' fields
See Also:
getAllFields(java.lang.String, java.lang.String, java.lang.String)

getFinished

public static java.lang.String getFinished(java.lang.String courseID)
Returns SQL-sentence that retrieves students who have finished course.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that retrieves students who have finished course

getChangedFinished

public static java.util.ArrayList getChangedFinished(java.lang.String courseID,
                                                     int langID)
Deprecated. 3.10.2002 by KK

Returns SQL-sentence that retrieves students who have finished course and whose finished data has changed since last evaluation.

Parameters:
courseID - courseinstanceid
langID - languageid
Returns:
SQL-sentence that retrieves students who have finished course
See Also:
getChangedFinishedStudents(String,int)

getChangedFinishedStudents

public static RS2 getChangedFinishedStudents(java.lang.String courseID,
                                             int langID)
Retrieves from DB students who have finished course and/or whose finished data has changed since last evaluation.

Parameters:
courseID - courseinstanceid
langID - languageid
Returns:
students who have finished course in RS2 object

getStudent

public static java.util.HashMap getStudent(java.lang.String courseID,
                                           int studentID)
Deprecated. 3.10.2002 by KK

Returns SQL-sentence that retrieves student's info.

Parameters:
studentID - student's personid
Returns:
SQL-sentence that retrieves student's info
See Also:
#getCourseStudent(String,int)

getPerson

public static java.lang.String getPerson(int personID,
                                         int langID)
Returns SQL-sentence that gets person's info in certain language.

Parameters:
personID - personid
langID - languageid
Returns:
SQL-sentence that gets person's info Fixed 22.8.2002: added "pp.deleted='f'" to inner sub select in union last part. Without that, a user with only deleted personparameters did not get returned in the query. 8.10.02 Added p.callname, p.account and p.languageid by KK

getPerson

public static java.lang.String getPerson(int personID)
Returns SQL-sentence that .

Parameters:
personID -
Returns:
SQL-sentence that

getPersonAddress

public static java.lang.String getPersonAddress(int personID,
                                                int langID)

getJoreInfo

public static java.util.ArrayList getJoreInfo(java.lang.String courseID,
                                              int teachID)
Deprecated. 3.10.2002 by KK

Returns data needed in JORE-files, such as coursecode courseleveltype organisationparamname (organisation code, responsible person) organisationparamvalue teacher's name

Parameters:
courseID - courseinstanceid
teachID - teacher's personid
Returns:
data needed in JORE-files, normally two rows: 1st orgparamname=vastuualue, 2nd orgparamname=kirjaaja
See Also:
getJoreData(String,int)

getJoreData

public static RS2 getJoreData(java.lang.String courseID,
                              int teachID)
Returns data needed in JORE-files, such as coursecode courseleveltype organisationparamname (organisation code, responsible person) organisationparamvalue teacher's name

Parameters:
courseID - courseinstanceid
teachID - teacher's personid
Returns:
data needed in JORE-files, normally two rows: 1st orgparamname=vastuualue, 2nd orgparamname=kirjaaja

getCourseFunctions

public static java.lang.String getCourseFunctions(java.lang.String courseID)
Returns SQL-sentence that gets all evaluation functions defined to course.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that gets course's evaluation functions

getCourseFunctions

public static java.lang.String getCourseFunctions(java.lang.String courseID,
                                                  int personID)
Returns SQL-sentence that gets evaluationfunctions defined to course that person can use.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that gets course's evaluation functions

getFunctions

public static java.lang.String getFunctions()
Deprecated. 25.9.2002 by KK

Returns SQL-sentence that gets all evaluation functions.

Returns:
SQL-sentence that gets evaluation functions
See Also:
getAllFunctions()

getAllFunctions

public static RS2 getAllFunctions()
Retrieves all evaluation functions from DB.

Returns:
all evaluation functions in RS2-object

evaluatedStudents

public static int evaluatedStudents(java.lang.String courseID)
Retrieves amount of course's students that have been evaluated.

Parameters:
courseID - courseinstanceid
Returns:
amount of course's students that are evaluated

addNewFunction

public static java.lang.String addNewFunction(java.lang.String courseID,
                                              java.lang.String name,
                                              java.lang.String description,
                                              int usergroupid)
                                       throws java.lang.Exception
Returns SQL-sentence that adds new evaluationfunction to course.

Parameters:
courseID - courseinstanceid
name - function's name
description - function's description
Returns:
SQL-sentence that adds new evaluationfunction to course
java.lang.Exception

getFunctionID

public static java.lang.String getFunctionID(java.lang.String courseID,
                                             java.lang.String name)
Returns SQL-sentence that .

Parameters:
courseID - courseinstanceid
name - function's name
Returns:
SQL-sentence that

hasCourseFunction

public static boolean hasCourseFunction(java.lang.String courseID,
                                        java.lang.String name)
Returns whether or not course already has function named name.

Parameters:
courseID - courseinstanceid
name - function's name
Returns:
true if course has function named name, false otherwise

getFunctionFilename

public static java.lang.String getFunctionFilename(java.lang.String courseID,
                                                   java.lang.String name)
Deprecated. 4.10.2002 by KK

Returns SQL-sentence that gets course's function's filename.

Parameters:
courseID - courseinstanceid
name - function's name
Returns:
SQL-sentence that
See Also:
getFunctionFileName(String,String)

getFunctionFileName

public static java.lang.String getFunctionFileName(java.lang.String courseID,
                                                   java.lang.String name)
Retrieves course's certain evaluation function's filename from DB

Parameters:
courseID - courseinstanceid
name - function's name
Returns:
course's certain evaluation function's filename

removeScript

public static boolean removeScript(java.lang.String courseID,
                                   java.lang.String script_filename)
Removes selected evaluation script..

Parameters:
courseID - courseinstanceid
script_filename -

getCoursepartisipants

public static int getCoursepartisipants(java.lang.String courseID,
                                        java.lang.String usergroups)
Returns SQL-sentence that gets count of course's participants.

Parameters:
courseID - courseinstanceid
usergroups - all wanted usergroups separated by comma
Returns:
SQL-sentence that gets count of course's participants

getFunctionUsergroup

public static java.lang.String getFunctionUsergroup(java.lang.String courseID,
                                                    java.lang.String functionFilename)
Returns SQL-sentence that gets usergroup of course's function.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that gets usergroup of course's function

changeFunctionUsergroup

public static java.lang.String changeFunctionUsergroup(java.lang.String courseID,
                                                       java.lang.String functionFilename,
                                                       int usergroupid)
Returns SQL-sentence that updates usergroup of course's function.

Parameters:
courseID - courseinstanceid
functionFilename -
Returns:
SQL-sentence that updates usergroup of course's function

changeFunctionAttributes

public static java.lang.String changeFunctionAttributes(java.lang.String courseID,
                                                        java.lang.String filename,
                                                        java.lang.String name,
                                                        java.lang.String description,
                                                        int usergroupid)
Returns SQL-sentence that updates usergroup of course's function.

Parameters:
courseID - courseinstanceid
Returns:
SQL-sentence that updates usergroup of course's function

isEvaluer

public static java.lang.String isEvaluer(java.lang.String courseID,
                                         int personID)
Returns SQL-sentence that .

Parameters:
courseID - courseinstanceid
personID -
Returns:
SQL-sentence that

addNewTable

public static java.lang.String addNewTable(java.lang.String courseID,
                                           java.lang.String name,
                                           java.util.Hashtable points)
                                    throws java.lang.Exception
Returns SQL-sentence that adds new evaluationtable to course.

Parameters:
courseID - courseinstanceid
name - table's name
points - Hashtable where (Double)points_amount is key and (Integer)gradeID is value
Returns:
SQL-sentence that adds new evaluationtable to course
java.lang.Exception

removeEvalTable

public static void removeEvalTable(java.lang.String courseID,
                                   int tableID)
Removes evaluation table from course and if no-one else uses it removes it completely.

Parameters:
courseID - courseinstanceid, what course
tableID - calculatepointsid, which table to remove

getArvosanat

public static java.util.ArrayList getArvosanat(int tableType,
                                               int langID)
Gets grades and returns them in ArrayList.

Parameters:
tableType - group that grade belongs in (belongsingroup)
Returns:
gradeIDs belonging in certain group in ArrayList

getCourseEvaltables

public static java.util.ArrayList getCourseEvaltables(java.lang.String courseID)
Deprecated. 3.10.2002 by KK -no new version yet!

Returns course's evaluation tables in ArrayList.

Parameters:
courseID - courseinstanceid
Returns:
course's evaluation tables in ArrayList containig SQL-query's result in HashMap per row
See Also:
getCourseEvaluationtables(String)

getCourseEvaluationtables

public static RS2 getCourseEvaluationtables(java.lang.String courseID)
Returns course's evaluation tables in RS2 object.

Parameters:
courseID - courseinstanceid
Returns:
course's evaluation tables in RS2 object

isEditable

public static boolean isEditable(java.lang.String courseID,
                                 int tableID)
Checks if evaluation table is editable.

Parameters:
courseID - courseinstanceid
tableID - calculatepointsid
Returns:
true if table is editable, else false

getGrades

public static RS2 getGrades(int type,
                            int langID)
Retrieves type of grades from DB.

Parameters:
type - grade's belongsingroup value
langID - languageid of wanted grades
Returns:
type of grade in RS2 object

getType

public static java.lang.String getType(int tableID)
Deprecated. 4.10.2002 by KK

Returns SQL-sentence that gets selected evaluation table's type (=belongsingroup).

Parameters:
tableID - calculatepointsid
Returns:
SQL-sentence that gets evaluation table's type
See Also:
getTableType(int)

getTableType

public static int getTableType(int tableID)
Retrieves certain table's type (belongsingroup) from DB.

Parameters:
tableID - calculatepointsid
Returns:
table's belongsingroup value (a.k.a type)

updateTable

public static boolean updateTable(java.lang.String courseID,
                                  int tableID,
                                  java.lang.String newTableName,
                                  java.util.Hashtable newPoints)
Updates selected evaluation table's points.

Parameters:
courseID - courseinstanceid
tableID - calculatepointsid
newTableName - new name to evaluation table
newPoints - new points in evaluation table, Hashtable where (Double)points_amount is key and (Integer)gradeID is value
Returns:
false if update fails, else true

exceptionalJore

public static java.lang.String exceptionalJore(java.lang.String courseID)
Deprecated. 3.10.2002 by KK -no use for this method(?)

Gets exceptional info used in Jore.

Parameters:
courseID - courseinstanceid
Returns:
exceptional data for course

exceptionalStudent

public static java.lang.String exceptionalStudent(int studentID)
Returns file extension where to add student if student is exceptional.


getTranslation

public static Kaannos getTranslation(java.lang.String page,
                                     java.lang.String sentence,
                                     java.lang.String meaning)
Gets translation to sentence in wanted language.

Parameters:
sentence - sentence in Finnish to translate
meaning - what Finnish sentence really means, null if no meaning
Returns:
translation in Kaannos

getAllTranslations

public static java.util.Hashtable getAllTranslations()
Gets all translations from database and returns them in Hashtable (langID_FinnisText as key-value)


setTranslation

public static java.lang.String setTranslation(Kaannos k)
Updates translation.

Parameters:
k -

getRegistrationTimeForCourse

public static java.lang.String getRegistrationTimeForCourse(java.lang.String personID,
                                                            java.lang.String courseInstanceID,
                                                            java.lang.String userGroupID)

getCourseTime

public static java.lang.String getCourseTime(java.lang.String courseInstanceID)

getAllTranslationPages

public static RS2 getAllTranslationPages()
Returns all pages from translationkey table.

Returns:
all pages from translationkey table in RS2 object

getText

public static RS2 getText(int trID,
                          int langID)
Return translation text to certain translationkey in certain language.

Parameters:
trID - translationid
langID - languageid
Returns:
translation text to certain translationkey in certain language

getFinTexts

public static RS2 getFinTexts(java.lang.String page)
Returns finnish text in certain page

Parameters:
page - page which texts are wanted
Returns:
finnish text in RS2 object

getOrgCourses

public static RS2 getOrgCourses(int orgID,
                                int langID)

getCourseData

public static RS2 getCourseData(int courseID,
                                int langID)

getQueuingMethods

public static RS2 getQueuingMethods(int langID)

getCourseObjectgroups

public static RS2 getCourseObjectgroups(java.lang.String courseID)

getCourseObjectgroups

public static RS2 getCourseObjectgroups(int courseID)

getObjectgroupTypes

public static RS2 getObjectgroupTypes(int langID)

insertNewCourseInstance

public static void insertNewCourseInstance(CourseInstance newCI,
                                           User user)

getCourseTeachers

public static RS2 getCourseTeachers(java.lang.String courseID)
Return course instance's teachers in RS2 object.


getAllowedGrades

public static java.util.ArrayList getAllowedGrades()
Fetches all allowed gradenames (a.k.a. belongsingroup<5) from db.

Returns:
allowed grades (in upper case) in ArrayList

getOrganisationById

public static java.lang.String getOrganisationById(DB db,
                                                   int id,
                                                   User user)
                                            throws java.lang.Exception
Returns organisation's translated name.

java.lang.Exception

getAccessRightLevels

public static RS2 getAccessRightLevels(User user)
                                throws java.lang.Exception
Returns all accessrightlevels & ids with user's language

java.lang.Exception

notYetInJore

public static int notYetInJore(java.lang.String courseID)