views:

408

answers:

6

As a part of our application I need to write "simple" workflow system which will be used for supporting document creation life-cycle. It should support: - different activities: edit document, verify document (approve, reject), publish document... - assign this activities to different people/users - "parallel split and join". For example I want to support workflow like this:

- begin
1.) Create document
2.) Translate document
2.1) Translate into English
2.1.1) Translate document into English
2.1.2) Verify English translation
2.2) Translate into Italian
2.2.1) Translate document into Italian
2.2.2) Verify Italian translation
3.) Verify complete document
4.) Publish document
- end

It will be used in an asp.net application (C#).

The final part: I would like to know if there is any pattern, library or article which would help me to get started with this task? Would WWF be appropriate for this?

There is some material (even on stackoverflow) but I don't know how to deal with the parallelism?

A: 

I would just use Windows Workflow for this it should be relatively easy to model the workflow, and you wont have to worry about issues you dont care about about, like keeping track of workflow state, and things like that, that are outside of your business domain problem.

http://msdn.microsoft.com/en-us/library/aa480214.aspx

Matthew Vines
A: 

Few years back i had worked on a project that implemented a workflow system.It was a home grown solution as the database already existed.Basically we provided a web interface to a cocoa based solution.

You can use an open source BPM solution ( i had seen JBPM for java, you can search a good ASP based open source solution).Mostly these solution are process based, in other words you define a process or workflow in an xml file.Each Approver is a node and next node in the tree comes into picture if only parent node has approved.You can get good documentation on this on the web.

Also ASP would not be a problem.For your own solution, i would suggest create the database first.Basically you need a way to store a tree structure in the database.Parallel can be handled if two nodes have same parent, you can put an attribute like 'has_approved' and flow would progres further only if both the nodes have has_approved = 1.

Its a broader topic , i hope i am clear in this post.Also if you take opensource BPM solution pick the one which is simplest, because you will have to make changes to the code to suit your particular solution.

Rajat
+2  A: 

A workflow engine is a deceptively simple concept. Creating a robust, administerable implementation is much more works than it appears. Strongly favour off-the-shelf rather build it yourself. WWF looks to fit your needs.

djna
A: 

While what you are asking is possible, there is nothing "simple" about rolling your own workflow host based on .NET 3.x workflow runtime. Take this from someone who has done this. It will get much easier in .NET 4.0, so it is also worthwhile to consider that your solution will be obsolete in a few months.

If your problem domain contains only document-based workflows, I strongly suggest that you consider a SharePoint solution instead. Please see the following links for some information on this option:

http://office.microsoft.com/en-us/sharepointdesigner/HA101005911033.aspx http://channel9.msdn.com/posts/RobertShelton/Building-an-Approval-Workflow-with-SharePointMOSS-2007-and-Visual-Studio-2008/

Jerry Bullard
A: 

It's not that difficult to implement. I found it simple enough it didn't need a huge packaged solution.

You need to determine what items are to be monitored (documents). Then you need to determine what states (or statuses) those documents can be in. The statuses record what step a document is in your processing. (Where it is in your "work flow"). You've already done that in your post.

A state machine is an excellent pattern to handle movement of documents through various statuses: http://en.wikipedia.org/wiki/State%5Fmachine

You still have to build a list of each state a document can be in and what happens to it to move it to a new state. You've done most of the work already. The code for your assignment shouldn't take more than a page or two.

A sample implementation:

Assign each document a number so you can track it, and assign it a status that shows where it is in your process. Usually both of those are done with a number, but don't have to be.

Something like this:

public class document
{
  public int documentId;
  public String documentStatus;
}

// create a new document to track
document doc = new document();
doc.documentId = 42;       // arbitrary id#
doc.documentStatus = "1";  // document is at the start of the process
Jay
+1  A: 

Play around with the WF Virtual Labs. Once you get your hands on the technology, you will have a much better understanding if WF is appropriate or you should roll your own. Also, you can check out K2, but that is much more heavyweight.

JP Alioto