@@ -43,10 +43,10 @@ public ResponseEntity<?> retrieveDepartment(@RequestParam(value = "deptCode") St
4343 departmentMapping = IndividualProjectApplication .myFileDatabase .getDepartmentMapping ();
4444
4545 if (!departmentMapping .containsKey (deptCode .toUpperCase ())) {
46- return new ResponseEntity <>("Department Not Found" , HttpStatus .OK );
46+ return new ResponseEntity <>("Department Not Found" , HttpStatus .NOT_FOUND );
4747 } else {
48- return new ResponseEntity <>(departmentMapping .get (deptCode .toUpperCase ()). toString () ,
49- HttpStatus .NOT_FOUND );
48+ return new ResponseEntity <>(departmentMapping .get (deptCode .toUpperCase ()),
49+ HttpStatus .OK );
5050 }
5151
5252 } catch (Exception e ) {
@@ -84,8 +84,8 @@ public ResponseEntity<?> retrieveCourse(
8484 if (!coursesMapping .containsKey (Integer .toString (courseCode ))) {
8585 return new ResponseEntity <>("Course Not Found" , HttpStatus .NOT_FOUND );
8686 } else {
87- return new ResponseEntity <>(coursesMapping .get (Integer .toString (courseCode )). toString () ,
88- HttpStatus .FORBIDDEN );
87+ return new ResponseEntity <>(coursesMapping .get (Integer .toString (courseCode )),
88+ HttpStatus .OK );
8989 }
9090
9191 }
@@ -124,7 +124,12 @@ public ResponseEntity<?> isCourseFull(
124124 coursesMapping = departmentMapping .get (deptCode ).getCourseSelection ();
125125
126126 Course requestedCourse = coursesMapping .get (Integer .toString (courseCode ));
127- return new ResponseEntity <>(requestedCourse .isCourseFull (), HttpStatus .OK );
127+
128+ HashMap <String , Boolean > jsonResponseConverter = new HashMap <>();
129+ jsonResponseConverter .put ("isFull" , requestedCourse .isCourseFull ());
130+
131+ return new ResponseEntity <>(jsonResponseConverter , HttpStatus .OK );
132+
128133 } else {
129134 return new ResponseEntity <>("Course Not Found" , HttpStatus .NOT_FOUND );
130135 }
@@ -151,8 +156,10 @@ public ResponseEntity<?> getMajorCtFromDept(@RequestParam(value = "deptCode") St
151156 if (doesDepartmentExists ) {
152157 HashMap <String , Department > departmentMapping ;
153158 departmentMapping = IndividualProjectApplication .myFileDatabase .getDepartmentMapping ();
154- return new ResponseEntity <>("There are: " + -departmentMapping .get (deptCode )
155- .getNumberOfMajors () + " majors in the department" , HttpStatus .OK );
159+
160+ return new ResponseEntity <>("{\" majorCt\" : " +
161+ departmentMapping .get (deptCode ).getNumberOfMajors () + "}" ,
162+ HttpStatus .OK );
156163 }
157164 return new ResponseEntity <>("Department Not Found" , HttpStatus .FORBIDDEN );
158165 } catch (Exception e ) {
@@ -177,8 +184,9 @@ public ResponseEntity<?> identifyDeptChair(@RequestParam(value = "deptCode") Str
177184 if (doesDepartmentExists ) {
178185 HashMap <String , Department > departmentMapping ;
179186 departmentMapping = IndividualProjectApplication .myFileDatabase .getDepartmentMapping ();
180- return new ResponseEntity <>(departmentMapping .get (deptCode ).getDepartmentChair () + " is "
181- + "the department chair." , HttpStatus .OK );
187+ return new ResponseEntity <>("{\" departmentChair\" : \" " +
188+ departmentMapping .get (deptCode ).getDepartmentChair () + "\" }" ,
189+ HttpStatus .OK );
182190 }
183191 return new ResponseEntity <>("Department Not Found" , HttpStatus .NOT_FOUND );
184192 } catch (Exception e ) {
@@ -215,8 +223,8 @@ public ResponseEntity<?> findCourseLocation(
215223 coursesMapping = departmentMapping .get (deptCode ).getCourseSelection ();
216224
217225 Course requestedCourse = coursesMapping .get (Integer .toString (courseCode ));
218- return new ResponseEntity <>(requestedCourse .getCourseLocation () + " is where the course "
219- + "is located." , HttpStatus .OK );
226+ return new ResponseEntity <>("{ \" location \" : \" " + requestedCourse .getCourseLocation () + "\" }" ,
227+ HttpStatus .OK );
220228 } else {
221229 return new ResponseEntity <>("Course Not Found" , HttpStatus .NOT_FOUND );
222230 }
@@ -255,8 +263,11 @@ public ResponseEntity<?> findCourseInstructor(
255263 coursesMapping = departmentMapping .get (deptCode ).getCourseSelection ();
256264
257265 Course requestedCourse = coursesMapping .get (Integer .toString (courseCode ));
258- return new ResponseEntity <>(requestedCourse .getInstructorName () + " is the instructor for"
259- + " the course." , HttpStatus .OK );
266+ HashMap <String , String > response = new HashMap <>();
267+ response .put ("instructor" , requestedCourse .getInstructorName ());
268+
269+ return new ResponseEntity <>(response , HttpStatus .OK );
270+
260271 } else {
261272 return new ResponseEntity <>("Course Not Found" , HttpStatus .NOT_FOUND );
262273 }
@@ -295,8 +306,10 @@ public ResponseEntity<?> findCourseTime(
295306 coursesMapping = departmentMapping .get (deptCode ).getCourseSelection ();
296307
297308 Course requestedCourse = coursesMapping .get (Integer .toString (courseCode ));
298- return new ResponseEntity <>("The course meets at: " + "some time " ,
299- HttpStatus .OK );
309+ HashMap <String , String > response = new HashMap <>();
310+ response .put ("time" , requestedCourse .getCourseTimeSlot ());
311+
312+ return new ResponseEntity <>(response , HttpStatus .OK );
300313 } else {
301314 return new ResponseEntity <>("Course Not Found" , HttpStatus .NOT_FOUND );
302315 }
0 commit comments