package com.hecheng.xdocweb.flow.web;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.ejb.*;
import java.rmi.RemoteException;
import java.util.Hashtable;
import java.util.Vector;
import java.util.Collection;
import com.hecheng.xdocweb.util.*;
import com.hecheng.xdocweb.util.xml.*;
import com.hecheng.xdocweb.flow.ejb.*;
import com.hecheng.xdocweb.flow.model.*;
import com.hecheng.xdocweb.section.ejb.*;
import com.hecheng.xdocweb.section.model.*;
import com.hecheng.xdocweb.node.ejb.*;
import com.hecheng.xdocweb.node.model.*;
import com.hecheng.xdocweb.role.ejb.*;
import com.hecheng.xdocweb.role.model.*;
import com.hecheng.xdocweb.permit.ejb.*;
public class FlowServlet extends GenericServlet {
private ServletConfig config;
boolean DEBUG = false;
String theURL = null;
String context_factory = null;
Context initCtx = null;
FlowHome fHome = null;
Flow flow = null;
SectionHome shome=null;
SectionRemote section=null;
NodeHome nhome=null;
Node node=null;
RoleHome rhome=null;
RoleRemote role=null;
public void init(ServletConfig config)throws ServletException{
super.init(config);
try{
//if(DEBUG) System.out.println("获取远程接口...");
initCtx=getInitialContext();
fHome = (FlowHome)initCtx.lookup("ejb/Flow");
flow=(Flow)fHome.create();
shome=(SectionHome)initCtx.lookup("ejb/SectionEJB");
section=(SectionRemote)shome.create();
nhome = (NodeHome)initCtx.lookup("ejb/Node");
node=(Node)nhome.create();
rhome=(RoleHome)initCtx.lookup("ejb/RoleEJB");
role=(RoleRemote)rhome.create();
//if(DEBUG) System.out.println("成功.");
} catch(Exception e) {
//if(DEBUG) System.out.println("获取远程接口错误.");
//System.out.println("Client Exception:" + e.getMessage());
e.printStackTrace();
}
}
public void destroy(){
}
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
// init request and response
HttpServletResponse response = (HttpServletResponse) res;
HttpServletRequest request = (HttpServletRequest) req;
//检查登录信息
Authorize auth = new Authorize(request);
if(auth.isAnonymous()) { //匿名访问
servletPage(req, res, "/xdocweb/jsp/forbid.jsp");
} else { //合法用户
String operation = req.getParameter("operation");
if(operation==null){
servletPage(req,res,"/xdocweb/workflow/workflow_add.jsp");
}else if(operation.equals("added")){
FlowModel model = new FlowModel();
String FlowName=StringUtil.convertEncode(req.getParameter("FlowName"));
if(FlowName==null) FlowName="";
String FlowDetail=StringUtil.convertEncode(req.getParameter("FlowDetail"));
if(FlowDetail==null) FlowDetail="";
//FlowName=StringUtil.escapeForHTML(FlowName);
//FlowDetail=StringUtil.escapeForHTML(FlowDetail);
if(FlowName.length()>50)
FlowName=FlowName.substring(0,50);
if(FlowDetail.length()>200)
FlowDetail=FlowDetail.substring(0,200);
String State=req.getParameter("State");
try{
FlowDAO fdao=new FlowDAO();
int tem=fdao.exist(FlowName);
if(tem!=-1){
errorPage(req,res,"流程名称已存在!");
return;
}
}catch(Exception e){}
model.setName(FlowName);
model.setDescription(FlowDetail);
model.setState(State);
model.setCreatorID(5);
int id=-1;
try{
flow.newFlow(model);
FlowDAO dao = new FlowDAO();
id=dao.getMaxFlowID();
}catch(FlowException fe){
PrintWriter out=res.getWriter();
out.println("增加流程失败!");
out.println(fe.getMessage());
}
NodeList nList=null;
FlowModel fmodel=null;
Collection RoleList=null;
try{
FlowDAO dao=new FlowDAO();
fmodel=dao.getFlowByID(id);
nList=node.getNodeList(id,false);
}catch(Exception e){}
String LocationNode="";
String NextNodeType=null;
if(nList!=null){
NodeModel nmodel=nList.getNode(0);
LocationNode=nmodel.getNodeName();
if(nList.size()>1)
NextNodeType=nList.getNode(1).getNodeType();
else
NextNodeType=null;
}
Vector NodeType= new Vector();
String Action="";
if(NextNodeType==null){
Action="edit";
NodeType.addElement("编辑");
NodeType.addElement("审核");
NodeType.addElement("发布");
}else if(NextNodeType.equals("编辑")){
Action="edit";
NodeType.addElement("编辑");
}else if(NextNodeType.equals("审核")||NextNodeType.equals("发布")){
Action="edit";
NodeType.addElement("编辑");
NodeType.addElement("审核");
}
try{
RoleList=role.getTypeRoles("content",Action);
//System.out.println("Call getTypeRoles!");
}catch(Exception e){}
//Vector NodeAction= new Vector();
//NodeAction.addElement("编辑");
//NodeAction.addElement("审核");
//NodeAction.addElement("发布");
//req.setAttribute("FlowID",FlowID);
//req.setAttribute("FlowName",FlowName);
//req.setAttribute("FlowDetail",FlowDetail);
req.setAttribute("FlowData",fmodel);
req.setAttribute("NodeList",nList);
req.setAttribute("LocationNode",LocationNode);
req.setAttribute("NodeType",NodeType);
req.setAttribute("RoleList",RoleList);
servletPage(req,res,"/xdocweb/workflow/nod_add.jsp");
}else if(operation.equals("list")){
String index=req.getParameter("Index");
FlowList fList=null;
try{
fList=flow.getFlowList();
}catch(Exception fe){
PrintWriter out=res.getWriter();
out.println("增加流程失败!");
out.println(fe.getMessage());
}
req.setAttribute("List",fList);
req.setAttribute("Index",index);
if(auth.hasPermit("flow", "add")) req.setAttribute("add", "Y");
if(auth.hasPermit("flow", "update")) req.setAttribute("update", "Y");
if(auth.hasPermit("flow", "del")) req.setAttribute("del", "Y");
servletPage(req,res,"/xdocweb/workflow/workflow_list.jsp");
}else if(operation.equals("modify")){
String FlowID=req.getParameter("FlowID");
//String FlowName=StringUtil.convertEncode(req.getParameter("FlowName"));
//String FlowDetail=StringUtil.convertEncode(req.getParameter("FlowDetail"));
//String State=req.getParameter("State");
int Flow_ID=-1;
FlowModel fmodel=null;
if(FlowID!=null)
Flow_ID=new Integer(FlowID).intValue();
try{
FlowDAO dao=new FlowDAO();
fmodel=dao.getFlowByID(Flow_ID);
}catch(Exception e){}
//req.setAttribute("FlowID",FlowID);
//req.setAttribute("FlowName",FlowName);
//req.setAttribute("FlowDetail",FlowDetail);
//req.setAttribute("State",State);
req.setAttribute("FlowData",fmodel);
servletPage(req,res,"/xdocweb/workflow/workflow_amend.jsp");
}else if(operation.equals("modified")){
String FlowID=req.getParameter("FlowID");
String FlowName=StringUtil.convertEncode(req.getParameter("FlowName"));
String FlowDetail=StringUtil.convertEncode(req.getParameter("FlowDetail"));
//FlowName=StringUtil.escapeForHTML(FlowName);
//FlowDetail=StringUtil.escapeForHTML(FlowDetail);
if(FlowName==null) FlowName="";
if(FlowDetail==null) FlowDetail="";
String State=req.getParameter("State");
FlowModel model= new FlowModel();
int Flow_ID=Integer.parseInt(FlowID);
try{
FlowDAO fdao=new FlowDAO();
int tem=fdao.exist(FlowName);
if(tem!=-1 && tem!=Flow_ID){
errorPage(req,res,"流程名称已存在!");
return;
}
}catch(Exception e){}
model.setFlowID(Flow_ID);
model.setName(FlowName);
model.setDescription(FlowDetail);
model.setState(State);
//model.setCreatorID(5);
try{
flow.updateFlow(model);
}cat
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本系统是一个完整的JAVA-XML应用项目,合适有初步JSP/java编程经验的朋友们。 系统含全套源码,学生毕业设计好教材! 本系统是Web模式的商品销售系统 运行环境:Tomact+JDK 编程模式:JSP+JavaBean+JavaServlet 后台数据库:MySql or MS-Access(系统内置) SQLServer Oracle 系统主要业务: 1、客户信息管理(注册、登录) 2、商品目录维护(类别、子类别、商品细目) 3、动态商品清单 4、购物车 5、收银台 6、自动生成订单
资源推荐
资源详情
资源评论
收起资源包目录
商品销售系统-java编程系统 (322个子文件)
RequestToEventTranslator.java.bak 14KB
admin_product.jsp.bak 6KB
RequestProcessor.java.bak 6KB
main.jsp.bak 5KB
ModelManager.java.bak 4KB
EJBUtil.java.bak 4KB
ShoppingClientControllerWebImpl.java.bak 3KB
PathNames.java.bak 2KB
CustomerModel.java.bak 2KB
ModelUpdateNotifier.java.bak 1KB
WebKeys.java.bak 1KB
CustomerWebImpl.java.bak 1KB
JNDINames.java.bak 1KB
SecurityAdapter.java.bak 927B
MissingFormDataException.java.bak 468B
EventException.java.bak 206B
LoginFailedException.java.bak 195B
ModelUpdateListener.java.bak 114B
navstyle.css 1KB
splash.gif 35KB
struct8.gif 30KB
struct6.gif 20KB
databa5.gif 20KB
struct7.gif 9KB
struct3.gif 9KB
fish4.gif 7KB
bird4.gif 6KB
dog2.gif 6KB
dog1.gif 6KB
bird3.gif 6KB
bird5.gif 5KB
fish3.gif 5KB
cat2.gif 5KB
dog6.gif 5KB
bird1.gif 5KB
dog5.gif 5KB
cat3.gif 5KB
bird6.gif 5KB
cat4.gif 5KB
lizard3.gif 5KB
fish2.gif 4KB
dog3.gif 4KB
logo-topbar.gif 4KB
cat1.gif 3KB
fish_icon.gif 3KB
birds_icon.gif 3KB
cats_icon.gif 3KB
003.gif 3KB
frog1.gif 3KB
dogs_icon.gif 3KB
lizard2.gif 3KB
lizard1.gif 3KB
bird2.gif 3KB
dog4.gif 3KB
reptiles_icon.gif 2KB
005.gif 2KB
order.gif 2KB
002.gif 2KB
012.gif 1KB
013.gif 1KB
008.gif 1KB
011.gif 1KB
button_cont.gif 1KB
button_remove.gif 1KB
007.gif 1KB
bkg-topbar.gif 959B
009.gif 959B
006.gif 817B
004.gif 816B
001.gif 800B
dian1.gif 799B
t09.gif 768B
t06.gif 720B
t08.gif 706B
nav-reptiles.gif 669B
t07.gif 616B
t05.gif 613B
t01.gif 563B
t02.gif 562B
t03.gif 554B
t10.gif 538B
t04.gif 536B
button_checkout.gif 534B
cart-update.gif 489B
button_cart-add.gif 481B
button_cart-view.gif 473B
nav-birds.gif 471B
nav-dogs.gif 468B
button_submit.gif 455B
button_cancel.gif 442B
nav-fish.gif 439B
button_sign-in.gif 438B
reptilesHL.gif 410B
nav-cats.gif 408B
reptiles.gif 398B
navsub_reptiles.gif 332B
searchHL.gif 332B
search.gif 323B
dogsHL.gif 316B
dogs.gif 306B
共 322 条
- 1
- 2
- 3
- 4
putaoweng
- 粉丝: 4
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Wireshark-4.2.4-x64.zip
- 2022年11月软件设计师上
- 基于VB+ACCESS教学管理系统(参考文献+源代码).zip
- 一个工具的流程图 demo
- EMC3080的用于连接FogCloud的固件
- 基于VB+Access酒店客房管理系统(源代码+参考文献+报告).zip
- 应用笔记LAT1244+奇怪的NRST+管脚异常复位问题
- SEMI标准的解释说明
- tensorflow-2.8.2-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-rocm-2.12.0.560-cp311-cp311-manylinux2014-x86-64.whl
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页