Esqueleto de proyecto inicial.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package managedbean.medicalTest;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.SessionScoped;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.medicalTest.MedicalTestFacadeRemote;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||
* médica.
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
*/
|
||||
@ManagedBean(name = "MedicalTestMBean")
|
||||
@SessionScoped
|
||||
public class MedicalTestMBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EJB
|
||||
private MedicalTestFacadeRemote remoteManager;
|
||||
|
||||
/**
|
||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public MedicalTestMBean() throws Exception {
|
||||
initializeAdminFacadeRemote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void initializeAdminFacadeRemote() throws Exception {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
remoteManager = (MedicalTestFacadeRemote) ctx
|
||||
.lookup("java:app/myHealth.jar/MedicalTestFacadeBean!ejb.component.MedicalTestFacadeRemote");
|
||||
}
|
||||
|
||||
}
|
||||
51
1.sources/MyHealth/src/managedbean/profile/ProfileMBean.java
Normal file
51
1.sources/MyHealth/src/managedbean/profile/ProfileMBean.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package managedbean.profile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.SessionScoped;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.profile.ProfileFacadeRemote;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||
* médica.
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
*/
|
||||
@ManagedBean(name = "ManagedBeanName")
|
||||
@SessionScoped
|
||||
public class ProfileMBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EJB
|
||||
private ProfileFacadeRemote remoteManager;
|
||||
|
||||
/**
|
||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public ProfileMBean() throws Exception {
|
||||
initializeAdminFacadeRemote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void initializeAdminFacadeRemote() throws Exception {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
remoteManager = (ProfileFacadeRemote) ctx
|
||||
.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote");
|
||||
}
|
||||
|
||||
}
|
||||
68
1.sources/MyHealth/src/managedbean/systemAdmin/Login.java
Normal file
68
1.sources/MyHealth/src/managedbean/systemAdmin/Login.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.SessionScoped;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import common.SessionUtils;
|
||||
|
||||
@ManagedBean
|
||||
@SessionScoped
|
||||
public class Login implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1094801825228386363L;
|
||||
|
||||
private String Password;
|
||||
private String msg;
|
||||
private String userName;
|
||||
|
||||
public String getPassword() {
|
||||
return Password;
|
||||
}
|
||||
|
||||
public void setPassword(String pwd) {
|
||||
this.Password = pwd;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getuserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setuserName(String user) {
|
||||
this.userName = user;
|
||||
}
|
||||
|
||||
// validate login
|
||||
public String validateUsernamePassword() {
|
||||
// TODO: Validar login
|
||||
boolean valid = true;
|
||||
if (valid) {
|
||||
HttpSession session = SessionUtils.getSession();
|
||||
session.setAttribute("username", userName);
|
||||
return "home";
|
||||
} else {
|
||||
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,
|
||||
"Usuario o contraseña incorrecta", "Por favor, intentalo de nuevo"));
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
|
||||
// logout event, invalidate session
|
||||
public String logout() {
|
||||
HttpSession session = SessionUtils.getSession();
|
||||
session.invalidate();
|
||||
return "home";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package managedbean.systemAdmin;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.SessionScoped;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.systemAdmin.SystemAdminFacadeRemote;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||
* médica.
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
*/
|
||||
@ManagedBean(name = "SystemAdminMBean")
|
||||
@SessionScoped
|
||||
public class SystemAdminMBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EJB
|
||||
private SystemAdminFacadeRemote remoteManager;
|
||||
|
||||
/**
|
||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public SystemAdminMBean() throws Exception {
|
||||
initializeAdminFacadeRemote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void initializeAdminFacadeRemote() throws Exception {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
remoteManager = (SystemAdminFacadeRemote) ctx
|
||||
.lookup("java:app/myHealth.jar/ClassFacadeBean!ejb.component.SystemAdminFacadeRemote");
|
||||
}
|
||||
|
||||
}
|
||||
51
1.sources/MyHealth/src/managedbean/visit/VisitMBean.java
Normal file
51
1.sources/MyHealth/src/managedbean/visit/VisitMBean.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.SessionScoped;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
|
||||
import ejb.visit.VisitFacadeRemote;
|
||||
|
||||
/**
|
||||
* ManagedBEan que gestiona la edición y actualización de una especialidad
|
||||
* médica.
|
||||
*
|
||||
* @author mark
|
||||
*
|
||||
*/
|
||||
@ManagedBean(name = "SystemAdminMBean")
|
||||
@SessionScoped
|
||||
public class VisitMBean implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EJB
|
||||
private VisitFacadeRemote remoteManager;
|
||||
|
||||
/**
|
||||
* Constructor. Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public VisitMBean() throws Exception {
|
||||
initializeAdminFacadeRemote();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializa la conexión con el EJB Remoto
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void initializeAdminFacadeRemote() throws Exception {
|
||||
Properties props = System.getProperties();
|
||||
Context ctx = new InitialContext(props);
|
||||
remoteManager = (VisitFacadeRemote) ctx
|
||||
.lookup("java:app/myHealth.jar/ClassFacadeBean!ejb.component.VisitFacadeRemote");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user