Originally to do the purpose of data mining in which network, the structure has become a system development ...
But still more serious to do for three months, the teacher is very agree with my work attitude and results ...
The internship is coming to an end, summarizing a few things that have not been noticed before to become habits and problems, to share to everyone.
At the same time to play an advertisement: to which network Internal audit department recruit Javaweb Development intern, Time is very free, a week, Saturday Sunday even can, the time of the small partners to give me a message ah, earn a pocket money, but also a long experience .... (GPA, want to work a senior dog is the most suitable ... )
The structure of map is (Thisprocessid, thisprocesstype;nextprocessid1,nextprocesstype1; Nextprocessidk,nextprocesstypek;), if the Processtype part start, end, split, join, then the type and ID are the same ....
Run the code to know what's going on, directly on the code:
<span style= "White-space:pre" ></span>public String xmlhead = ""; @SuppressWarnings ({"Rawtypes", " Unchecked "}) public void Formxmlfile (Map nodemap) {/* Walkthrough no Problem Nodemap.put (" 1 "," start;2,2 "), Nodemap.put (" 2 "," 2;3,3 "); Nodemap.put ("3", "3;4,end"), Nodemap.put ("4", "End"), *//* simple parallelism no problem, but need to redo 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 (" "Join;9,join"), Nodemap.put ("One", "End"),/* Simple parallel no problem, but need to redo 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 (" Ten "," 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";//startstring 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]);//Change to Write file System.out.println (Temp[i]); }}} @SuppressWarnings ("Rawtypes") public void Recuformxmlfile (Map nodemap, String this_id, String this_type) {if (this _type.equals ("Start")) {//startstring[] 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")) {//impossibility} Else{//taskxmlhead + = "<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")) {//splitxmlhead + = "<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")) {//impossibility} Else{//taskxmlhead + = "<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")) {//does not appear, the next two judgment branches may be next_type==end when they are processed} else if (This_type.equals ("join")) {// Join,join and task, both deal with logic, except one with the gateway, one with taskstring[] 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")) {//impossibility} 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{//taskxmlhead + = "<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 and join, both deal with logic, except one with the gateway, one with taskstring[] 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")) {//impossibility} 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{//taskxmlhead + = "<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);}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Where to go Web Internship Summary: Recursive construction of the "Process execution order" XML file (Javaweb)