Modificación y borrado de especialidades

This commit is contained in:
dalvarezgon
2019-12-21 23:10:13 +01:00
parent b815680649
commit 4aeec0c31b
4 changed files with 96 additions and 10 deletions

View File

@@ -16,7 +16,6 @@ import common.UserType;
import ejb.common.CommonFacadeLocal;
import jpa.AdministratorJPA;
import jpa.MedicalSpecialtyJPA;
import jpa.PatientJPA;
/**
*
@@ -126,4 +125,24 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
}
@Override
public void deleteSpecialtyData(int id, String name, String description) throws Exception {
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
if (ms == null) {
throw new Exception("No se puede borrar la especialidad porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id));
}
entman.remove(ms);
}
@Override
public MedicalSpecialtyTO insertSpecialtyData(String name, String description) throws Exception {
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
entman.persist(ms);
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
}
}