Summary of the invention
In order to improve extendability and the portability of Flow driving, and then the Practical Performance of raising Flow driving, the embodiment of the present invention provides a kind of Flow driving method and device.Described technical scheme is as follows:
On the one hand, provide a kind of Flow driving method, described method comprises:
Determine the flow process element of flow process to be driven, and flow process behavior corresponding to described flow process element;
For described flow process element is selected corresponding execution object, by described flow process element map in the execution object of described correspondence, and the flow process behavior of described flow process element is assembled in the execution object of described correspondence, described execution object comprises executive process, wakeup process and end process;
When carrying out object described in external call, start the implementation of described execution object.
On the other hand, provide a kind of Flow driving device, described device comprises:
Determination module, for determining the flow process element of flow process to be driven, and flow process behavior corresponding to described flow process element;
Mapping block, be used to described flow process element to select corresponding execution object, by described flow process element map in the execution object of described correspondence, and the flow process behavior of described flow process element is assembled in the execution object of described correspondence, described execution object comprises executive process, wakeup process and end process;
Driver module, for starting the implementation of described execution object when carrying out object described in external call.
The beneficial effect of the technical scheme that the embodiment of the present invention provides is:
By by flow process element map in corresponding execution object, and when this execution object of external call, start and carry out the implementation of object, to carry out object, summarize the behavioural characteristic of various flow process language, the driving of realization to flow process, not only can support block flow process language, also can support well figure shape flow process language, thereby improve the extendability of Flow driving; In addition, because the technical scheme that the embodiment of the present invention provides is not bound with any specific data storage layer technology and IOC container, therefore, there is very high portability.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Embodiment mono-
Referring to Fig. 1, the present embodiment provides a kind of Flow driving method, and the method flow process is specific as follows:
101: determine the flow process element of flow process to be driven, and flow process behavior corresponding to this flow process element;
102: this flow process element map, in corresponding execution object, and is assembled to the flow process behavior of this flow process element in corresponding execution object;
103: the implementation that starts this execution object when this execution object of external call.
The method that the present embodiment provides, by by flow process element map in corresponding execution object, and when this execution object of external call, start and carry out the implementation of object, to carry out object, summarize the behavioural characteristic of various flow process language, the driving of realization to flow process, not only can support block flow process language, also can support well figure shape flow process language, thereby improve the extendability of Flow driving; In addition, because the technical scheme that the embodiment of the present invention provides is not bound with any specific data storage layer technology and IOC container, therefore, there is very high portability.
Embodiment bis-
The present embodiment provides a kind of Flow driving method, and the method is passed through flow process element map, in corresponding execution object, to summarize the behavioural characteristic of various flow process language to carry out object, realizes the driving to flow process.For convenience of explanation, the present embodiment describes as an example of BPMN2.0 flow process language example, and Fig. 2 is the schematic diagram that is related between this BPMN2.0 flow engine and Flow driving device.Referring to Fig. 3, the method flow that the present embodiment provides is specific as follows:
301: determine the flow process element of flow process to be driven, and flow process behavior corresponding to this flow process element;
For this step, each specific flow process language has comprised various flow process elements, and about flow process element and the corresponding flow process behavior of how to confirm flow process to be driven, the present embodiment is not specifically limited.Take BPMN2.0 flow process language as example, its flow process element as shown in Figure 4, has comprised Process, Activity, and Event, the flow process elements such as SequnceFlow, corresponding flow process behavior can be as shown in Figure 5.
302: for this flow process element is selected corresponding execution object;
Particularly, the present embodiment represents to carry out object with Executable Object, be seen as a Java Bean with specific behavior, and three kinds of processes have been defined, i.e. executive process execute (), wakeup process awaken () and finish process complete ().Wherein, execute () is for carrying out service logic, and this service logic is the service logic that the flow process that is mapped in this execution object is carried; Awaken (), for waking execution object up, during practical application, recovers to wake up execution object by carrying out data; Complete () carries out service logic at execute () and finishes rear called.
Although each execution object has execute (), awaken (), three processes of complete (), the specific implementation of these processes is not necessarily identical.Referring to Fig. 6, according to the difference of process implementation, can be divided into net (NetInstance), node (NodeInstance) and arc (ArcInstance) three types by carrying out object.Wherein, a net can comprise several interconnected node and arcs; Node can have several input arcs and several output arcs, and each arc must have an input node and an output node; In addition, a net can comprise subnet, and the relation between various execution objects can be as shown in Figure 7.
About how for flow process element is selected corresponding execution object, the present embodiment does not limit concrete selection mode, still take the flow process element in BPMN2.0 as example, can select Process flow process element map in the execution object of Net type, the flow process such as Activity, Event element map in the execution object of Node type, and by flow process element map such as SequnceFlow in the execution object of Arc type.
303: this flow process element map, in corresponding execution object, and is assembled to the flow process behavior of this flow process element in corresponding execution object;
Wherein, after the flow process behavior of this flow process element is assembled in corresponding execution object, all execution objects can be assembled to inner core managing device, by this inner core managing device, be in charge of a series of execution objects that have cross correlation, when object is carried out in external call, by this inner core managing device, be responsible for calling the implementation of carrying out object.
304: the implementation that starts this execution object when this execution object of external call.
For this step, the mode of expressing the service logic of carrying due to different process definition languages is different, and ExecutableObject can not be hard coded into all situations in Flow driving device architecture in advance.Therefore, the method that the present embodiment provides adopts the design philosophy of extension point to meet this demand: for each ExecutableObject has assembled 3 extension points, quote 3 fixing interface: IncomingLogic, BusinessLogic, LeavingLogic, as shown in Figure 8.
Wherein, in IncomingLogic interface, be provided with canBeFired () object, for judging whether service logic has met executive condition; In BusinessLogic, be provided with perform () object, for carrying out real service logic; In LeavingLogic, be provided with determineLeavingStragegy () object, for indicate next step operation when service logic finishes, next step operation may be to carry out a new ExecuteObject, also may be to return to upper level ExecuteObject, and call its complete () method.
While starting the implementation of carrying out object, first call the canBeFired () object arranging in IncomingLogic interface, call again the perform () object arranging in BusinessLogic, finally call the determineLeavingStragegy () object arranging in LeavingLogic, that is to say, while starting the implementation of carrying out object, specifically comprise:
Judge whether to trigger the corresponding service logic of execution object;
If so, carry out service logic, and after execution finishes, indicate next step operation.
Wherein, carry out service logic, specifically comprise:
Call executive process execute () and carry out service logic, and after execution service logic finishes, call end process complete ();
If need the long-time service logic of carrying out, the state of carrying out object is kept in storage medium, until carry out service logic, finish, call wakeup process awaken () and carry out data recovery, and call end process complete () after data are recovered.
The method that the present embodiment provides, by by flow process element map in corresponding execution object, and when this execution object of external call, start and carry out the implementation of object, to carry out object, summarize the behavioural characteristic of various flow process language, the driving of realization to flow process, not only can support block flow process language, also can support well figure shape flow process language, thereby improve the extendability of Flow driving; In addition, because the technical scheme that the embodiment of the present invention provides is not bound with any specific data storage layer technology and IOC container, therefore, there is very high portability.
Embodiment tri-
Referring to Fig. 9, the present embodiment provides a kind of Flow driving device, and this device comprises:
Determination module 901, for determining the flow process element of flow process to be driven, and flow process behavior corresponding to flow process element;
Mapping block 902, for by flow process element map to corresponding execution object, and the flow process behavior of flow process element is assembled in corresponding execution object;
Driver module 903, for starting the implementation of carrying out object when object is carried out in external call.
Particularly, referring to Figure 10, driver module 903, specifically comprises:
Judging unit 9031, for when object is carried out in external call, judges whether to trigger the corresponding service logic of execution object;
Performance element 9032, for when judging unit 9031 judgements can trigger service logic, carries out service logic;
Indicating member 9033, for after carrying out service logic at performance element 9032 and finishing, indicates next step operation.
Further, referring to Figure 11, performance element 9032, specifically comprises:
First calls subelement 9032a, for calling executive process, carries out service logic;
Second calls subelement 9032b, for first call executive process that subelement 9032a calls and carry out service logic and finish after, call end process;
The 3rd calls subelement 9032c, for calling first executive process that subelement 9032a calls, need long-time while carrying out service logic, the state of carrying out object is kept in storage medium, until carry out service logic, finish, call wakeup process and carry out data recovery, and call end process after data are recovered.
The device that the present embodiment provides, by by flow process element map in corresponding execution object, and when this execution object of external call, start and carry out the implementation of object, to carry out object, summarize the behavioural characteristic of various flow process language, the driving of realization to flow process, not only can support block flow process language, also can support well figure shape flow process language, thereby improve the extendability of Flow driving; In addition, because the technical scheme that the embodiment of the present invention provides is not bound with any specific data storage layer technology and IOC container, therefore, there is very high portability.
It should be noted that: the Flow driving device that above-described embodiment provides is when driving flow process, only with the division of above-mentioned each functional module, be illustrated, in practical application, can above-mentioned functions be distributed and by different functional modules, completed as required, the inner structure of the equipment of being about to is divided into different functional modules, to complete all or part of function described above.In addition, Flow driving device and Flow driving embodiment of the method that above-described embodiment provides belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
All or part of step in the embodiment of the present invention, can utilize software to realize, and corresponding software program can be stored in the storage medium can read, as CD or hard disk etc.
The foregoing is only preferred embodiment of the present invention, in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.