Organización de controles en la pantalla de alta de administradores.
Conversión a minusculas de la dirección de email de los administradores.
This commit is contained in:
@@ -112,7 +112,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return usr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||
|
||||
@@ -140,7 +139,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSpecialty(int id) throws Exception {
|
||||
MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, id);
|
||||
|
||||
@@ -151,7 +149,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
entman.remove(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MedicalSpecialtyTO insertSpecialty(String name, String description) throws Exception {
|
||||
MedicalSpecialtyJPA ms = new MedicalSpecialtyJPA(name, description);
|
||||
entman.persist(ms);
|
||||
@@ -159,7 +156,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return this.commonServices.getPOJOforMedicalSpecialtyJPA(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryHealthCareCenterTO updateHealthCareCenter(int id, String name, String location) throws Exception {
|
||||
PrimaryHealthCareCenterJPA ms = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||
|
||||
@@ -175,7 +171,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(ms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryHealthCareCenterTO findHealthCareCenterByName(String searchedName) {
|
||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("from PrimaryHealthCareCenterJPA cap where cap.name=:name", PrimaryHealthCareCenterJPA.class);
|
||||
query.setMaxResults(1);
|
||||
@@ -188,7 +183,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteHealthCareCenter(int id) throws Exception {
|
||||
PrimaryHealthCareCenterJPA cap = entman.find(PrimaryHealthCareCenterJPA.class, id);
|
||||
|
||||
@@ -199,7 +193,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
entman.remove(cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryHealthCareCenterTO insertHealthCareCenter(String name, String location) throws Exception {
|
||||
PrimaryHealthCareCenterJPA cap = new PrimaryHealthCareCenterJPA(name, location);
|
||||
entman.persist(cap);
|
||||
@@ -207,14 +200,12 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return this.commonServices.getPOJOforPrimaryHealthCareCenterJPA(cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getCAPCount() {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from PrimaryHealthCareCenterJPA", Long.class);
|
||||
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize) {
|
||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("SELECT c from PrimaryHealthCareCenterJPA c order by c.name", PrimaryHealthCareCenterJPA.class);
|
||||
|
||||
@@ -233,7 +224,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return caps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize) {
|
||||
List<FamilyDoctorTO> familyDoctorsByCAP = new ArrayList<FamilyDoctorTO>();
|
||||
|
||||
@@ -254,8 +244,7 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
|
||||
return familyDoctorsByCAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Long getPatientCount(int familyDoctorId) {
|
||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from PatientJPA p where p.familyDoctor.id=:familyDoctorId", Long.class);
|
||||
query.setParameter("familyDoctorId", familyDoctorId);
|
||||
@@ -263,7 +252,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return query.getSingleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemAdminTO findAdminByEmail(String email) {
|
||||
TypedQuery<SystemAdminJPA> query = entman.createQuery("from SystemAdminJPA a where a.email=:email", SystemAdminJPA.class);
|
||||
query.setMaxResults(1);
|
||||
@@ -276,7 +264,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemAdminTO insertAdmin(String email, String password) throws Exception {
|
||||
SystemAdminJPA admin = new SystemAdminJPA(email, password);
|
||||
entman.persist(admin);
|
||||
|
||||
@@ -56,17 +56,24 @@ public class AddAdminMBean extends ManagedBeanBase implements Serializable {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public boolean emailAlreadyRegistered(String email) {
|
||||
return this.getRemoteManagerSystemAdmin().findAdminByEmail(email) != null;
|
||||
}
|
||||
|
||||
public void insertData() {
|
||||
int error = 0;
|
||||
|
||||
if (this.getRemoteManagerSystemAdmin().findAdminByEmail(email) != null) {
|
||||
if (this.emailAlreadyRegistered(email) == true) {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Administrador ya existente", "El administrador ya se encuentra dado de alta");
|
||||
error++;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
this.getRemoteManagerSystemAdmin().insertAdmin(email, HashUtils.hashMD5(password));
|
||||
this.getRemoteManagerSystemAdmin().insertAdmin(email.toLowerCase(), HashUtils.hashMD5(password));
|
||||
|
||||
this.email = "";
|
||||
this.password = "";
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "El administrador se ha dado de alta", "Los datos del administrador se han guardado correctamente.");
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user