Originally to do the purpose of data mining in which network, the structure has become a system development ...
Just still more serious to do for three months, the teacher very much agree with my work attitude and results.
。
The internship is coming to an end, summarizing a few things that have not been noticed before and become habits and problems. Share to everyone.
At the same time to make an advertisement: to which network Internal audit department recruit Javaweb Development intern, Time is very free. Every week One days, Saturday Sunday even can, the time is ample of small partners to leave a message to me Ah, earn a pocket money, still can have a long experience.
。。。 (GPA, want to work a senior dog is the most suitable only ...
)
The structure of map is (Thisprocessid, thisprocesstype;nextprocessid1,nextprocesstype1; Nextprocessidk,nextprocesstypek;), assuming the processtype part start, end, split, join, the type and ID are the same ....
Run the code and you'll 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 parallelism no problem. But the need to deal with 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 inferred branches may be next_type==end when they are already processed} else if (This_type.equals ("join")) {// Join,join and task, both deal with logic, except one with 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 joins. The two handle the same 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);}}
Where to go Web Internship Summary: Recursive construction of the "Process run Order" XML file (Javaweb)