📄 catalogejbbean.java
字号:
package com.jdon.estore.catalog;
import javax.ejb.*;
import com.jdon.servicelocator.ejb.ServiceLocator;
import com.jdon.controller.events.EventModel;
import com.jdon.sequence.SequenceGeneratorLocalHome;
import com.jdon.sequence.SequenceGeneratorLocal;
import org.apache.log4j.Logger;
import com.jdon.estore.model.Product;
import com.jdon.estore.model.Item;
import com.jdon.estore.model.Attribute;
import com.jdon.estore.model.Category;
import com.jdon.estore.catalog.dao.CatalogDAO;
import com.jdon.controller.model.PageIterator;
import com.jdon.estore.JNDINames;
public class CatalogEJBBean implements SessionBean {
private final static Logger logger = Logger.getLogger(ProductManagerBean.class);
SessionContext sessionContext;
private CatalogDAO catalogDAO;
public void ejbCreate() throws CreateException {
try {
ServiceLocator sl = new ServiceLocator();
catalogDAO = (CatalogDAO) sl.getDAO(JNDINames.CATALOG_DAO);
} catch (Exception ex) {
logger.error("create error:" + ex);
throw new CreateException();
}
}
public Category getCategory(String catId) throws Exception {
return catalogDAO.getCategory(catId);
}
public int getCategoryAllCount() throws Exception {
return catalogDAO.getCategoryAllCount();
}
public PageIterator getCategories(int start, int count) throws Exception {
return catalogDAO.getCategories(start, count);
}
public Product getProduct(String productId) throws Exception {
return catalogDAO.getProduct(productId);
}
public int getProductAllCount(String catId) throws Exception {
return catalogDAO.getProductAllCount(catId);
}
public PageIterator getProducts(String catId, int start, int count) throws
Exception {
return catalogDAO.getProducts(catId, start, count);
}
public Item getItem(String itemId) throws Exception {
return catalogDAO.getItem(itemId);
}
public PageIterator getItems(String productId, int start, int size) throws
Exception {
return catalogDAO.getItems(productId, start, size);
}
public PageIterator searchItems(String query, int start, int size) throws
Exception {
return catalogDAO.searchItems(query, start, size);
}
public byte[] getImage(String Id) throws Exception {
return catalogDAO.getImage(Id);
}
public void ejbRemove() {
/**@todo Complete this method*/
}
public void ejbActivate() {
/**@todo Complete this method*/
}
public void ejbPassivate() {
/**@todo Complete this method*/
}
public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -