Process engine design

zhaozj2021-02-16  54

We use the JDOM, with the interface design to obtain data, constructed a flow.xml file (reference form 1)

Flow.xml file After XMLSPY opens

0

2

ng.jsp

saveng.jsp

The proposed document is the first step of the issuance

1

3

sh.jsp

saves.jsp

Audit is the first review of the union of the unit leaders to the upcoming documents

0

2

dj.jsp

savedj.jsp

After receiving the file, the first step is registered

1

3

DPS.JSP

Savedps.jsp

files pass through departmental leadership to take the next step

2

4

cy.jsp

savecy.jsp

file is to see all people, so you need to read

(Reference Form 1)

There are two processes in a Flow file, one is a collection, one is a text, they have their own properties and steps, which is all data for saved processes, so the future operation is the necessary operations for this file. . We give an example that explains how to list all processes and all steps. (Refer to Table 2)

FlowEngine.java processes the Flow.xml file.

Package com.test.flow;

// introduction of the package required by JDOM

Import Org.jdom. *;

// Import Org.jdom.Output. *;

Import org.jdom.Input. *;

Import java.io. *;

Public class flowengine {

Public static void main (String [] args) {

Try {

SAXBUILDER SB = New Saxbuilder ();

// Construct a document from the file and load the XML file of the process.

Document Doc = Sb. Build (New FileInputStream ("FLOW.XML"));

Element root = doc.getrootElement (); // Get root elements

Java.util.List Flows = root.getchildren (); // Syst.out.Println (" ");

For (int i = 0; i

ELEMENT FLOW = (Element) Flows.get (i); // First process

Attribute flowid = flow.getattribute ("flowid"); "FLOWID");

Attribute flowname = flow.getatribute ("name");

System.out.print ("Process" i " Flowid.getName () " = " FlowID.GetValue () " ");

System.out.println (FLOWNAME.GETNAME () "=" flowname.getValue ()); System.out.Println (" "); // Get a set of steps for a process

Java.util.list steps = flow.getChildren ();

For (int J = 0; j

ELEMENT Step = (Element) Steps.get (j); // First Step

Attribute stepid = step.getattribute ("stepid");

Attribute stepname = step.getattribute ("name"); system.out.print ("[" stepid.getname () "=" stepid.getValue () ";");

System.out.println (stepname.getname () "=" stepname.getValue () "]");

System.out.println ("Step Contents");

Java.util.List Stepchilrens = step (Step.getChildren (); for (int K = 0; k

ELEMENT Stepchilren = (Element) Stepchilrens.get (k); // Get one content item under the steps

System.out.print ("-");

System.out.println (Stepchilren.getName () "=" stepchilren.getValue ());

}

} System.out.println (" ");

}

} catch (exception ex) {

System.out.print (ex.getMessage ());

}

}

}

(Refer to Table 2)

The result of the processing is incorporated herein by reference, I have not been processed by the United States. (Refer to Table 3).

FlowEngine.java handles live results of the flow.xml file.

Difference 0 FlowID = 1 Name = Send a document

[stepid = 1; Name = proposed]

The steps are as follows

-ForWord = 0

-Nextstep = 2

-Display_page = ng.jsp

-Action_page = saveng.jsp

-Step_note = Proposed Plenary For the first step

[stepid = 2; Name = audit]

The steps are as follows

-ForWord = 1

-Nextstep = 3

-Display_page = sh.jsp

-Action_page = saves.jsp

-Step_note = audit is the first review of the union of the union of the documents

Process 1 flowid = 2 Name = collection

[stepid = 1; Name = registration]

The steps are as follows

-ForWord = 0

-Nextstep = 2

-Display_page = dj.jsp

-Action_page = savedj.jsp

-Step_note = The first step registration after receiving the file

[stepid = 2; Name = department leadership instructions]

The steps are as follows

-ForWord = 1

-Nextstep = 3

-Display_page = dps.jsp

-Action_page = savedps.jsp

-Step_note = file passing through department leadership can take the next step

[stepid = 3; Name = vision]

The steps are as follows --forword = 2

-Nextstep = 4

-Display_page = cy.jsp

-Action_page = savecy.jsp

-Step_note = file is to see all people, so you need to pass it.

I strongly recommend that you use XML technology as part of the technology of process engine, so that you can implement and later applications will be flexible.

转载请注明原文地址:https://www.9cbs.com/read-24656.html

New Post(0)