/**
* 显示树形结构
*
* <p>Copyright: Jdon.com Copyright (c) 2003</p>
* <p>Company: 上海解道计算机技术有限公司</p>
* @author not attributable
* @version 1.0
*/
public class SetUpCategoryTreeAction extends SetUpTreeAction {
private final static ServiceServerFactory sf = ServiceServerFactory.
getInstance();
public Collection getChildernNode(HttpServletRequest
request,
ViewNode node) throws Exception {
CategoryTreeManagerLocal categoryTree = (CategoryTreeManagerLocal)
sf.
getService(FrameworkServices.CategoryTreeEJB, request);
return categoryTree.getROOTChildern();
}
}
/**
* 更新显示树形结构
* <p>Copyright: Jdon.com Copyright (c) 2003</p>
* <p>Company: 上海解道计算机技术有限公司</p>
* @author not attributable
* @version 1.0
*/
public class UpdateCategoryTreeAction extends UpdateTreeAction {
private final static ServiceServerFactory sf = ServiceServerFactory.
getInstance();
public Collection getChildernNode(HttpServletRequest
request,
ViewNode node) throws Exception {
CategoryTreeManagerLocal categoryTree = (CategoryTreeManagerLocal)
sf.
getService(FrameworkServices.CategoryTreeEJB, request);
return categoryTree.getChildern(node.getKey());
}
}
/**
* 管理树形结构,节点的增、删、改
* <p>Copyright: Jdon.com Copyright (c) 2003</p>
* <p>Company: 上海解道计算机技术有限公司</p>
* @author not attributable
* @version 1.0
*/
public class CategoryTreeHandler implements ModelHandler {
private final static ServiceServerFactory sf
= ServiceServerFactory.
getInstance();
public ModelForm initForm(HttpServletRequest request) throws Exception{
return new CategoryForm();
}
public Model findModelByKey(String keyValue,
HttpServletRequest request) throws Exception{
CategoryTreeManagerLocal catalogManager = (CategoryTreeManagerLocal)
sf.getService(
FrameworkServices.CategoryTreeEJB, request);
return catalogManager.getCategoryById(keyValue);
}
public void serviceAction(EventModel em, HttpServletRequest
request) throws
java.lang.
Exception {
CategoryTreeManagerLocal catalogManager = (CategoryTreeManagerLocal)
sf.getService(FrameworkServices.CategoryTreeEJB, request);
try {
switch (em.getActionType()) {
case Event.CREATE:
catalogManager.addCategory(em);
break;
case Event.EDIT:
catalogManager.updateCategory(em);
break;
case Event.DELETE:
catalogManager.removeCategory(em);
break;
}
} catch (Exception ex) {
throw new Exception("System operation Error:" + ex);
}
}
}
|