Conversión nativa de JSF 2.3 para enumerados en selección de tipo de
usuario.
This commit is contained in:
@@ -2,7 +2,6 @@ package managedbean.profile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -49,8 +48,8 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
private String lastUIQueryMS;
|
||||
|
||||
// private HashMap<String, String> userTypes;
|
||||
private List<UserType> userTypes;
|
||||
private String userType;
|
||||
private List<UserType> availableUserTypes;
|
||||
private UserType userType;
|
||||
private PrimaryHealthCareCenterTO primaryHealthCareCenter;
|
||||
private MedicalSpecialtyTO medicalSpecialty;
|
||||
private List<MedicalSpecialtyTO> medicalSpecialitiesList;
|
||||
@@ -62,26 +61,26 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.userTypes = new ArrayList<UserType>();
|
||||
this.userTypes.add(UserType.PATIENT);
|
||||
this.userTypes.add(UserType.FAMILY_DOCTOR);
|
||||
this.userTypes.add(UserType.SPECIALIST_DOCTOR);
|
||||
this.availableUserTypes = new ArrayList<UserType>();
|
||||
this.availableUserTypes.add(UserType.PATIENT);
|
||||
this.availableUserTypes.add(UserType.FAMILY_DOCTOR);
|
||||
this.availableUserTypes.add(UserType.SPECIALIST_DOCTOR);
|
||||
this.registered = false;
|
||||
this.lastUIQueryPH = "";
|
||||
this.lastUIQueryMS = "";
|
||||
|
||||
this.userType = UserType.PATIENT.name();
|
||||
this.userType = UserType.PATIENT;
|
||||
|
||||
this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
|
||||
public List<UserType> getUserTypes() {
|
||||
return userTypes;
|
||||
public List<UserType> getAvailableUserTypes() {
|
||||
return availableUserTypes;
|
||||
}
|
||||
|
||||
public void onUserTypeChange() {
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
switch (this.userType) {
|
||||
case SPECIALIST_DOCTOR:
|
||||
try {
|
||||
PrimeFaces.current().ajax().addCallbackParam("specs", true);
|
||||
@@ -130,15 +129,15 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isPatient() {
|
||||
return (UserType.valueOf(this.userType) == UserType.PATIENT);
|
||||
return (this.userType == UserType.PATIENT);
|
||||
}
|
||||
|
||||
public boolean isFamilyDoctor() {
|
||||
return (UserType.valueOf(this.userType) == UserType.FAMILY_DOCTOR);
|
||||
return (this.userType == UserType.FAMILY_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isSpecialistDoctor() {
|
||||
return (UserType.valueOf(this.userType) == UserType.SPECIALIST_DOCTOR);
|
||||
return (this.userType == UserType.SPECIALIST_DOCTOR);
|
||||
}
|
||||
|
||||
public boolean isDoctor() {
|
||||
@@ -203,7 +202,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
if (error == 0) {
|
||||
try {
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
switch (this.userType) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email);
|
||||
this.cipCode = pat.getPersonalIdentificationCode();
|
||||
@@ -232,28 +231,28 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public String getUserType() {
|
||||
public UserType getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
public void setUserType(UserType value) {
|
||||
this.userType = value;
|
||||
}
|
||||
|
||||
public MedicalSpecialtyTO getMedicalSpecialty() {
|
||||
return medicalSpecialty;
|
||||
}
|
||||
|
||||
public void setMedicalSpecialty(MedicalSpecialtyTO medicalSpecialty) {
|
||||
this.medicalSpecialty = medicalSpecialty;
|
||||
public void setMedicalSpecialty(MedicalSpecialtyTO value) {
|
||||
this.medicalSpecialty = value;
|
||||
}
|
||||
|
||||
public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() {
|
||||
return primaryHealthCareCenter;
|
||||
}
|
||||
|
||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO primaryHealthCareCenter) {
|
||||
this.primaryHealthCareCenter = primaryHealthCareCenter;
|
||||
public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO value) {
|
||||
this.primaryHealthCareCenter = value;
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
|
||||
Reference in New Issue
Block a user