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

@@ -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);
}
}