Métodos componente system admin agregados a documento entrega
This commit is contained in:
@@ -27,7 +27,7 @@ import jpa.PrimaryHealthCareCenterJPA;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author David Álvarez González (dalvarezgon@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Stateless
|
@Stateless
|
||||||
@@ -41,22 +41,22 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
CommonFacadeLocal commonServices;
|
CommonFacadeLocal commonServices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Si la autenticación no es correcgta devuelve null, sino devuelve un POJO con datos del usuario logeado.
|
* Si la autenticación no es correcta devuelve null, sino devuelve un POJO con datos del usuario logeado.
|
||||||
*
|
*
|
||||||
* La autenticación se realiza en 2 pasos:
|
* La autenticación se realiza en 2 pasos:
|
||||||
*
|
*
|
||||||
* Paso 1. Se intenta localizar un registro de usuario, por orden:
|
* Paso 1. Se intenta localizar un registro de usuario, por orden:
|
||||||
*
|
*
|
||||||
* a. Primero Paciente, si el identificador comienza por los caracteres correctos.
|
* a. Primero, paciente, si el identificador comienza por los caracteres correctos.
|
||||||
*
|
*
|
||||||
* b.Después médico de familia, si el identificador es de profesional
|
* b. Después, médico de familia, si el identificador es de profesional
|
||||||
*
|
*
|
||||||
* c. Si no lo localizamos buscamos el identificador en la tabla de médicos especialistas (el identificador es de profesional)
|
* c. Si no lo localizamos buscamos el identificador en la tabla de médicos especialistas (el identificador es de profesional)
|
||||||
*
|
*
|
||||||
* d. Si no hemos localizado aún al usuario, lo buscamos en la tabla de administradores, aún cuando el identificador comience por cualquier carácter (podría ser una dirección
|
* d. Si no hemos localizado aún al usuario, lo buscamos en la tabla de administradores, aún cuando el identificador comience por cualquier carácter (podría ser una dirección
|
||||||
* de email que comienza por caracteres del identificaodr de paciente o profesional)
|
* de email que comienza por caracteres del identificador de paciente o profesional)
|
||||||
*
|
*
|
||||||
* Paso 2. Si hemos localizado un registro de usuario, verificamos si el password recibido coincide con el de la base de datos, en tal caso la autenticación se compelta y es
|
* Paso 2. Si hemos localizado un registro de usuario, verificamos si el password recibido coincide con el de la base de datos, en tal caso la autenticación se completa y es
|
||||||
* correcta.
|
* correcta.
|
||||||
*/
|
*/
|
||||||
public LoggedUserTO login(String userCode, String pwd) {
|
public LoggedUserTO login(String userCode, String pwd) {
|
||||||
@@ -118,24 +118,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return usr;
|
return usr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listSpecialtiesPaged(int pageNumber, int pageSize) {
|
|
||||||
TypedQuery<MedicalSpecialtyJPA> query = entman.createQuery("SELECT s from MedicalSpecialtyJPA s order by s.name", MedicalSpecialtyJPA.class);
|
|
||||||
|
|
||||||
if (pageSize > 0) {
|
|
||||||
query.setFirstResult(pageNumber * pageSize);
|
|
||||||
query.setMaxResults(pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<MedicalSpecialtyJPA> allJPA = query.getResultList();
|
|
||||||
List<MedicalSpecialtyTO> specialties = new ArrayList<MedicalSpecialtyTO>();
|
|
||||||
|
|
||||||
for (MedicalSpecialtyJPA item : allJPA) {
|
|
||||||
specialties.add(commonServices.getPOJOforMedicalSpecialtyJPA(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
return specialties;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getSpecialtiesCount() {
|
public Long getSpecialtiesCount() {
|
||||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from MedicalSpecialtyJPA", Long.class);
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from MedicalSpecialtyJPA", Long.class);
|
||||||
|
|
||||||
@@ -236,24 +218,6 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote {
|
|||||||
return query.getSingleResult();
|
return query.getSingleResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize) {
|
|
||||||
TypedQuery<PrimaryHealthCareCenterJPA> query = entman.createQuery("SELECT c from PrimaryHealthCareCenterJPA c order by c.name", PrimaryHealthCareCenterJPA.class);
|
|
||||||
|
|
||||||
if (pageSize > 0) {
|
|
||||||
query.setFirstResult(pageNumber * pageSize);
|
|
||||||
query.setMaxResults(pageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PrimaryHealthCareCenterJPA> allJPA = query.getResultList();
|
|
||||||
List<PrimaryHealthCareCenterTO> caps = new ArrayList<PrimaryHealthCareCenterTO>();
|
|
||||||
|
|
||||||
for (PrimaryHealthCareCenterJPA item : allJPA) {
|
|
||||||
caps.add(commonServices.getPOJOforPrimaryHealthCareCenterJPA(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
return caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId) {
|
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId) {
|
||||||
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId", Long.class);
|
TypedQuery<Long> query = entman.createQuery("SELECT count(1) from FamilyDoctorJPA d where d.primaryHealthCareCenter.id=:capId", Long.class);
|
||||||
query.setParameter("capId", primaryHealthCareCenterId);
|
query.setParameter("capId", primaryHealthCareCenterId);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import TO.SystemAdminTO;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Marcos García Núñez (mgarcianun@uoc.edu)
|
* @author David Alvarez González (dalvarezgon@uoc.edu)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Remote
|
@Remote
|
||||||
@@ -23,8 +23,6 @@ public interface SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
public LoggedUserTO login(String id, String pwd);
|
public LoggedUserTO login(String id, String pwd);
|
||||||
|
|
||||||
public List<MedicalSpecialtyTO> listSpecialtiesPaged(int pageNumber, int pageSize);
|
|
||||||
|
|
||||||
public Long getSpecialtiesCount();
|
public Long getSpecialtiesCount();
|
||||||
|
|
||||||
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception;
|
public MedicalSpecialtyTO updateSpecialty(int id, String name, String description) throws Exception;
|
||||||
@@ -45,8 +43,6 @@ public interface SystemAdminFacadeRemote {
|
|||||||
|
|
||||||
public Long getCAPCount();
|
public Long getCAPCount();
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> listCAPsPaged(int pageNumber, int pageSize);
|
|
||||||
|
|
||||||
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId);
|
public Long getFamilyDoctorsByCAPCount(int primaryHealthCareCenterId);
|
||||||
|
|
||||||
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize);
|
public List<FamilyDoctorTO> listAllFamilyDoctorsByCAPPaged(int primaryHealthCareCenterId, int pageNumber, int pageSize);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ManageHealthCareCentersMBean extends ManagedBeanBase implements Ser
|
|||||||
Long totalRowCount = getRemoteManagerSystemAdmin().getCAPCount();
|
Long totalRowCount = getRemoteManagerSystemAdmin().getCAPCount();
|
||||||
this.setRowCount(totalRowCount.intValue());
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
return getRemoteManagerSystemAdmin().listCAPsPaged((first / pageSize), pageSize);
|
return getRemoteManagerCommon().listCAPsPaged((first / pageSize), pageSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ManageSpecialitiesMBean extends ManagedBeanBase implements Serializ
|
|||||||
Long totalRowCount = getRemoteManagerSystemAdmin().getSpecialtiesCount();
|
Long totalRowCount = getRemoteManagerSystemAdmin().getSpecialtiesCount();
|
||||||
this.setRowCount(totalRowCount.intValue());
|
this.setRowCount(totalRowCount.intValue());
|
||||||
|
|
||||||
return getRemoteManagerSystemAdmin().listSpecialtiesPaged((first / pageSize), pageSize);
|
return getRemoteManagerCommon().listMedicalSpecialtiesPaged((first / pageSize), pageSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user