Package de.nak.notendb.service

Source Code of de.nak.notendb.service.StudentServiceImpl

package de.nak.notendb.service;

import java.util.List;

import de.nak.notendb.dao.StudentDAO;
import de.nak.notendb.model.Student;

/**
* Implementation des StudentService fuer die Verwaltung von Studenten
*
* @author Julian Pusch
*
*/
public class StudentServiceImpl implements StudentService {
 
  private StudentDAO studentDAO;
 
  public void setStudentDAO(StudentDAO studentDAO) {
    this.studentDAO = studentDAO;
  }

  @Override
  public Student ladeStudent(Long id) throws StudentNichtGefundenException {
    Student student = studentDAO.lade(id);
    if (student == null) {
      throw new StudentNichtGefundenException();
    }
    return student;
  }
 
  @Override
  public List<Student> ladeAlle() {
    return studentDAO.ladeAlle();
  }
 
  @Override
  public List<Student> ladeStudentenZuManipel(Long manipelId) {
    return studentDAO.ladeStudentenZuManipel(manipelId);
  }

  @Override
  public void speichere(Student student) throws StudentExistentException {
    if (studentDAO.ladeStudentenZuMatrikelNr(student.getMatrikelNr()).isEmpty() == false) {
      throw new StudentExistentException();
    } else {
      studentDAO.speichere(student);
    }
  }

  @Override
  public void loescheAlle() {
    studentDAO.loescheAlle();
  }

}
TOP

Related Classes of de.nak.notendb.service.StudentServiceImpl

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.