Forehead
This article did not throw a running example, just the program block, but on the Wiki of OsWorkflow, Quake Wang has translated the official entry tutorial into Chinese, interested readers can read. About OSWORKFLOW more detailed content, you can refer to the official manual, I believe that you can read the official manual after you know the entry tutorial. Osworkflow concept
In the commercial and open source world, OsWorkflow is different from these existing workflow systems. The maximum difference is that OsWorkflow has very good flexibility. It may be difficult to master when you start contacting OsWorkflow (someone says not suitable for workflow newbits), for example, OSWORKFLOW does not require graphical tools to develop workflows, and recommend manually writing XML format workflow descriptors. It can integrate application developers and integrate with existing code and databases. All this seems to make people who are looking for fast "plug and play" workflow solutions, but the study found that those "Plug and Play" options cannot provide sufficient flexibility in a mature application. Realize all needs. Osworkflow advantage
OsWorkflow gives you absolute flexibility. OsWorkflow is considered to be a "low level" workflow implementation. Osworkflow just manually "CODED" is manually "CODED" with the other workflow system "LOOPS" and "Conditions". But this doesn't mean that the actual code is to completely manually encode, the scripting language can be competent. OsWorkflow does not want a non-technical user to modify the workflow, although some other workflow systems provide simple GUI for workflow editing, but changed this application like this, usually destroying these applications. Therefore, the best candidate for workflow adjustments is developers, they know how to change. However, in the latest version, OsWorkflow also provides the GUI designer to assist the workflow editing.
OsWorkflow is based on a limited state machine concept. Each State is combined by the Step ID and STATUS (which can be easily understood as STEP and its Status represents a state of the limited state machine). Transition to another State depends on the occurrence of Action, with at least one or more activities of the activity during the workflow period. These simple concepts show the core idea of the OsWorkflow engine and allow a simple XML file to interpret the workflow business process.
OsWorkflow Core Concept Step Step A Step is where the workflow is located. May be transferred from a STEP to another Step (or sometimes still staying in the same STEP). For example, an OA system's holiday process, its STEP name may have a "departmental approval phase", "office approval phase", "general manager approval stage". Status Workflow Status is a string used to describe the specific steps in the workflow. Osworkflow has underway, Queued (waiting), Finished, three STATUs. Action Action Specifies the transition that may occur within STEP, resulting in changes in STEP. In the OA system, "This department approval phase" may have "rejection" or "approval" two Actions. The relationship between Action and STEP is that Step Description "Where", Action Description "Where can I go". An Action is typically consisting of two parts: CONDition (condition) that can be performed, and Result to perform this action. Condition is similar to logical judgment, which can contain "and" and "OR" logic. For example, a "this department approval phase" in the process of leave the process, this stage uses "AND" logic to determine if the process status is waiting for the waiting process, and whether the approval is the main department. Result Result Representative points to the new STEP and its Step Status, it is also possible to enter split or join. Result is divided into two, Contidional-Result, only the condition is true when the condition is true, and the unconditional-result (unconditional result), which is used when the condition does not satisfy or not condition. Split and fusion of the split / join process. Very simple concept, split offers multiple Result; Join judges the state of multiple Current Step, providing a result.
OsWorkflow Package Use Analysis and Code Dischart Com.opensymphony.Workflow This package provides a core interface for the entire OsWorkflow engine. For example, com.opensymphony.workflow.workflow interface, it can be said that most of the actual development is expanded around the interface, which has three implementations of BasicWorkflow, EJBWORKFLOW, OFBIZWORKFLOW.
com.opensymphony.workflow.basic This package has two classes, BasicWorkflow and BasicWorkflowContext. BasicWorkflow does not support transactions, although dependence on persistence, the transaction cannot be parked. BasicWorkflowContext rarely used in actual development.
Public void setWorkflow (int userid) {Workflow Workflow = New BasicWorkflow (Integer.tostring (userID));}
Com.opensymphony.workflow.config This package has an interface and two implementation classes for the interface. Before OsWorkflow 2.7, the status is maintained by a static field of multiple places, which is very convenient, but there are many defects and constraints. The most important disadvantage is that multiple OSWORKFLOW instances cannot be run over different configurations. Implementation class defaultConfiguration is used for general profiles. SpringConfiguration is to let Spring container management configuration information. Public void setConfiguration {SpringConfiguration; Workflow.SetConfiguration (configuration);
Com.opensymphony.workflow.ejb This package has two interfaces WorkflowHome and WorkflowRemote. In several classes of the package, the most important thing is that EJBWORKFLOW, the role of this class, is the core of OSWORKFLOW, and utilizes EJB container management transactions, as well as a wrapper for workflow session beans.
com.opensymphony.workflow.Loader This package has several classes, using the most xxxxdescriptor, if you need to understand the specified action, the state, name, etc. when the workflow engine is running, these descriptors will play a very Big role.
public String findNameByStepId (int stepId, String wfName) {WorkflowDescriptor wd = workflow.getWorkflowDescriptor (wfName); StepDescriptor stepDes = wd.getStep (stepId); return stepDes.getName ();}
Com.OpenSymphony.Workflow.Ofbiz Offlowflow and BasicWorkflow are very similar to many aspects, in addition to calling offbiz transactionutil to pack transactions.
Com.opensymphony.workflow.query is mainly designed for queries, but not all workflow storage supports query. Usually, both Hibernate and JDBC support, and memory workflow storage is not supported. It is worth noting that hibernate storage does not support hybrid queries (for example, a query contains the History STEP context and the Current Step context). Perform a query, you need to create a WorkflowExpressionQuery instance, then call the Query method of the Workflow object to get the final query result.
public List queryDepAdmin (int userId, int type) {int [] arr = getSubPerson (userId, type); // construct an expression Expression [] expressions = new Expression [1 arr.length]; Expression expStatus = new FieldExpression (FieldExpression .STATUS, FieldExpression.CURRENT_STEPS, FieldExpression.EQUALS, "Queued"); expressions [0] = expStatus; for (int i = 0; i OsWorkflow supports remote calls through SOAP. This call is implemented with WebMethods. Com.opensymphony.Workflow.SPI This package can be said to be the way OsWorkflow and persistent layers, such as the current workflow entity, including: EJB, Hibernate, JDBC, Memory, OFBIZ, OJB, Prevayler. HibernateWorkflowntry HWFE = (HibernateWorkflowntry) gethibernateTemplate () .find ("from hibernateworkflowntry where id =" wfidList.get (i)). Get (0); com.opensymphony.workflow.util This package is an OsWorkflow toolkit, including support for Beanshell, BSF, EJB LOCAL, EJB Remote, JNDi. Small knot Since I want to introduce the workflow engine in the OA system, the OsWorkflow engine has been analyzed. With OSWORKFLOW, the procedure procedure has been implemented in the system that combines the RBAC model existing in the OA system for step-by-step review. I personally think that I have to use OsWorkflow to get a lot of processes. It is mainly necessary to expand and do too much. In addition, the original words of quake wang: E-government / OA If you want to use Workflow Engine, Workflow Engine, and the Workflow Engine, and the like. SHARK and JBPM are forced you to use its user model, how to map corporate models (including organizational structures), is a cumbersome thing, such as common OA applications, the responsible persons of the applicant corresponding to the next process Artificial participants, use Shark or JBPM to get around a circle, obtain the user, then obtain the user, and then correspond to it. This is just a simple need, not to mention the tissue structure of domestic enterprises, as well as a variety of special processes, use WFMC or other so-called Workflow general standards to do not very standard things. Do not give it. Use OsWorkflow this state-based Workflow Engine, which will be relaxed, and it has not forced you to use its user model. In addition, corrective: OsWorkflow not only supports simple Beanshell, but also supports Java Class, BSF, EJB. If you do e-government / OA, I feel that OsWorkflow is the most applicable OpenSource Workflow Engine. (Note that the reference should indicate the original author posted this article:! Rosen Jiang and Source: http: //blog.9cbs.net/rosen)