Añadidos custom Validators de JSF para validar NIF y email.

Configurada validación en cliente de email.
This commit is contained in:
Marcos Garcia Nuñez
2019-12-12 00:18:35 +01:00
parent 28b1192036
commit f63ba35621
7 changed files with 122 additions and 40 deletions

View File

@@ -159,7 +159,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return allFDTOs;
}
private MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) {
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) {
MedicalSpecialtyTO msTO = null;
if (ms != null) {
@@ -169,7 +169,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return msTO;
}
private PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) {
public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) {
PrimaryHealthCareCenterTO phcTO = null;
if (phc != null) {
@@ -179,7 +179,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return phcTO;
}
private SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) {
public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) {
SpecialistDoctorTO sdTO = null;
if (sd != null) {
@@ -194,7 +194,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return sdTO;
}
private FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) {
public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) {
FamilyDoctorTO fdTO = null;
if (fd != null) {
@@ -209,7 +209,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
return fdTO;
}
private PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) {
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) {
PatientTO paTO = null;
if (pat != null) {

View File

@@ -11,7 +11,9 @@ import TO.PatientTO;
import TO.PrimaryHealthCareCenterTO;
import TO.SpecialistDoctorTO;
import jpa.FamilyDoctorJPA;
import jpa.MedicalSpecialtyJPA;
import jpa.PatientJPA;
import jpa.PrimaryHealthCareCenterJPA;
import jpa.SpecialistDoctorJPA;
/**
@@ -52,4 +54,14 @@ public interface CommonFacadeLocal {
public SpecialistDoctorJPA findSpecialistDoctorByCode(String code);
public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms);
public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps);
public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc);
public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps);
public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps);
}

View File

@@ -57,12 +57,10 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
"No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(newDoctor));
}
PatientTO paTO = null;
pat.setFamilyDoctor(fd);
entman.persist(pat);
// CommonFacadeRemote common = new CommonFacadeBean();
return commonServices.findPatientById(pat.getId());
return this.commonServices.getPOJOforPatientJPA(pat, 1);
}
public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email) {
@@ -70,9 +68,8 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null);
entman.persist(pat);
paTO = new PatientTO(pat.getId(), this.getNextPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null);
return paTO;
return this.commonServices.getPOJOforPatientJPA(pat, 1);
}
public SpecialistDoctorTO registerSpecialistDoctor(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
@@ -85,10 +82,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
SpecialistDoctorJPA sd = new SpecialistDoctorJPA(this.getNextProfessionalNumber(), nif, name, surname, HashUtils.hashMD5(password), email, ms);
entman.persist(sd);
SpecialistDoctorTO sdTO = null;
sdTO = new SpecialistDoctorTO(sd.getId(), this.getNextProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty);
return sdTO;
return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1);
}
public FamilyDoctorTO registerFamilyDoctor(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception {
@@ -102,9 +96,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
FamilyDoctorJPA fd = new FamilyDoctorJPA(this.getNextProfessionalNumber(), nif, name, surname, HashUtils.hashMD5(password), email, phcC);
entman.persist(fd);
fdTO = new FamilyDoctorTO(fd.getId(), this.getNextProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), cap);
return fdTO;
return commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
}
public PatientTO updatePatientData(int id, String nif, String name, String surname, String password, String email) throws Exception {
@@ -124,10 +116,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
entman.persist(pat);
PatientTO patTO = null;
patTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null);
return patTO;
return this.commonServices.getPOJOforPatientJPA(pat, 1);
}
public SpecialistDoctorTO updateSpecialistDoctorData(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty)
@@ -153,10 +142,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
entman.persist(sd);
SpecialistDoctorTO sdTO = null;
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty);
return sdTO;
return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1);
}
public FamilyDoctorTO updateFamilyDoctorData(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phcTO) throws Exception {
@@ -181,10 +167,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
entman.persist(fd);
FamilyDoctorTO fdTO = null;
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phcTO);
return fdTO;
return this.commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
}
public FamilyDoctorTO changePrimaryHealthCareCenter(int professionalId, PrimaryHealthCareCenterTO newCenter) throws Exception {
@@ -202,8 +185,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
fd.setPrimaryHealthCareCenter(phcC);
entman.persist(fd);
fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), newCenter);
return fdTO;
return this.commonServices.getPOJOforFamilyDoctorJPA(fd, 1);
}
}