From dc8274e5052dfa5867cb87d595da0224721dd0e5 Mon Sep 17 00:00:00 2001 From: Kevin Huang Date: Mon, 18 Mar 2013 02:23:49 -0400 Subject: [PATCH] updated Filter with proper data from remote db --- branch/proto/Filter.java | 148 ++++++++++++--------------------------- 1 file changed, 46 insertions(+), 102 deletions(-) diff --git a/branch/proto/Filter.java b/branch/proto/Filter.java index 5bf5c0e..ea501d8 100755 --- a/branch/proto/Filter.java +++ b/branch/proto/Filter.java @@ -1,135 +1,79 @@ -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; + + +class Filter { + + -public class Filter { /* * Method Name: getMajors * Method Description: This method will get major information based on the UHO and return classes for the user to select - * @param - * @return A list of classes that available for the student to take + * @return A list of majors for student to choose */ - dbcredential db = new dbcredential(); - + //TODO change the signature back to protected after the prototype public static ArrayList getMajors(){ - ArrayList majors = new ArrayList(); - - - // table of choice - String table = "schedule"; - // adding dummy data into this arraylist - majors.add("CS"); + mysqlDBExecute sessionMajor = new mysqlDBExecute(); + return sessionMajor.PullMajors(); + } - return majors; - } /* * Method Name: getConcentration * Method Description: This method will take in a unique major code and return concentrations available for the user. * @param MajorCode the major is converted into unique identifier for db to recognize * @return */ - public static ArrayList getConcentrations(String MajorCode){ - String table="track"; - String fields="coursename"; - - ArrayList concentrations = new ArrayList(); - concentrations.add("Algor"); - concentrations.add("Software E"); - concentrations.add("OS") ; - concentrations.add("AI") ; - concentrations.add("HCI") ; - concentrations.add("Game Design") ; - - return concentrations; + public static ArrayList getConcentrations(String MajorString){ + + mysqlDBExecute sessionConcentrations = new mysqlDBExecute(); + + return sessionConcentrations.PullConcentrations(MajorString); }; + + + /* * Method Name: getClasses - * Method Description: This method will get classes for user to choose. - * @param term: The term table that in current planning - * @param userHistory: The User history object that is passed from DCS + * Method Description : This method will get classes for user to choose. + * @param ternName : The term table that in current planning + * @param userSession : The User history object that is passed from DCS * @return */ - public static ArrayList getCourses(Term term, SessionInfo userHistory){ - - //based off term - - //based off userHistory - - ArrayList scheduleCollection = new ArrayList(); - - Schedule s1 = new Schedule(); - Schedule s2 = new Schedule(); - Schedule s3 = new Schedule(); - - - s1.Subject = "CS"; - s1.CRN=302141; - s1.Course_no=171; - s1.Start_time="5:00 PM" ; - s1.End_time="8:00 PM"; - s1.Term="Spring"; - s1.Section=1; - s1.Instruction_type="Lecture"; - s1.Instructor ="Nowak"; - s1.Location="Korman 137"; - s1.Weekday="M"; - - s2.Subject = "CS"; - s2.CRN=360873; - s2.Course_no=283; - s2.Start_time="4:00 PM" ; - s2.End_time="6:00 PM"; - s2.Term="Spring"; - s2.Section=1; - s2.Instruction_type="Lecture"; - s2.Instructor ="Mongon"; - s2.Location="UC 153"; - s2.Weekday="W"; - - - s3.Subject = "CS"; - s3.CRN=302141; - s3.Course_no= 265; - s3.Start_time="10:00 AM"; - s3.End_time="12:00 AM"; - s3.Term="Spring"; - s3.Section=1; - s3.Instruction_type="Lecture"; - s3.Instructor ="Schmidt"; - s3.Location="Korman 153"; - s3.Weekday="T"; - - scheduleCollection.add(s1); - scheduleCollection.add(s2); - scheduleCollection.add(s3); - - - return scheduleCollection; - }; - /* - * Method Name: getDescription - * Method Description: This method will get the descriptions based on classes - * @return - */ - public static String getDescription(Integer CRN){ - return "i am a description"; - }; + public static ArrayList getClasses(Term termName, SessionInfo userSession){ + + mysqlDBExecute sessionSchedule = new mysqlDBExecute(); + + + return sessionSchedule.PullSchedule(termName, userSession); + } + /* * Method Name: filterhistory * Method Description This method will take responsibility of filtering a result against user history object - * @param userhistory The UHO passed from DCS - * @param recrodSet The records returned from the database call + * @param userhistory The userhistory will be taken classes which gathered through the webframework * @return */ - private void filterhistory(SessionInfo userhistory, ArrayList recrodSet){ +// private void filterhistory(SessionInfo userhistory){ +// // assuming that the userhistory will be a string +// +// ArrayList takenClasses = new ArrayList(); +// +// for(String className : takenClasses){ +// // convert into code +// +// // query against db +// +// } +// +// } + + - } }