Mejoras en la gestión de excepciones.
This commit is contained in:
@@ -124,14 +124,23 @@ public class ManagedBeanBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void manageException(Exception ex) {
|
protected void manageException(Exception ex) {
|
||||||
String strType = "";
|
// TODO: Registrar en el log las exception
|
||||||
|
String strType = "runtime";
|
||||||
|
|
||||||
if (ex.getClass().equals(ViewExpiredException.class)) {
|
if (ex.getClass().equals(ViewExpiredException.class)) {
|
||||||
// Sessión expirada
|
// Sessión expirada
|
||||||
strType = "expired";
|
strType = "expired";
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Su sesión ha caducado", "Su sesión ha caducado, vuelva a logarse en el sistema.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Su sesión ha caducado", "Su sesión ha caducado, vuelva a logarse en el sistema.");
|
||||||
} else {
|
} else {
|
||||||
this.addFacesMessageKeep(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: " + ex.getLocalizedMessage());
|
String msg = "";
|
||||||
|
Throwable th = ex.getCause();
|
||||||
|
|
||||||
|
if (th != null)
|
||||||
|
msg = th.getLocalizedMessage();
|
||||||
|
else
|
||||||
|
msg = ex.getLocalizedMessage();
|
||||||
|
|
||||||
|
this.addFacesMessageKeep(FacesMessage.SEVERITY_ERROR, "Se ha producido un error inesperado", "Descripción del error: ".concat(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -50,27 +50,21 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ
|
|||||||
// Recuperamos el usuario logeado actual
|
// Recuperamos el usuario logeado actual
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
this.lastUIQuery = "";
|
this.lastUIQuery = "";
|
||||||
try {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
else {
|
||||||
else {
|
this.id = Integer.valueOf(usr.getId());
|
||||||
this.id = Integer.valueOf(usr.getId());
|
|
||||||
|
|
||||||
if (usr.getUserType() == UserType.PATIENT) {
|
if (usr.getUserType() == UserType.PATIENT) {
|
||||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
|
||||||
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id);
|
||||||
this.currentFamilyDoctor = pat.getFamilyDoctor();
|
this.currentFamilyDoctor = pat.getFamilyDoctor();
|
||||||
} else
|
} else
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,28 +49,22 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen
|
|||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
this.lastUIQuery = "";
|
this.lastUIQuery = "";
|
||||||
|
|
||||||
try {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
else {
|
||||||
else {
|
this.id = Integer.valueOf(usr.getId());
|
||||||
this.id = Integer.valueOf(usr.getId());
|
|
||||||
|
|
||||||
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
if (usr.getUserType() == UserType.FAMILY_DOCTOR) {
|
||||||
// Recupera la lista de CAPs inicial desde el EJB.
|
// Recupera la lista de CAPs inicial desde el EJB.
|
||||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
|
|
||||||
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id);
|
||||||
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
this.setCurrentCenter(fd.getPrimaryHealthCareCenter());
|
||||||
} else
|
} else
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil no válido", "Su tipo de usuario no permite que pueda tener acceso a esta página.");
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
public List<PrimaryHealthCareCenterTO> getPhcList() {
|
||||||
|
|||||||
@@ -90,22 +90,14 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public void onUserTypeChange() {
|
public void onUserTypeChange() {
|
||||||
switch (this.userType) {
|
switch (this.userType) {
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
try {
|
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
||||||
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
// seleccionado: Se muestra la lista de especialidades médicas para obligar a seleccionar una.
|
||||||
// seleccionado: Se muestra la lista de especialidades médicas para obligar a seleccionar una.
|
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
||||||
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
try {
|
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
||||||
// El usuario queire registrarse como médico especialista, lanzamos un evento AJAX de cliente para que la interfaz refleje el cambio en el tipo de usuario
|
// seleccionado: Se muestra la lista de CAPs para obligar a seleccionar uno.
|
||||||
// seleccionado: Se muestra la lista de CAPs para obligar a seleccionar uno.
|
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
||||||
PrimeFaces.current().ajax().addCallbackParam("caps", true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
@@ -234,7 +226,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
* No se permite el registro de administradores a través de la página de registro pública.
|
* No se permite el registro de administradores a través de la página de registro pública.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void addNewUser() {
|
public void addNewUser() throws Exception {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
||||||
@@ -252,39 +244,34 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (this.checkNIFDuplicated(this.nif, this.userType) == true) {
|
if (this.checkNIFDuplicated(this.nif, this.userType) == true) {
|
||||||
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 0) {
|
if (error == 0) {
|
||||||
try {
|
switch (this.userType) {
|
||||||
switch (this.userType) {
|
case PATIENT:
|
||||||
case PATIENT:
|
PatientTO pat = this.getRemoteManagerProfile().registerPatient(nif, name, surname, password, email);
|
||||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(nif, name, surname, password, email);
|
this.cipCode = pat.getPersonalIdentificationCode();
|
||||||
this.cipCode = pat.getPersonalIdentificationCode();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(nif, name, surname, password, email, this.primaryHealthCareCenter);
|
FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||||
this.cipCode = fd.getProfessionalNumber();
|
this.cipCode = fd.getProfessionalNumber();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(nif, name, surname, password, email, this.medicalSpecialty);
|
SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(nif, name, surname, password, email, this.medicalSpecialty);
|
||||||
this.cipCode = sd.getProfessionalNumber();
|
this.cipCode = sd.getProfessionalNumber();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
||||||
}
|
|
||||||
|
|
||||||
this.registered = true;
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Registro realizado", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.registered = true;
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Registro realizado", "El usuario " + name + " " + surname + " se ha registrado correctamente.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,38 +78,31 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
|
|
||||||
// Recuperamos el usuario logeado actual
|
// Recuperamos el usuario logeado actual
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
try {
|
usr = SessionUtils.getloggedOnUser();
|
||||||
usr = SessionUtils.getloggedOnUser();
|
|
||||||
|
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida",
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
||||||
"Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema.");
|
else {
|
||||||
else {
|
this.userType = usr.getUserType();
|
||||||
this.userType = usr.getUserType();
|
this.id = Integer.valueOf(usr.getId());
|
||||||
this.id = Integer.valueOf(usr.getId());
|
|
||||||
|
|
||||||
switch (usr.getUserType()) {
|
switch (usr.getUserType()) {
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id));
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id));
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id));
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
// TODO: Recuperar usuario administrador para editar su perfil ¿?
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Usuario sin perfil", "Usted es un usuario de tipo administrador y no puede editar su perfil de usuario.");
|
||||||
// this.getRemoteManagerProfile().retrievePatient(usr.getId());
|
break;
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Usuario sin perfil", "Usted es un usuario de tipo administrador y no puede editar su perfil de usuario.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,43 +302,47 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
if (this.userType == null)
|
if (this.userType == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
try {
|
||||||
|
this.nif = ValidationUtils.normalizeNIF(this.nif);
|
||||||
|
|
||||||
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false);
|
||||||
|
|
||||||
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
if (this.userType == UserType.ADMINISTRATOR) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Perfil de usuario incorrecto", "Su perfil es de un usuario de tipo administrador y no puede editar su perfil.");
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (this.isUserTypeSpecialistDoctor() && this.medicalSpecialty == null) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (ValidationUtils.isValid(nif) == false) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) {
|
|
||||||
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
|
||||||
error++;
|
|
||||||
}
|
|
||||||
if (changePassword == true) {
|
|
||||||
// el usuario queire cambiar el password Comprobamos que el password
|
|
||||||
// especificado coincide con el guardado
|
|
||||||
if (this.password == null || this.password.length() < 4) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Nueva contraseña incorrectra", "Su nueva contraseña debe tener al menos 4 caracteres.");
|
|
||||||
error++;
|
|
||||||
} else if (HashUtils.hashMD5(this.oldPassword).equals(this.currentPassword) == false) {
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Contraseña actual incorrecta",
|
|
||||||
"Su actual contraseña es incorrecta. Por favor, especifique su contraseña actual.");
|
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (error == 0) {
|
if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||||
try {
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (this.isUserTypeSpecialistDoctor() && this.medicalSpecialty == null) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (ValidationUtils.isValid(nif) == false) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) {
|
||||||
|
this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
if (changePassword == true) {
|
||||||
|
// el usuario queire cambiar el password Comprobamos que el password
|
||||||
|
// especificado coincide con el guardado
|
||||||
|
if (this.password == null || this.password.length() < 4) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Nueva contraseña incorrectra", "Su nueva contraseña debe tener al menos 4 caracteres.");
|
||||||
|
error++;
|
||||||
|
} else if (HashUtils.hashMD5(this.oldPassword).equals(this.currentPassword) == false) {
|
||||||
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Contraseña actual incorrecta",
|
||||||
|
"Su actual contraseña es incorrecta. Por favor, especifique su contraseña actual.");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error == 0) {
|
||||||
LoggedUserTO usr = null;
|
LoggedUserTO usr = null;
|
||||||
|
|
||||||
switch (this.userType) {
|
switch (this.userType) {
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
|
PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email);
|
||||||
@@ -366,7 +363,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
throw new NotSupportedException("No se soporta la edición de perfiles de tipo administrador.");
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changePassword == true) {
|
if (changePassword == true) {
|
||||||
@@ -379,9 +376,9 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable
|
|||||||
SessionUtils.createOrUpdateSession(usr);
|
SessionUtils.createOrUpdateSession(usr);
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de su perfil se han guardado correctamente.");
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Los datos se han guardado", "Los datos de su perfil se han guardado correctamente.");
|
||||||
} catch (Exception e) {
|
|
||||||
this.manageException(e);
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
this.manageException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,21 +35,16 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
||||||
try {
|
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||||
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
|
||||||
|
|
||||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||||
|
|
||||||
if (this.patient.getFamilyDoctor() != null)
|
|
||||||
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
|
||||||
else
|
|
||||||
this.familyDoctorDisplayName = null;
|
|
||||||
|
|
||||||
this.date = LocalDate.now();
|
if (this.patient.getFamilyDoctor() != null)
|
||||||
} catch (Exception e) {
|
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
||||||
this.manageException(e);
|
else
|
||||||
}
|
this.familyDoctorDisplayName = null;
|
||||||
|
|
||||||
|
this.date = LocalDate.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
@@ -58,7 +53,8 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
if (this.patient.getFamilyDoctor() == null) {
|
if (this.patient.getFamilyDoctor() == null) {
|
||||||
this.addFacesMessage("visitForm:medico", FacesMessage.SEVERITY_ERROR, "Médico de familia no asignado", "Es necesario que tenga un médico de familia asignado, por favor, cambie el médico de familia que tiene asignado");
|
this.addFacesMessage("visitForm:medico", FacesMessage.SEVERITY_ERROR, "Médico de familia no asignado",
|
||||||
|
"Es necesario que tenga un médico de familia asignado, por favor, cambie el médico de familia que tiene asignado");
|
||||||
error++;
|
error++;
|
||||||
}
|
}
|
||||||
if (this.date.isBefore(today)) {
|
if (this.date.isBefore(today)) {
|
||||||
@@ -119,7 +115,7 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public String getFamilyDoctorDisplayName() {
|
public String getFamilyDoctorDisplayName() {
|
||||||
return familyDoctorDisplayName;
|
return familyDoctorDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFamilyDoctorDisplayName(String value) {
|
public void setFamilyDoctorDisplayName(String value) {
|
||||||
this.familyDoctorDisplayName = value;
|
this.familyDoctorDisplayName = value;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user