去哪网实习总结:递归构建“流程运行顺序”的XML文件(JavaWeb)
本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发。。。
只是还是比較认真的做了三个月,老师非常认同我的工作态度和成果。。
。
实习立即就要结束了,总结一下几点之前没有注意过的变成习惯和问题。分享给大家。
同一时候打个广告:去哪网内审部招JavaWeb开发实习生,时间很自由。每周一天、周六周日甚至都能够,时间充裕的小伙伴给我留言啊,挣个零花钱,还能长点经验。
。。。(保研的、想工作的大四狗最合适只是了。。。
)
map的结构为(thisProcessID, thisProcessType;nextProcessID1,nextProcessType1;...;nextProcessIDk,nextProcessTypek;),假设processType部位start、end、split、join,则type和id同样。。。。
跑一下代码就知道是怎么回事了。直接上代码:
<span style="white-space:pre"> </span>public String XMLhead = "";
@SuppressWarnings({ "rawtypes", "unchecked" })
public void formXMLfile(Map nodeMap){
/*穿行没问题
nodeMap.put("1", "start;2,2");
nodeMap.put("2", "2;3,3");
nodeMap.put("3", "3;4,end");
nodeMap.put("4", "end");
*/
/* 简单并行没问题,但须要去重处理
nodeMap.put("1", "start;2,split");
nodeMap.put("2", "split;3,3;4,4");
nodeMap.put("3", "3;5,join");
nodeMap.put("4", "4;5,join");
nodeMap.put("5", "join;6,end");
nodeMap.put("6", "end");
*/
nodeMap.put("1", "start;2,split");
nodeMap.put("2", "split;3,3;4,split;5,5");
nodeMap.put("3", "3;6,6");
nodeMap.put("4", "split;7,7;8,8");
nodeMap.put("5", "5;9,join");
nodeMap.put("6", "6;9,join");
nodeMap.put("7", "7;10,join");
nodeMap.put("8", "8;10,join");
nodeMap.put("9", "join;11,end");
nodeMap.put("10", "join;9,join");
nodeMap.put("11", "end");
/*简单并行没问题。但须要去重处理
nodeMap.put("1", "start;2,split");
nodeMap.put("2", "split;3,3;4,4");
nodeMap.put("3", "3;5,join");
nodeMap.put("4", "4;5,join");
nodeMap.put("5", "join;6,split");
nodeMap.put("6", "split;7,7;8,8");
nodeMap.put("7", "7;9,join");
nodeMap.put("8", "8;9,join");
nodeMap.put("9", "join;10,end");
nodeMap.put("10", "end");
*/
XMLhead = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+"\n";
XMLhead += "<definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:activiti=\"http://activiti.org/bpmn\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" typeLanguage=\"http://www.w3.org/2001/XMLSchema\" expressionLanguage=\"http://www.w3.org/1999/XPath\" targetNamespace=\"http://www.activiti.org/test\">"+"\n";
String XMLtail = "</definitions>";
XMLhead += "<process id=\"processID\" name=\"processNAME\" isExecutable=\"true\">"+"\n";
XMLtail = "</process>\n"+XMLtail;
String this_id = "1";//start
String this_type = "start";
RECUformXMLfile(nodeMap, this_id, this_type);
String XMLfile = XMLhead + XMLtail;
//去重
String[] temp = XMLfile.split("\n");
List<String> list = new LinkedList<String>();
for(int i = 0; i < temp.length; i++) {
if(!list.contains(temp[i])) {
list.add(temp[i]);//改为写文件
System.out.println(temp[i]);
}
}
}
@SuppressWarnings("rawtypes")
public void RECUformXMLfile(Map nodeMap, String this_id, String this_type){
if(this_type.equals("start")){//start
String[] toNodes = nodeMap.get(this_id).toString().split(";");
String next_id = toNodes[1].split(",")[0];
String next_type = toNodes[1].split(",")[1];
if(next_type.equals("split")){
XMLhead += "<startEvent id=\"startevent1\" name=\"Start\"></startEvent>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"startevent1\" targetRef=\"gateway_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
} else if(next_type.equals("end_start_join")){//不可能
} else{//task
XMLhead += "<startEvent id=\"startevent1\" name=\"Start\"></startEvent>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"startevent1\" targetRef=\"task_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
}
} else if(this_type.equals("split")){//split
XMLhead += "<parallelGateway id=\"gateway_"+this_id+"\" name=\"Parallel Gateway\"></parallelGateway>"+"\n";
String[] toNodes = nodeMap.get(this_id).toString().split(";");
for(int i=1;i<toNodes.length;i++){
String next_id = toNodes[i].split(",")[0];
String next_type = toNodes[i].split(",")[1];
if(next_type.equals("split")){
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"gateway_"+this_id+"\" targetRef=\"gateway_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
} else if(next_type.equals("end_start_join")){//不可能
} else{//task
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"gateway_"+this_id+"\" targetRef=\"task_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
}
}
} else if(this_type.equals("end")){//不会出现,接下来的两个推断分支可能的next_type==end时,都已经处理
} else if(this_type.equals("join")){//join,join和task,两者处理逻辑一样,除了一个用gateWay。一个用task
String[] toNodes = nodeMap.get(this_id).toString().split(";");
String next_id = toNodes[1].split(",")[0];
String next_type = toNodes[1].split(",")[1];
if(next_type.equals("end")){
XMLhead += "<parallelGateway id=\"gateway_"+this_id+"\" name=\"Parallel Gateway\"></parallelGateway>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"gateway_"+this_id+"\" targetRef=\"endevent1\"></sequenceFlow>"+"\n";
XMLhead += "<endEvent id=\"endevent1\" name=\"End\"></endEvent>"+"\n";
return ;
} else if(next_type.equals("start")){//不可能
} else if(next_type.equals("split")){
XMLhead += "<parallelGateway id=\"gateway_"+this_id+"\" name=\"Parallel Gateway\"></parallelGateway>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"gateway_"+this_id+"\" targetRef=\"gateway_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
} else if(next_type.equals("join")){
XMLhead += "<parallelGateway id=\"gateway_"+this_id+"\" name=\"Parallel Gateway\"></parallelGateway>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"gateway_"+this_id+"\" targetRef=\"gateway_"+next_id+"\"></sequenceFlow>"+"\n";
return ;
} else{//task
XMLhead += "<parallelGateway id=\"gateway_"+this_id+"\" name=\"Parallel Gateway\"></parallelGateway>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"gateway_"+this_id+"\" targetRef=\"task_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
}
} else{//task,task和join。两者处理逻辑一样。除了一个用gateWay。一个用task
String[] toNodes = nodeMap.get(this_id).toString().split(";");
String next_id = toNodes[1].split(",")[0];
String next_type = toNodes[1].split(",")[1];
if(next_type.equals("end")){
XMLhead += "<userTask id=\"task_"+this_id+"\" name=\""+this_id+"\"></userTask>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"task_"+this_id+"\" targetRef=\"endevent1\"></sequenceFlow>"+"\n";
XMLhead += "<endEvent id=\"endevent1\" name=\"End\"></endEvent>"+"\n";
return ;
} else if(next_type.equals("start")){//不可能
} else if(next_type.equals("split")){
XMLhead += "<userTask id=\"task_"+this_id+"\" name=\""+this_id+"\"></userTask>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"task_"+this_id+"\" targetRef=\"gateway_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
} else if(next_type.equals("join")){
XMLhead += "<userTask id=\"task_"+this_id+"\" name=\""+this_id+"\"></userTask>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"task_"+this_id+"\" targetRef=\"gateway_"+next_id+"\"></sequenceFlow>"+"\n";
//return ;
RECUformXMLfile(nodeMap, next_id, next_type);
} else{//task
XMLhead += "<userTask id=\"task_"+this_id+"\" name=\""+this_id+"\"></userTask>"+"\n";
XMLhead += "<sequenceFlow id=\"flow_"+this_id+"\" sourceRef=\"task_"+this_id+"\" targetRef=\"task_"+next_id+"\"></sequenceFlow>"+"\n";
RECUformXMLfile(nodeMap, next_id, next_type);
}
}
}
去哪网实习总结:递归构建“流程运行顺序”的XML文件(JavaWeb)的更多相关文章
- 去哪网实习总结:用到的easyui组件总结(JavaWeb)
本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发... 只是还是比較认真的做了三个月,老师非常认同我的工作态度和成果.. . 实习立即就要结束了,总结一下几点之前没有注意过的变成习惯和问题,分享 ...
- 去哪网实习总结:JavaWeb中文传參乱码问题的解决(JavaWeb)
本来是以做数据挖掘的目的进去哪网的.结构却成了系统开发... 只是还是比較认真的做了三个月.老师非常认同我的工作态度和成果... 实习立即就要结束了,总结一下几点之前没有注意过的变成习惯和问题,分享给 ...
- 去哪网实习总结:easyui在JavaWeb中的使用,以datagrid为例(JavaWeb)
本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发. . . 只是还是比較认真的做了三个月.老师非常认同我的工作态度和成果.. . 实习立即就要结束了,总结一下几点之前没有注意过的变成习惯和问题, ...
- 去哪网实习总结:开发定时任务(JavaWeb)
本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发.. . 只是还是比較认真的做了三个月,老师非常认同我的工作态度和成果.. . 实习立即就要结束了.总结一下几点之前没有注意过的变成习惯和问题,分 ...
- 去哪网实习总结:JavaWeb配置404页面(JavaWeb)
本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发. .. 只是还是比較认真的做了三个月,老师非常认同我的工作态度和成果... 实习立即就要结束了,总结一下几点之前没有注意过的变成习惯和问题.分享 ...
- 去哪网实习总结:如何配置数据库连接(JavaWeb)
本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发.. . 只是还是比較认真的做了三个月,老师非常认同我的工作态度和成果. .. 实习立即就要结束了.总结一下几点之前没有注意过的变成习惯和问题,分 ...
- maven构建SSM框架中pom.xml文件配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 根据构建类型动态设置AndroidManifest.xml文件中的meta-data
当debug和release版本使用不同的值时,使用Gradle设置相应的值. Android主配置文件 <meta-data android:name="com.amap.api.v ...
- Vue.js开发去哪儿网WebApp
一.项目介绍 这个项目主要参考了去哪儿网的布局,完成了首页.城市选择页面.详情页面的开发. 首页:实现了多区域轮播的功能,以及多区域列表的展示: 城市选择页面:在这个页面实现了城市展示.城市搜索.城市 ...
随机推荐
- Simple dc/dc converter increases available power in dual-voltage system
The schematic in Figure 1 shows a way to increase the power available from a current-limited 5V supp ...
- Spring JavaConfig实例
从Spring 3起,JavaConfig功能已经包含在Spring核心模块,它允许开发者将bean定义和在Spring配置XML文件到Java类中. 但是,仍然允许使用经典的XML方式来定义bean ...
- 关于给springboot添加定时器的两种方式
原文:https://blog.csdn.net/liboyang71/article/details/72781526 首先,搭建好一个springboot项目,可使用maven或者gradle或者 ...
- The maximum number of processes for the user account running is currently , which can cause performance issues. We recommend increasing this to at least 4096.
[root@localhost ~]# vi /etc/security/limits.conf # /etc/security/limits.conf # #Each line describes ...
- 使用BabeLua3.x在cocos2d-x中编辑和调试Lua
BabeLua是一款基于VS2012/2013的Lua集成开发环境,具有Lua语法高亮,语法检查,自动补全,快速搜索,注入宿主程序内对Lua脚本进行调试,设置断点观察变量值,查看堆栈信息等功能. 如何 ...
- LaTeX排版设置图表的位置 Positioning images and tables
Positioning images and tables LATEX is an editing tool that takes care of the format so you only hav ...
- pidera安装node.js(树莓派)
1. 下载node.js wget http://nodejs.org/dist/v0.10.5/node-v0.10.5-linux-arm-pi.tar.gz tar -xzvf node-v0. ...
- go语言基础之break和continue的区别
1.break和continue的区别 在循环里面有两个关键操作break和continue,break操作是跳出当前循环,continue是跳过本次循环. 2.break 备注:break可⽤于fo ...
- 监听内容变化 TextWatcher @功能
监听多个TextView的内容变化 使用示例 TextWatcherUtils.addTextChangedListener(isAllNotEmpty -> btnLogin.setEnabl ...
- Android -- 压缩与解压文件
我在做一个项目中,工程文件中有一个功能需要很多图片,图片与app一起打包下来的话有30+M,那么我们就考虑另外下载压缩包,我们将图片取出,工程就只有4+M了,哈哈哈哈,呵呵,真恐怖.那么这样就涉及到另 ...