This is a read-only archive of the forum.
Ok, i think i now have a pretty good understanding of ContentItem and I now need to start implenting a basic WorkFlow.
Could whoever is working on WorkFlow give me an outline (maybe some pseudo code) of how to go about implementing this?
Any help is greatly appreciated, and obviousley anything i develop will be made available.
Matt
Matt,
i have been looking at the trunk code too.
My thoughts are that an open source workflow engine shoudl be used so as to NOT reinvetn the wheeel.
Then a Service can be written that acts as a gateway.
Some i have found that:
http://www.netbpm.org/ ( a .NEt port of the java one)
http://www.openwfe.org/ ( java,m but with c# and other language connectors).
THe microsoft workflwo engine is pretty good, but i thinks its not wise to be too coupled to MS as they may put in handels to unmanaged code.
ged
Do you have any ideas on how to go about implementing any of these? What would need to be done?
Is this the way the inital work in ContentItem is going towards? or a more simplified, custom implementation?
Matt
All workflwo engines work on the basic principle of sequences.
So lets just leave that workflwo engine as a black box.
All that i think needs to be done is to create a Service ( just like the File System Service) in the core, that acts as a gateway to the workflwo server.
The workflwo server must run as a Web domain with a WS and html web facades.
in terms of using this new service (Cuyahoga.Core.Services.WorkflowService) with the Content Items the logic should be injected i woudl have thought from the Modules. This woudl allow every Module to utilise worlfow as they see fit.
With most of these workflwo engines you use XML to configure the sequence, and you can write c# code using a Command Pattenr style. Both these bits of code could live in the Cuyahoga.Web.Modules ( and so be encapsulated within the Modules). At Runtime, when a workflow is initiated by a Module, it will need to crerate the workflow fromn the XML, but also get the dll's.
The PROBLEM is see is this:
The dlls that have the workflwo logic will rely on the all the code underneath in Cuyahoag to work ( data access layer, services, etc). So the workflwo engine as i see it MUST be sitting above Cuyahoga, in its own app domain.
Hence it calls into the Cuyahoga Web site (using WS soap) in order to execute each commands that are part of the workflow. This to me is the crucial architectural design element !!
i am sure there are some use cases pattenrs in which the Cuyahoag Core woudl also use the workflwo service for somethings it needs to do anyway. Martin and Max i am sure woudl have some ideas here.
I hope you see what i am getting at in the bold bit about the problme. I dont see it as a problme at all however.
WS access to Module is quite easy to do with Cuyahoga.
The abstract File System proposal i just put into the forum under Architecture is also VERY useful for workflow.
A classic workflwo woudl be to create thumbnail images ( mayeb 4 different resolutions) for any image uploaded.
Now you woudl almost definitly want to write a Image Convertor Module with all its logic and stuff, but it needs Data to work on.
By makign the File System Abstract you can much better control access to files in case they are renamed ete, because you woudl give the workflwo the Primary Key of the file, and so if it was renamed between the workflwo being initiated and the workflwo getting to the thumnailing of the file it would still fidn the correct file becausae it woudl find it based on the PK (Primary Key) and not the file name as it has to do now.
G
Have you already done any work towards this? or anything that might work as a starting point?
This isn't something i have done before, however i need to get workflow into my current project pretty sharpish, so any help is really appreciated.
Hey,
i have worked with a few different workflow systems.
i am not saying this is the best design at all. Its just one way of doing it.
The only thing i see as important is that the workflow engine is running in a seperate App domain as a Windows Service and then calling to the Cuyahoga Web Site via Web Services to do each command (sequence) of the workflow.
Also, i heard that someone was writing one for Cuyahoga, but i guess it was abandoned. Not sure.
Exposing all modules and the core as a web service is the first bit. THis is quite easy with the ajax ms library.
I decided to have a base class for all web service instantiatiosn so as to load up the correct sectrion ID, and hense the sections data htis way. This si realy easy and just sits on top of a normal module, using the Castle Container stuff than the Cuyahoag Web site uses.
Next the service gateway to the Workflwo system is needed. THis is in the Core.Services namespace with all the other services like email service, etc.
Because the Email service is exposed as a Web Service, the workflwo engine can call into it now too to do notifications.
Then a Module can call into the workflow engine via thsi service gateway service.
The Only thing the workflwo does need is the proxy code in order to call back into the Web Service Module. The proxcy can be generated easily from .NET, and then given to the workflow when you create each workflow, and it will just run it using the CodeDom. You also pass it the XMl BPEL sequence to tell it the order in whcih to do things.
The c# code is then stored as part of the workflow and executed by the workflow.
Have a workflwo designer can help too. Some implement the internation BPEL stardard (Business Process Execution Language), which makes it easy as its just XML. It also means you can swap out your workflwo engine.
i have gotten this far, and still a long way to go. !!
Most workflwo engines have a UI for admin and editors. This can be plugged in as a Module into Cuyahoga so that anyonme with the correct rights can access it. You will need this for workflow that require human intervention; the User can be directed to this screen in order to edit the workflwo and allow it to continue.
Also, you can configure a filter so that only the workflwos relating to a particulr Moduel are vieable, and so put this control in the Edit UI of the Module so you can see the state of all modules relating to a Workflow.
The workflow engine then will be able to call back into the Web Service Module in order to do work asynchronously.
This si a good design in that if you have a web farm your workflwo engine is using the same app domain as the Web site so you get good reuse and easier provisioning.
G
Hmmm, this sounds great, but i think it may be a bit too complex / a lot of work for my skill level / time available.
Is this the method that is planned to be implemented by Martjin and Max? Is there a simpler method? I mean, for the content item stuff we would be pretty happy with a simple draft -> publish workflow that wouldn't really change.
Any other ideas?
Matt
There have been several proposals for a workflow integration with Cuyahoga (just do a search on this forum for workflow).
I (still) think the best way to go from here is to have some simple general purpose flows (like edit - review - publish) hardcoded.
A workflow engine is a nice thing but a lot of work to integrate...
I will check my previous posts and summarize the task system based approach I was thinking about to use.
Regards,
Max
mgaerberI will check my previous posts and summarize the task system based approach I was thinking about to use.
That would be great, thanks Max
Matt
Ok, i have got a little something working (baring in mind it is rather simplistic)
So, the idea i have based it on, is that of just 3 workflow states. Draft, Published and Archived. What i have done is to create a Workflow decorator that detects when a content item is saved with a workflow status set to published. When this happens, the current published item is updated to archived, and the draft is saved as the now active published content item, whilst a new draft is created copying all the properties of the live content item.
All content items share the same global id, this way everything is linked together by a common id, whislt still maintaining there own unique id.
Now, i have added a new method to the ContentItemDao that allows you to pull back content items based on a section and workflow status. This then allows you to pull back drafts during editing, and published at the front end.
I have also edited the BaseModuleControl to have 2 new items. A checkbox that allows the control to toggle between draft and live when you are logged in as a relivant admin, and a new publish button. This publish button takes you to a new page, that lists all content items for that section with checkboxes (with content items that have changed since it's last publish automatically selected) and 2 date fields allowing you to set the published date.
There are still a couple of things i need to implement, but this is starting to work pretty nicely for me. What do you guys think of this method? Is this anywhere near what you were thinking of? or am i way off the mark? All feedback welcome.
Matt
d#grade,
man this is just so damn good !!! You are really standing high oin the shoulder of giants here.
Now how about a Labelling workfow to do bulk tagging and flagging to Live ?
Sorry but had to mention that.
G
Sure, can you explain what you mean a little more? I'm not 100% sure on what you mean.
Matt
Ok, i have hit a bit of a problem with my publish page.
Obviously this needs to be able to handle content items generically so i am creating a contentItemService instance typed to < IContentItemService< ContentItem>>, however, as it is the specific content items that imeplement the IWorkflowContentItem interface, saving a contentItem does not trigger the workflow decorator.
I beleive this is also the problem i was having with the rebuild index page.
Does anybody know a way around this?
Matt
Does anybody have any ideas? as the only thing i can think of is deligating the publishing to the modules (getting them to implement an interface first) however i'm not too keen on this approach as it means every module will pretty much have the same peice of code, but typed differently.
Any help is greatly appreciated
Matt
Doh! hit another problem today.
As i have explained earlier, when a content item is saved with a status of published, i attempt to save a copy of the published content item with a status of draft.
I now however seem to be having a problem creating a copy of content item. I have tried creating a new content item and copying the properties, however this is just a shalow copy and thus copies the same values from the origional object to the new objecrt. This bit works fine, however there are properties that can't just be copied (ie categories) as nhibernate will complain about a shared collection.
I've also tried creating a deep copy of the object, however it does too good a job, as it also copies all of the nhibernate data held along with the object, so reseting the id to -1, nhibernate knows the Id has changed and won't let you save it.
Does anybody have any ideas? i really need to get this working asap, as i don't have much time left to work on it.
Any help is greatly appreciated
Matt
Does anybody have any ideas on my last 2 posts? As i've been kinda holding off hoping someone could offere some advise, otherwise i'll have to do what ever i can to get it to work soon as i need to get it done.
I'd rather get it done right, but as i'm still learning most of this i do run up against walls. Also, if i am to hand over what i have done to the community, i'd rather it was working correctly too.
Any ideas?
Hi,
next week (as promised) I will have more time to answer your questions in more detail. Concerning the versioning I've another approach that does not copy whole objects but stores the values that changed in another db table.
I published the details in a pdf (see downloads page).
Regards,
Max
Hi Max,
Your versioning technique does actually sound pretty good, think i went down the lines i did at the moment as i was having difficuilty working this out myself.
I look forward to working a little closer together and hope we can really get this thing rolling.
Matt
Hi Max,
Is it this week? or next week you are able to help out?
Cheers
Matt