Package de.nak.notendb.service

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

package de.nak.notendb.service;

import java.util.List;

import de.nak.notendb.dao.ManipelDAO;
import de.nak.notendb.model.Manipel;

/**
* Implementation des ManipelService fuer die Verwaltung von Manipeln
*
* @author Julian Pusch
*
*/
public class ManipelServiceImpl implements ManipelService {
 
  private ManipelDAO manipelDAO;
 
  public void setManipelDAO(ManipelDAO manipelDAO) {
    this.manipelDAO = manipelDAO;
  }

  @Override
  public Manipel ladeManipel(long manipelId) throws ManipelNichtGefundenException {
    Manipel manipel = manipelDAO.lade(manipelId);
    if (manipel == null) {
      throw new ManipelNichtGefundenException();
    }
    return manipel;
  }
 
  @Override
  public void speichere(Manipel manipel) throws ManipelExistentException {
    if (manipelDAO.ladeManipelPerJahrgangUndStudienrichtung
        (manipel.getJahrgang(), manipel.getStudienrichtung()).isEmpty() == false) {
      throw new ManipelExistentException();
    } else {
      manipelDAO.speichere(manipel);
    }
  }

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

  @Override
  public List<Manipel> ladeAlle() {
    return manipelDAO.ladeAlle();
  }

}
TOP

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

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.