diff --git a/src/main/java/com/example/servicedemo/Student.java b/src/main/java/com/example/servicedemo/Student.java deleted file mode 100644 index 6cea332..0000000 --- a/src/main/java/com/example/servicedemo/Student.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.example.servicedemo; - -public class Student { - private String name; - private String className; - - - public Student(String name, String className) { - super(); - this.name = name; - this.className = className; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } -} \ No newline at end of file diff --git a/src/main/java/com/example/servicedemo/controller/StudentServiceController.java b/src/main/java/com/example/servicedemo/controller/StudentServiceController.java deleted file mode 100644 index 9911da8..0000000 --- a/src/main/java/com/example/servicedemo/controller/StudentServiceController.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.example.servicedemo.controller; - - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.example.servicedemo.Student; - -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - - -@RestController -@RequestMapping("/api") -public class StudentServiceController { - - private static Map> schooDB = new HashMap>(); - - static { - schooDB = new HashMap>(); - - List lst = new ArrayList(); - Student std = new Student("Sajal", "Class IV"); - lst.add(std); - std = new Student("Lokesh", "Class V"); - lst.add(std); - - schooDB.put("abcschool", lst); - - lst = new ArrayList(); - std = new Student("Kajal", "Class III"); - lst.add(std); - std = new Student("Sukesh", "Class VI"); - lst.add(std); - - schooDB.put("xyzschool", lst); - - } - - @RequestMapping(value = "/getStudentDetailsForSchool/{schoolname}", method = RequestMethod.GET) - public List getStudents(@PathVariable String schoolname) { - System.out.println("Getting Student details for " + schoolname); - - List studentList = schooDB.get(schoolname); - if (studentList == null) { - studentList = new ArrayList(); - Student std = new Student("Not Found", "N/A"); - studentList.add(std); - } - return studentList; - } -} \ No newline at end of file