Skip to content

Commit

Permalink
incorporate few review comments for bael-603 (eugenp#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanaulla123 authored and maibin committed Mar 18, 2017
1 parent 99bebe8 commit dc90aac
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
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");
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module com.baeldung.student.client{
requires com.baeldung.student.service.dbimpl;
requires com.baeldung.student.service.dbimpl;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

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;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module com.baeldung.student.model{
exports com.baeldung.student.model;
exports com.baeldung.student.model;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@

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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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);
}
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit dc90aac

Please sign in to comment.