Cambios menores en vista home y managed Bean pasado a ViewScoped.

This commit is contained in:
Marcos Garcia Nuñez
2019-12-28 15:12:00 +01:00
parent 308fa17eba
commit 2fe4176ef9
2 changed files with 18 additions and 41 deletions

View File

@@ -4,8 +4,8 @@ import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import common.UserType;
@@ -16,22 +16,23 @@ import common.UserType;
*
*/
@Named("home")
@RequestScoped
@ViewScoped
public class homeMBean extends ManagedBeanBase implements Serializable {
private static final long serialVersionUID = 1L;
private boolean isLogedIn;
private String userId;
private String userName;
private String userDisplayName;
private UserType userType;
private int refresh;
@PostConstruct
public void init() {
isLogedIn = SessionUtils.isLogedIn();
userName = SessionUtils.getUserName();
userId = SessionUtils.getUserId();
userType = SessionUtils.getUserType();
this.isLogedIn = SessionUtils.isLogedIn();
this.userName = SessionUtils.getUserName();
this.userDisplayName = SessionUtils.getUserDisplayName();
this.userId = SessionUtils.getUserId();
this.userType = SessionUtils.getUserType();
FacesMessage message = SessionUtils.getMessage();
@@ -54,6 +55,13 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
else
return this.userName;
}
public String getUserDisplayName() {
if (this.isLogedIn == false)
return "Invitado";
else
return this.userDisplayName;
}
public String getUserId() {
return this.userId;
@@ -63,14 +71,6 @@ public class homeMBean extends ManagedBeanBase implements Serializable {
return this.userType.getUserTypename();
}
public int getRefresh() {
return refresh;
}
public void setRefresh(int refresh) {
this.refresh = refresh;
}
public boolean isPatient() {
return (this.userType == UserType.PATIENT);
}