Osworkflow basic API

Source: Internet
Author: User
API-basics:
 
§ Sworkflow provides a centralized workflow implementation method:
Basicworkflow
Ejbworkflow
Ofbizworkflow
§ Create a new workflow instance and execute action
Workflow workflow = new basicworkflow ("testuser ");
Defaultconfiguration Config = new defaultconfiguration ();
Workflow. setconfiguration (config );
Long workflowid = workflow. initialize ("mytest", 1, null );
Workflow. doaction (workflowid, 1, null );
API-abstractworkflow:
 
§ All core code related to workflow flow in osworkflow is in abstractworkflow. basicworkflow is derived from it. You can derive your own workflow class from abstractworkflow to add the extension function.
§ The Most Important Method doaction
§ Other main functions: Initialize, executefunction, many get methods, query, state related, and so on
API-configuration file:
 
§ The configuration instance is responsible for loading system configurations. Abstractworkflow calls its load method, which searches for a configuration file named osworkflow. xml and parses it.
§ Workflowfactory includes xmlworkflowfactory, jdbcworkflowfactory, and urlworkflowfactory to load different workflow definitions and maintain a map.
§ Workflowloader reads configuration files
§ Workflowdescriptor converts XML in a plane to an object of true significance used in osworkflow.
§ Other different descriptor, such as (step, action ............) .
Other different descriptor, such as (step, action ............) .
API-query:
 
§ Purpose: to check the current running status of the process.
§ Workflowquery and its related classes (query package)
§ Workflowquery queryleft = new workflowquery (
Workflowquery. Owner, workflowquery. Current, workflowquery. Equals, "test ");
Workflowquery queryright = new workflowquery (
Workflowquery. Status, workflowquery. Current, workflowquery. Equals, "underway ");
Workflowquery query = new workflowquery (
Queryleft, workflowquery. And, queryright );
List workflows = WF. Query (query );
For (iterator = workflows. iterator (); iterator. hasnext ();)
Long wfid = (long) iterator. Next ();
}
§ Abstractworkflow directs workflowstore to perform actual queries, and stores the query results in the arraylist
§ Purpose: to check the current running status of the process.
§ Workflowquery and its related classes (query package)
§ Workflowquery queryleft = new workflowquery (
Workflowquery. Owner, workflowquery. Current, workflowquery. Equals, "test ");
Workflowquery queryright = new workflowquery (
Workflowquery. Status, workflowquery. Current, workflowquery. Equals, "underway ");
Workflowquery query = new workflowquery (
Queryleft, workflowquery. And, queryright );
List workflows = WF. Query (query );
For (iterator = workflows. iterator (); iterator. hasnext ();)
Long wfid = (long) iterator. Next ();
}
§ Abstractworkflow directs workflowstore to perform actual queries, and stores the query results in the arraylist
API-user management:
 
§ Functions provided by osworkflow in user management, including user creation, Group definition, user verification, tracking records of step executors, and judgment of execution permissions.
§ User/group management is completed by usermanager
§ Detailed explanation in the code
Code details
Osworkflow task management:
 
§ The osworkflow engine is only responsible for "flow operation". Of course, this operation is determined based on the action and condtion you define.
§ Condition-condition judgment
§ Function (pre and post) -- functions to be called during step, action, and result execution
§ Functionprovider interface and execute Method
§ <Step id = "4" name = "Assign">
§ <Pre-functions>
§ <Function type = "class">
§ <Arg name = "class. Name"> nucleus. Assign. assignmentfunction </Arg>
§ <Arg name = "participant ipant"> A </Arg>
§ <Arg name = "participant ipanttype"> role </Arg>
<Arg name = "actionid"> 22 </Arg>
§ </Function>
§ </Pre-functions>
§ <Actions>
§······
§ </Actions>
§ </Step>
</Step>
Osworkflow schedule:
 
§ Scheduled execution of a task, quartz
§ <Function type = "class">
<Arg name = "class. Name"> com. opensymphony. workflow. util. schedulejob </Arg>
<Arg name = "triggerid"> 1 </Arg>
<Arg name = "jobname"> testjob </Arg>
<Arg name = "triggername"> testtrigger </Arg>
<Arg name = "groupname"> test </Arg>
<Arg name = "repeat"> 10 </Arg>
<Arg name = "repeatdelay"> 2000 </Arg>
<Arg name = "cronexpression"> 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 ****? </Arg>
<Arg name = "username"> test </Arg>
<Arg name = "password"> test </Arg>
<Arg name = "local"> true </Arg>
<Arg name = "schedulerstart"> true </Arg>
</Function>
§ Trigger and jobdetail)
Finally, I will explain the small example of osworkflow, which will be completed in about 1 hour and 40 minutes. The above is the basic content of the PPT.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.