From cec37b8eddc45159e618b021c4c9a009f25852e2 Mon Sep 17 00:00:00 2001 From: David Alvarez Gonzalez Date: Sun, 22 Dec 2019 11:46:11 +0100 Subject: [PATCH] =?UTF-8?q?Revert=20"Modificaci=C3=B3n=20y=20borrado=20de?= =?UTF-8?q?=20especialidades"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4aeec0c31b38ed98967e8672632e5a50974230d8 --- .../systemAdmin/ManageSpecialties.xhtml | 31 ++----------- .../systemAdmin/SystemAdminFacadeBean.java | 21 +-------- .../systemAdmin/SystemAdminFacadeRemote.java | 8 ++-- .../systemAdmin/ManageSpecialitiesMBean.java | 46 +------------------ 4 files changed, 10 insertions(+), 96 deletions(-) diff --git a/1.sources/MyHealth/docroot/systemAdmin/ManageSpecialties.xhtml b/1.sources/MyHealth/docroot/systemAdmin/ManageSpecialties.xhtml index 04ba735..37061e9 100644 --- a/1.sources/MyHealth/docroot/systemAdmin/ManageSpecialties.xhtml +++ b/1.sources/MyHealth/docroot/systemAdmin/ManageSpecialties.xhtml @@ -8,7 +8,7 @@ - +
@@ -20,42 +20,19 @@
- +
- +
-
- -
-
- -
-
-
- - -
-
- -
-
- -
-
- -
-
- -
- +
diff --git a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java index 787169a..f0b239f 100644 --- a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java @@ -16,6 +16,7 @@ import common.UserType; import ejb.common.CommonFacadeLocal; import jpa.AdministratorJPA; import jpa.MedicalSpecialtyJPA; +import jpa.PatientJPA; /** * @@ -125,24 +126,4 @@ 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); - } } diff --git a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeRemote.java b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeRemote.java index f4ab02d..7c8cfe9 100644 --- a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeRemote.java +++ b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeRemote.java @@ -1,9 +1,13 @@ package ejb.systemAdmin; +import java.util.Collection; + import javax.ejb.Remote; import TO.LoggedUserTO; import TO.MedicalSpecialtyTO; +import TO.PatientTO; +import TO.PrimaryHealthCareCenterTO; /** * @@ -19,8 +23,4 @@ public interface SystemAdminFacadeRemote { public LoggedUserTO login(String id, String pwd); public MedicalSpecialtyTO updateSpecialtyData(int id, String name, String description) throws Exception; - - public void deleteSpecialtyData(int id, String name, String description) throws Exception; - - public MedicalSpecialtyTO insertSpecialtyData(String name, String description) throws Exception; } \ No newline at end of file diff --git a/1.sources/MyHealth/src/managedbean/systemAdmin/ManageSpecialitiesMBean.java b/1.sources/MyHealth/src/managedbean/systemAdmin/ManageSpecialitiesMBean.java index c225f76..8a12fc3 100644 --- a/1.sources/MyHealth/src/managedbean/systemAdmin/ManageSpecialitiesMBean.java +++ b/1.sources/MyHealth/src/managedbean/systemAdmin/ManageSpecialitiesMBean.java @@ -6,6 +6,7 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; import javax.inject.Named; import TO.LoggedUserTO; @@ -114,49 +115,4 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ } } } - - public void deleteData() { - int error = 0; - - if (this.medicalSpecialty.getName() == null) { - this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad."); - error++; - } - if (this.medicalSpecialty.getDescription() == null) { - this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción."); - error++; - } - - if (error == 0) { - try { - this.getRemoteManagerSystemAdmin().deleteSpecialtyData(this.medicalSpecialty.getId(), this.medicalSpecialty.getName(), this.medicalSpecialty.getDescription()); - this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los especialidad se ha borrado", "Los datos de la especialidad se han borrado correctamente."); - } catch (Exception e) { - this.manageException(e); - } - } - } - - public void insertData() { - int error = 0; - - if (name == null || name.trim().length() == 0) { - this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Nombre no relleno", "Por favor, escriba un nombre de especialidad."); - error++; - } - if (description == null || description.trim().length() == 0) { - this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Descripción no rellena", "Por favor, escriba una descripción."); - error++; - } - - if (error == 0) { - try { - MedicalSpecialtyTO ms = this.getRemoteManagerSystemAdmin().insertSpecialtyData(name, description); - this.setSpecialtyData(ms); - this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de la especialidad se han guardado correctamente."); - } catch (Exception e) { - this.manageException(e); - } - } - } }