package it.html.ejb.entity.cmp;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
//Classe bean concreta
public abstract class UserBean implements javax.ejb.EntityBean {
/*
* Usato per mantenere il riferimento al proprio
* ambiente di esecuzione (recuperare connessioni,
* altri ejb, ...)
*/
private EntityContext context;
//Metodo create
public java.lang.String ejbCreate(String login,String nome,String cognome,
String email, String telefono) throws javax.ejb.CreateException, LoginException {
//controllo dei parametri
if (login.length()<6)
throw new LoginException("Login troppo corto (almeno 6 chars)");
// setting dei parametri
setLogin(login);
setNome(nome);
setCognome(cognome);
setEmail(email);
setTelefono(telefono);
//restituiamo la chiave primaria
return login;
}
public void ejbPostCreate() throws javax.ejb.CreateException {
// NOOP
}
//CMP Field login
//Returns the login
public abstract java.lang.String getLogin();
//Sets the login
public abstract void setLogin(java.lang.String login);
//CMP Field nome
//Returns the nome
public abstract java.lang.String getNome();
//Sets the nome
public abstract void setNome(java.lang.String nome);
//CMP Field cognome
//Returns the cognome
public abstract java.lang.String getCognome();
//Sets the cognome
public abstract void setCognome(java.lang.String cognome);
//CMP Field email
//Returns the email
public abstract java.lang.String getEmail();
//Sets the email
public abstract void setEmail(java.lang.String email);
//CMP Field telefono
//Returns the telefono
public abstract java.lang.String getTelefono();
//Sets the telefono
public abstract void setTelefono(java.lang.String telefono);
//Metodi CALLBACK
public void ejbActivate() throws EJBException, RemoteException {
System.out.println("CMP User - ejbActivate()");
}
public void ejbLoad() throws EJBException, RemoteException {
System.out.println("CMP User - ejbLoad()");
}
public void ejbPassivate() throws EJBException, RemoteException {
System.out.println("CMP User - ejbPassivate()");
}
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
System.out.println("CMP User - ejbRemove()");
}
public void ejbStore() throws EJBException, RemoteException {
System.out.println("CMP User - ejbStore()");
}
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
context=arg0;
}
public void unsetEntityContext() throws EJBException, RemoteException {
context=null;
}
}