incorporate few review comments for bael-603 (#1429)

This commit is contained in:
Mohamed Sanaulla 2017-03-18 10:18:04 +03:00 committed by maibin
parent 99bebe806c
commit dc90aace68
8 changed files with 50 additions and 43 deletions

View File

@ -4,13 +4,13 @@ import com.baeldung.student.service.StudentService;
import com.baeldung.student.service.dbimpl.StudentDbService;
import com.baeldung.student.model.Student;
public class StudentClient{
public class StudentClient {
public static void main(String[] args) {
StudentService service = new StudentDbService();
service.create(new Student());
service.read("17SS0001");
service.update(new Student());
service.delete("17SS0001");
}
public static void main(String[] args) {
StudentService service = new StudentDbService();
service.create(new Student());
service.read("17SS0001");
service.update(new Student());
service.delete("17SS0001");
}
}

View File

@ -1,3 +1,3 @@
module com.baeldung.student.client{
requires com.baeldung.student.service.dbimpl;
requires com.baeldung.student.service.dbimpl;
}

View File

@ -2,11 +2,14 @@ package com.baeldung.student.model;
import java.util.Date;
public class Student{
public String registrationId;
public String firstName;
public String lastName;
public Date dateOfBirth;
public String city;
public String country;
public class Student {
private String registrationId;
public String getRegistrationId() {
return registrationId;
}
public void setRegistrationId(String registrationId) {
this.registrationId = registrationId;
}
}

View File

@ -1,3 +1,3 @@
module com.baeldung.student.model{
exports com.baeldung.student.model;
exports com.baeldung.student.model;
}

View File

@ -2,26 +2,29 @@ package com.baeldung.student.service.dbimpl;
import com.baeldung.student.service.StudentService;
import com.baeldung.student.model.Student;
import java.util.logging.*;
public class StudentDbService implements StudentService{
public class StudentDbService implements StudentService {
public String create(Student student){
System.out.println("Creating student in DB...");
return student.registrationId;
}
private static Logger logger = Logger.getLogger("StudentDbService");
public Student read(String registrationId){
System.out.println("Reading student from DB...");
return new Student();
}
public String create(Student student) {
logger.log(Level.INFO, "Creating student in DB...");
return student.getRegistrationId();
}
public Student update(Student student){
System.out.println("Updating sutdent in DB...");
return student;
}
public Student read(String registrationId) {
logger.log(Level.INFO, "Reading student from DB...");
return new Student();
}
public String delete(String registrationId){
System.out.println("Deleteing sutdent in DB...");
return registrationId;
}
public Student update(Student student) {
logger.log(Level.INFO, "Updating sutdent in DB...");
return student;
}
public String delete(String registrationId) {
logger.log(Level.INFO, "Deleteing sutdent in DB...");
return registrationId;
}
}

View File

@ -1,4 +1,5 @@
module com.baeldung.student.service.dbimpl{
requires transitive com.baeldung.student.service;
exports com.baeldung.student.service.dbimpl;
requires transitive com.baeldung.student.service;
exports com.baeldung.student.service.dbimpl;
requires java.logging;
}

View File

@ -2,13 +2,13 @@ package com.baeldung.student.service;
import com.baeldung.student.model.Student;
public interface StudentService{
public interface StudentService {
public String create(Student student);
public String create(Student student);
public Student read(String registrationId);
public Student read(String registrationId);
public Student update(Student student);
public Student update(Student student);
public String delete(String registrationId);
public String delete(String registrationId);
}

View File

@ -1,4 +1,4 @@
module com.baeldung.student.service{
requires transitive com.baeldung.student.model;
exports com.baeldung.student.service;
requires transitive com.baeldung.student.model;
exports com.baeldung.student.service;
}