Import/Export Workflows


The ability to import/export Workflow Definitions would be helpful with maintaining recipes.
There's a fork for this here (Workflow Definitions only, Instances not yet implemented):



Piedone wrote Jun 8, 2013 at 12:18 PM

I don't understand why workflows are not content items. Having them as content items would create a non-issue for import/export as well as versioning and audit trail.

sfmskywalker wrote Jun 8, 2013 at 6:52 PM

Perhaps being a content item adds overhead that's not at all needed for a workflow? E.g., workflows are not to be rendered outside of the admin, it does not make sense to be able to add parts. Versioning may be nice of course.

Piedone wrote Jun 8, 2013 at 9:45 PM

Well the overhead of using content items is negligible (especially that workflows won't be stored by the tens of thousands) and the option of getting versioning (or at least the information about who modified a workflow and when) and import/export for free is more than enough justification.

I sincerely don't understand why this should be really a question and why Sebastien opted with using records directly. Having looked at the implementation today for the first time I really don't like it and I'm really surprised by its techniques. Records also make the whole module a lot less flexible as workflows are saved directly to records, not going through a service, but then the WorkflowManager service uses those records... Meaning you can't change the core of implementation by just swapping out a service, unlike it is in many other parts of Orchard.

sfmskywalker wrote Jun 10, 2013 at 12:53 AM

I can't think for Sébastien obviously, but I think the "start with the simplest possible solution, then refactor as requirements change" strategy was applied. This prevents over engineering. I for one like the implementation and the API exposed, but I do agree with you that instead of working directly with records and repositories, it may be nice to have a service class so that other code can reuse certain functions without having to know what objects to create.

Would you mind creating a list of things you would like to see different and back them up with use case scenarios? That would help establish new requirements and evolve this module.

CSADNT wrote Jun 10, 2013 at 11:42 AM

Workflows must be kept fast and have low footprint, I don't agree making them content items, they are a tool as NHibernate or Razor

Piedone wrote Jun 10, 2013 at 12:34 PM

I feel really strange having to argue for content items when we're talking about an Orchard module but let's elaborate the advantages we all know:
  • Simpler import/export (would still need the necessary driver method written of course)
  • Content events (to use programmatically)
  • Versioning (or at least basic audit trail)
  • Extensibility (Want to add a hint to workflows for your admins? How about a field?)
  • Extended permission handling (specific roles can only edit specific workflows)
  • What have I forgot?
Disadvantage: performance. But really? If the theoretical WorkflowPart would be eagerly loaded with a query hint (something safe to assume, since workflows are run from inside the Workflows module) then the only thing that can have a measurable performance impact is having to join in multiple tables (that are always joined in with content items). Well, who can prove me that these joins and the added memory/CPU usage because of having content item objects are that of a performance issue that they outweigh the benefits gets a chocolate cookie from me on Harvest :-). Warning: to prove this you have to implement Workflows with content items. But think about the delicious chocolate cookie!

I disagree with the semblance of Workflows being a tool like NHibernate or Razor. Clay, Newtonsoft.Json or probably even Orchard.Framework is a tool like them but Workflows is more like Projector: a versatile administrative tool. Aaaand, Projector queries are content items.

CSADNT wrote Jun 10, 2013 at 1:05 PM

Unfortunately I will not have opportunity to be at Harvest for the cookie :)

sfmskywalker wrote Jun 10, 2013 at 7:32 PM

I do like the sound of that cookie. :)

sfmskywalker wrote Jun 18, 2013 at 11:01 PM

Fixed in changeset 812535f55689

sfmskywalker wrote Mar 28, 2014 at 1:28 AM

Fixed in changeset ab6df9fa6b0efb8c2f7fbf05ea5c33032da2f564