📄 user.java
字号:
package session.ejb;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import dao.CommonUserDAO;
import dao.CommonUserDAOImpl;
import dao.MySqlOrdinaryDAOImpl;
import dao.MySqlShopDAOImpl;
import dao.OrdinaryUserTO;
import dao.OrdinaryDAO;
import dao.ShopDAO;
import dao.ShopUserTO;
import dao.StoreUserTO;
/**
* XDoclet-based session bean. The class must be declared
* public according to the EJB specification.
*
* To generate the EJB related files to this EJB:
* - Add Standard EJB module to XDoclet project properties
* - Customize XDoclet configuration for your appserver
* - Run XDoclet
*
* Below are the xdoclet-related tags needed for this EJB.
*
* @ejb.bean name="User"
* display-name="Name for User"
* description="Description for User"
* local-jndi-name="ejb/UserLocalHome"
* type="Stateless"
* view-type="local"
* @ejb.util generate="physical"
*/
public class User implements SessionBean {
/** The session context */
private SessionContext context;
public User() {
super();
// TODO Auto-generated constructor stub
}
/**
* Set the associated session context. The container calls this method
* after the instance creation.
*
* The enterprise bean instance should store the reference to the context
* object in an instance variable.
*
* This method is called with no transaction context.
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public void setSessionContext(SessionContext newContext)
throws EJBException {
context = newContext;
}
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/**
* An ejbCreate method as required by the EJB specification.
*
* The container calls the instance?s <code>ejbCreate</code> method whose
* signature matches the signature of the <code>create</code> method invoked
* by the client. The input parameters sent from the client are passed to
* the <code>ejbCreate</code> method. Each session bean class must have at
* least one <code>ejbCreate</code> method. The number and signatures
* of a session bean?s <code>create</code> methods are specific to each
* session bean class.
*
* @throws CreateException Thrown if method fails due to system-level error.
*
* @ejb.create-method
*
*/
public void ejbCreate() throws CreateException {
// TODO Add ejbCreate method implementation
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean selectUserForCheck(String username) throws EJBException {
// rename and start putting your business logic here
CommonUserDAO userDAO = new CommonUserDAOImpl();
return userDAO.selectUserForCheck(username);
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean insertOrdinaryUser(OrdinaryUserTO userTo) throws EJBException {
// rename and start putting your business logic here
OrdinaryDAO userDAO = new MySqlOrdinaryDAOImpl();
return userDAO.insertOrdinaryUser(userTo);
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean updateOrdinaryUser() throws EJBException {
// rename and start putting your business logic here
//UserDAO userDAO = new MySqlUserDAOImpl();
//return userDAO.updateUser(userTo);
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean deleteOrdinaryUser(String username) throws EJBException {
// rename and start putting your business logic here
//UserDAO userDAO = new MySqlUserDAOImpl();
//return userDAO.deleteUser(username);
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public OrdinaryUserTO selectOrdinaryUser(String username) throws EJBException {
// rename and start putting your business logic here
OrdinaryDAO userDAO = new MySqlOrdinaryDAOImpl();
return userDAO.selectOrdinaryUser(username);
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean insertShopUser(ShopUserTO userTo) throws EJBException {
// rename and start putting your business logic here
ShopDAO userDAO = new MySqlShopDAOImpl();
return userDAO.insertShopUser(userTo);
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean updateShopUser() throws EJBException {
// rename and start putting your business logic here
//UserDAO userDAO = new MySqlUserDAOImpl();
//return userDAO.updateUser(userTo);
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean deleteShopUser(String username) throws EJBException {
// rename and start putting your business logic here
//UserDAO userDAO = new MySqlUserDAOImpl();
//return userDAO.deleteUser(username);
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public ShopUserTO selectShopUser(String username) throws EJBException {
// rename and start putting your business logic here
ShopDAO userDAO = new MySqlShopDAOImpl();
return userDAO.selectShopUser(username);
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean insertStoreUser(StoreUserTO userTo) throws EJBException {
// rename and start putting your business logic here
/*OrdinaryUserDAO userDAO = new MySqlOrdinaryUserDAOImpl();
return userDAO.insertOrdinaryUser(userTo); */
System.out.println("insertStoreUser");
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean updateStoreUser() throws EJBException {
// rename and start putting your business logic here
//UserDAO userDAO = new MySqlUserDAOImpl();
//return userDAO.updateUser(userTo);
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public boolean deleteStoreUser(String username) throws EJBException {
// rename and start putting your business logic here
//UserDAO userDAO = new MySqlUserDAOImpl();
//return userDAO.deleteUser(username);
return false;
}
/**
* An example business method
*
* @ejb.interface-method view-type = "local"
*
* @throws EJBException Thrown if method fails due to system-level error.
*/
public StoreUserTO selectStoreUser(String username) throws EJBException {
// rename and start putting your business logic here
//OrdinaryUserDAO userDAO = new MySqlOrdinaryUserDAOImpl();
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -