Subida incial del esqueleto del componente profile:
* Clases de ejb FacadeBean y FacadeRemote con implementación incial. * Clases de persistencia JPA necesarias para el componente con algunas relaciones configuradas (Necesaria revisión). * ClasesTO (Transfer Object) iniciales (Necesitan revisión profunda). * Cambio de estrategia sobre paquetes para clases TO, es necesario ubicarlas en el mismo paquete, ya que se comparten por varios componentes. Se sigue la misma estrategia que con las clases JPA. * Si alguien necesita utilizar alguna clase JPA debe revisarla (Seguro que faltan relaciones). * Creadas clases esqueleto (Dummy) para MBean del componente perfil. * Se ha eliminado paquetes no necesarios (clases TO). * En principio el proyecto debería compilar. * Se asume que el equema de base de datos se llamará "MyHealth" (Ver anotación en clases JPA.
This commit is contained in:
84
1.sources/MyHealth/src/TO/FamilyDoctorTO.java
Normal file
84
1.sources/MyHealth/src/TO/FamilyDoctorTO.java
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package TO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "FamilyDoctor")
|
||||||
|
public class FamilyDoctorTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public FamilyDoctorTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FamilyDoctorTO(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
this.setId(id);
|
||||||
|
this.setNif(nif);
|
||||||
|
this.setName(name);
|
||||||
|
this.setSurname(surname);
|
||||||
|
this.setPassword(password);
|
||||||
|
this.setEmail(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String nif) {
|
||||||
|
this.nif = nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
44
1.sources/MyHealth/src/TO/MedicalSpecialtyTO.java
Normal file
44
1.sources/MyHealth/src/TO/MedicalSpecialtyTO.java
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package TO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "medicalspeciality")
|
||||||
|
public class MedicalSpecialtyTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public MedicalSpecialtyTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicalSpecialtyTO(String name, String description) {
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
1.sources/MyHealth/src/TO/MedicalTestTO.java
Normal file
23
1.sources/MyHealth/src/TO/MedicalTestTO.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package TO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "MedicalTest")
|
||||||
|
public class MedicalTestTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
public MedicalTestTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
91
1.sources/MyHealth/src/TO/PatientTO.java
Normal file
91
1.sources/MyHealth/src/TO/PatientTO.java
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
package TO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import jpa.FamilyDoctorJPA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "Patient")
|
||||||
|
public class PatientTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String email;
|
||||||
|
private FamilyDoctorTO familyDoctor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor methods
|
||||||
|
*/
|
||||||
|
public PatientTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PatientTO(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
this.setId(id);
|
||||||
|
this.setNif(nif);
|
||||||
|
this.setName(name);
|
||||||
|
this.setSurname(surname);
|
||||||
|
this.setPassword(password);
|
||||||
|
this.setEmail(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String nif) {
|
||||||
|
this.nif = nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
23
1.sources/MyHealth/src/TO/PrimaryHealthCareCenterTO.java
Normal file
23
1.sources/MyHealth/src/TO/PrimaryHealthCareCenterTO.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package TO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "PrimaryHealthCareCenter")
|
||||||
|
public class PrimaryHealthCareCenterTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
84
1.sources/MyHealth/src/TO/SpecialistDoctorTO.java
Normal file
84
1.sources/MyHealth/src/TO/SpecialistDoctorTO.java
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package TO;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "SpecialistDoctor")
|
||||||
|
public class SpecialistDoctorTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
public SpecialistDoctorTO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpecialistDoctorTO(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
this.setId(id);
|
||||||
|
this.setNif(nif);
|
||||||
|
this.setName(name);
|
||||||
|
this.setSurname(surname);
|
||||||
|
this.setPassword(password);
|
||||||
|
this.setEmail(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String nif) {
|
||||||
|
this.nif = nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package TO.systemAdmin;
|
package TO;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
* @author mark
|
* @author mark
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "SystemAdminTO")
|
@XmlRootElement(name = "SystemAdmin")
|
||||||
public class SystemAdminTO implements Serializable {
|
public class SystemAdminTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package TO.visit;
|
package TO;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||||||
* @author mark
|
* @author mark
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@XmlRootElement(name = "TestClass")
|
@XmlRootElement(name = "Visit")
|
||||||
public class VisitTO implements Serializable {
|
public class VisitTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package TO.medicalTest;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transfer object (TO) MedicalSpecialtyTO Para el intercambio de datos entre la
|
|
||||||
* capa de interfaz y la capa de negocio
|
|
||||||
*
|
|
||||||
* Además esta clase facilita la implementación futura de una Capa SOA (Se
|
|
||||||
* define la anotación para la serialización de esta clase: @XmlRootElement(name
|
|
||||||
* = "medicalspeciality")
|
|
||||||
*
|
|
||||||
* @author mark
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "MedicalTestTO")
|
|
||||||
public class MedicalTestTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
public MedicalTestTO() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package TO.profile;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Transfer object (TO) MedicalSpecialtyTO Para el intercambio de datos entre la
|
|
||||||
* capa de interfaz y la capa de negocio
|
|
||||||
*
|
|
||||||
* Además esta clase facilita la implementación futura de una Capa SOA (Se
|
|
||||||
* define la anotación para la serialización de esta clase: @XmlRootElement(name
|
|
||||||
* = "medicalspeciality")
|
|
||||||
*
|
|
||||||
* @author mark
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@XmlRootElement(name = "ProfileTO")
|
|
||||||
public class ProfileTO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
public ProfileTO() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,13 +4,20 @@ import javax.ejb.Stateless;
|
|||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
|
||||||
|
import TO.FamilyDoctorTO;
|
||||||
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.PatientTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
import TO.SpecialistDoctorTO;
|
||||||
|
import jpa.FamilyDoctorJPA;
|
||||||
|
import jpa.MedicalSpecialtyJPA;
|
||||||
|
import jpa.PatientJPA;
|
||||||
|
import jpa.PrimaryHealthCareCenterJPA;
|
||||||
|
import jpa.SpecialistDoctorJPA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EJB Session Bean Class para la Practica 2, Ejercicio 1 (ISCSD) Implementa los
|
|
||||||
* métodos de la capa de negocio que implementan la logica de negocio y la
|
|
||||||
* interacción con la capa de persistencia.
|
|
||||||
*
|
*
|
||||||
* @author mark
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Stateless
|
@Stateless
|
||||||
@@ -20,9 +27,145 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
@PersistenceContext(unitName = "MyHealth")
|
@PersistenceContext(unitName = "MyHealth")
|
||||||
private EntityManager entman;
|
private EntityManager entman;
|
||||||
|
|
||||||
public void ejbMethod(String parameter)
|
public PatientTO changeFamilyDoctor(String id, String ProfessionalNumberId) {
|
||||||
{
|
PatientTO paTO = null;
|
||||||
|
|
||||||
|
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, ProfessionalNumberId);
|
||||||
|
PatientJPA pa = entman.find(PatientJPA.class, id);
|
||||||
|
|
||||||
|
if (fd != null && pa != null) {
|
||||||
|
pa.setFamilyDoctor(fd);
|
||||||
|
paTO = new PatientTO();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return paTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PatientTO registerPacient(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
PatientTO paTO = null;
|
||||||
|
|
||||||
|
PatientJPA ms = new PatientJPA(id, nif, name, surname, password, email);
|
||||||
|
entman.persist(ms);
|
||||||
|
paTO = new PatientTO(ms.getId(), ms.getNif(), ms.getName(), ms.getSurname(), ms.getPassword(), ms.getEmail());
|
||||||
|
|
||||||
|
return paTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpecialistDoctorTO registerSpecialistDoctor(String id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) {
|
||||||
|
SpecialistDoctorTO sdTO = null;
|
||||||
|
|
||||||
|
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getName());
|
||||||
|
|
||||||
|
// TODO: Lanzar error si no se encuentra la especialidad.
|
||||||
|
if (ms != null) {
|
||||||
|
SpecialistDoctorJPA sd = new SpecialistDoctorJPA(id, nif, name, surname, password, email);
|
||||||
|
entman.persist(sd);
|
||||||
|
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
return sdTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FamilyDoctorTO registerFamilyDoctor1(String id, String nif, String name, String surname, String password, String email, String cap) {
|
||||||
|
FamilyDoctorTO fdTO = null;
|
||||||
|
|
||||||
|
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap);
|
||||||
|
|
||||||
|
// TODO: Lanzar error si no encontramos el cap!!!!!
|
||||||
|
if (phcC != null) {
|
||||||
|
|
||||||
|
FamilyDoctorJPA fd = new FamilyDoctorJPA(id, nif, name, surname, password, email);
|
||||||
|
fd.setPrimaryHealthCareCenter(phcC);
|
||||||
|
|
||||||
|
entman.persist(fd);
|
||||||
|
|
||||||
|
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fdTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PatientTO updatePacientData(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
PatientJPA fd = entman.find(PatientJPA.class, id);
|
||||||
|
PatientTO ptTO = null;
|
||||||
|
|
||||||
|
if (fd != null) {
|
||||||
|
fd.setNif(nif);
|
||||||
|
fd.setName(name);
|
||||||
|
fd.setSurname(surname);
|
||||||
|
fd.setPassword(password);
|
||||||
|
fd.setEmail(email);
|
||||||
|
|
||||||
|
entman.persist(fd);
|
||||||
|
|
||||||
|
ptTO = new PatientTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
return ptTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpecialistDoctorTO updateSpecialistDoctorData(String id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) {
|
||||||
|
SpecialistDoctorTO sdTO = null;
|
||||||
|
|
||||||
|
SpecialistDoctorJPA sd = entman.find(SpecialistDoctorJPA.class, id);
|
||||||
|
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getName());
|
||||||
|
|
||||||
|
// TODO: Lanzar error al no encontrar la especialidad indicada ?????
|
||||||
|
|
||||||
|
if (sd != null && ms != null) {
|
||||||
|
sd.setNif(nif);
|
||||||
|
sd.setName(name);
|
||||||
|
sd.setSurname(surname);
|
||||||
|
sd.setPassword(password);
|
||||||
|
sd.setEmail(email);
|
||||||
|
sd.setMedicalSpecialty(ms);
|
||||||
|
|
||||||
|
entman.persist(sd);
|
||||||
|
|
||||||
|
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
return sdTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FamilyDoctorTO updateFamilyDoctorData(String id, String nif, String name, String surname, String password, String email, String cap) {
|
||||||
|
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, id);
|
||||||
|
FamilyDoctorTO fdTO = null;
|
||||||
|
|
||||||
|
if (fd != null) {
|
||||||
|
fd.setNif(nif);
|
||||||
|
fd.setName(name);
|
||||||
|
fd.setSurname(surname);
|
||||||
|
fd.setPassword(password);
|
||||||
|
fd.setEmail(email);
|
||||||
|
|
||||||
|
// TODO: Es posible actualizar el cap? ¿No debería utilizar el método
|
||||||
|
// changePrimaryHealthCareCenter?
|
||||||
|
// cap debería ser PrimaryHealthCareCenterTO newCenter
|
||||||
|
// fd.setPrimaryHealthCareCenter(cap);
|
||||||
|
|
||||||
|
entman.persist(fd);
|
||||||
|
|
||||||
|
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
||||||
|
}
|
||||||
|
|
||||||
|
return fdTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FamilyDoctorTO changePrimaryHealthCareCenter(String FamilyDoctorId, PrimaryHealthCareCenterTO newCenter) {
|
||||||
|
FamilyDoctorTO fdTO = null;
|
||||||
|
|
||||||
|
PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, newCenter);
|
||||||
|
FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, FamilyDoctorId);
|
||||||
|
|
||||||
|
if (phcC != null && fd != null) {
|
||||||
|
fd.setPrimaryHealthCareCenter(phcC);
|
||||||
|
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return fdTO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,35 @@ package ejb.profile;
|
|||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
|
import TO.FamilyDoctorTO;
|
||||||
|
import TO.MedicalSpecialtyTO;
|
||||||
|
import TO.PatientTO;
|
||||||
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
|
import TO.SpecialistDoctorTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interfaz remota del EJB Definimos los métodos que estarán disponibles para
|
|
||||||
* los clientes del EJB
|
|
||||||
*
|
*
|
||||||
* @author mark
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Remote
|
@Remote
|
||||||
public interface ProfileFacadeRemote {
|
public interface ProfileFacadeRemote {
|
||||||
/**
|
|
||||||
* Definimos la interfaz remota
|
public PatientTO changeFamilyDoctor(String id, String ProfessionalNumberId);
|
||||||
*/
|
|
||||||
public void ejbMethod(String parameter);
|
public PatientTO registerPacient(String id, String nif, String name, String surname, String password, String email);
|
||||||
|
|
||||||
|
public SpecialistDoctorTO registerSpecialistDoctor(String id, String nif, String name, String surname, String password, String email,
|
||||||
|
MedicalSpecialtyTO specialty);
|
||||||
|
|
||||||
|
public FamilyDoctorTO registerFamilyDoctor1(String id, String nif, String name, String surname, String password, String email, String cap);
|
||||||
|
|
||||||
|
public PatientTO updatePacientData(String id, String nif, String name, String surname, String password, String email);
|
||||||
|
|
||||||
|
public SpecialistDoctorTO updateSpecialistDoctorData(String id, String nif, String name, String surname, String password, String email,
|
||||||
|
MedicalSpecialtyTO specialty);
|
||||||
|
|
||||||
|
public FamilyDoctorTO updateFamilyDoctorData(String id, String nif, String name, String surname, String password, String email, String cap);
|
||||||
|
|
||||||
|
public FamilyDoctorTO changePrimaryHealthCareCenter(String id, PrimaryHealthCareCenterTO newCenter);
|
||||||
}
|
}
|
||||||
125
1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java
Normal file
125
1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
package jpa;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "MyHealth.FamilyDoctor")
|
||||||
|
public class FamilyDoctorJPA implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String email;
|
||||||
|
private Collection<PatientJPA> patients;
|
||||||
|
private PrimaryHealthCareCenterJPA primaryHealthCareCenter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor methods
|
||||||
|
*/
|
||||||
|
public FamilyDoctorJPA() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FamilyDoctorJPA(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
this.id = id;
|
||||||
|
this.nif = nif;
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
this.password = password;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String value) {
|
||||||
|
this.id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String value) {
|
||||||
|
this.nif = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String value) {
|
||||||
|
this.name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metodos para get/set de relaciones (pacientes)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||||
|
@JoinColumn(name = "FamilyDoctorId")
|
||||||
|
public Collection<PatientJPA> getPatients() {
|
||||||
|
return patients;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPatients(Collection<PatientJPA> patients) {
|
||||||
|
this.patients = patients;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn (name="PrimaryHealthCareCenterId")
|
||||||
|
public PrimaryHealthCareCenterJPA getPrimaryHealthCareCenter() {
|
||||||
|
return primaryHealthCareCenter;
|
||||||
|
}
|
||||||
|
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterJPA center) {
|
||||||
|
this.primaryHealthCareCenter = center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -6,12 +6,14 @@ import javax.persistence.Entity;
|
|||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
/**
|
/***
|
||||||
* Calse JPA MedicalSpecialty, para interactuar con la base de datos.
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "TestTable")
|
@Table(name = "MyHealth.MedicalSpecialty")
|
||||||
public class TestTableJPA implements Serializable {
|
public class MedicalSpecialtyJPA implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -22,11 +24,11 @@ public class TestTableJPA implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Class constructor methods
|
* Class constructor methods
|
||||||
*/
|
*/
|
||||||
public TestTableJPA() {
|
public MedicalSpecialtyJPA() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TestTableJPA(String name, String description) {
|
public MedicalSpecialtyJPA(String name, String description) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
107
1.sources/MyHealth/src/jpa/PatientJPA.java
Normal file
107
1.sources/MyHealth/src/jpa/PatientJPA.java
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
package jpa;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "MyHealth.Patient")
|
||||||
|
public class PatientJPA implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String email;
|
||||||
|
private FamilyDoctorJPA familyDoctor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor methods
|
||||||
|
*/
|
||||||
|
public PatientJPA() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PatientJPA(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
this.id = id;
|
||||||
|
this.nif = nif;
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
this.password = password;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String value) {
|
||||||
|
this.id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String value) {
|
||||||
|
this.nif = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String value) {
|
||||||
|
this.name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Methods get/set persistent relationships
|
||||||
|
*/
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn (name="FamilyDoctorId")
|
||||||
|
public FamilyDoctorJPA getFamilyDoctor() {
|
||||||
|
return familyDoctor;
|
||||||
|
}
|
||||||
|
public void setFamilyDoctor(FamilyDoctorJPA familyDoc) {
|
||||||
|
this.familyDoctor = familyDoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
52
1.sources/MyHealth/src/jpa/PrimaryHealthCareCenterJPA.java
Normal file
52
1.sources/MyHealth/src/jpa/PrimaryHealthCareCenterJPA.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
package jpa;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "MyHealth.PrimaryHealthCareCenter")
|
||||||
|
public class PrimaryHealthCareCenterJPA implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor methods
|
||||||
|
*/
|
||||||
|
public PrimaryHealthCareCenterJPA() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PrimaryHealthCareCenterJPA(String name, String description) {
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
105
1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java
Normal file
105
1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
package jpa;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "MyHealth.SpecialistDoctor")
|
||||||
|
public class SpecialistDoctorJPA implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
private String nif;
|
||||||
|
private String name;
|
||||||
|
private String surname;
|
||||||
|
private String password;
|
||||||
|
private String email;
|
||||||
|
private MedicalSpecialtyJPA medicalSpecialty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor methods
|
||||||
|
*/
|
||||||
|
public SpecialistDoctorJPA() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpecialistDoctorJPA(String id, String nif, String name, String surname, String password, String email) {
|
||||||
|
this.id = id;
|
||||||
|
this.nif = nif;
|
||||||
|
this.name = name;
|
||||||
|
this.surname = surname;
|
||||||
|
this.password = password;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Id
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String value) {
|
||||||
|
this.id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNif() {
|
||||||
|
return nif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNif(String value) {
|
||||||
|
this.nif = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String value) {
|
||||||
|
this.name = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSurname() {
|
||||||
|
return surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurname(String surname) {
|
||||||
|
this.surname = surname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmail(String email) {
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "MedicalSpecialtyName")
|
||||||
|
public MedicalSpecialtyJPA getMedicalSpecialty() {
|
||||||
|
return medicalSpecialty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedicalSpecialty(MedicalSpecialtyJPA specialty) {
|
||||||
|
this.medicalSpecialty = specialty;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "AddFamilyDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class AddFamilyDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public AddFamilyDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,9 +18,9 @@ import ejb.profile.ProfileFacadeRemote;
|
|||||||
* @author mark
|
* @author mark
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ManagedBean(name = "ManagedBeanName")
|
@ManagedBean(name = "AddPatientMBean")
|
||||||
@SessionScoped
|
@SessionScoped
|
||||||
public class ProfileMBean implements Serializable {
|
public class AddPatientMBean implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public class ProfileMBean implements Serializable {
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public ProfileMBean() throws Exception {
|
public AddPatientMBean() throws Exception {
|
||||||
initializeAdminFacadeRemote();
|
initializeAdminFacadeRemote();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "AddSpecialistDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class AddSpecialistDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public AddSpecialistDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "ChangeFamilyDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class ChangeFamilyDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ChangeFamilyDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "ChangePrimaryHealthCareCenterMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class ChangePrimaryHealthCareCenterMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ChangePrimaryHealthCareCenterMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "ShowFamilyDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class ShowFamilyDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ShowFamilyDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "ShowPatientMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class ShowPatientMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ShowPatientMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "ShowSpecialistDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class ShowSpecialistDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ShowSpecialistDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "UpdateFamilyDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class UpdateFamilyDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public UpdateFamilyDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "UpdatePatientMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class UpdatePatientMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public UpdatePatientMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package managedbean.profile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import javax.ejb.EJB;
|
||||||
|
import javax.faces.bean.ManagedBean;
|
||||||
|
import javax.faces.bean.SessionScoped;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
|
||||||
|
import ejb.profile.ProfileFacadeRemote;
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@ManagedBean(name = "UpdateSpecialistDoctorMBean")
|
||||||
|
@SessionScoped
|
||||||
|
public class UpdateSpecialistDoctorMBean implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EJB
|
||||||
|
private ProfileFacadeRemote remoteManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public UpdateSpecialistDoctorMBean() throws Exception {
|
||||||
|
initializeAdminFacadeRemote();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inicializa la conexión con el EJB Remoto
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void initializeAdminFacadeRemote() throws Exception {
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
Context ctx = new InitialContext(props);
|
||||||
|
remoteManager = (ProfileFacadeRemote) ctx
|
||||||
|
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user