Support workflows on documents that are not hippostdpubwf:document in the WorkflowPersistenceManagerImpl

Currently the WorkflowPersistenceManagerImpl is tightly coupled with publishable documents and thus the DocumentWorkflow and the hippostdpubwf:document document types. This renders the WorkflowPersistenceManagerImpl useless for the purpose of invoking workflows on documents that are not of the type hippostdpubwf:document.

It should be noted that the DocumentWorkflow is not actually intended for invoking workflow operations on any document, which could also be an asset or an image. Rather, the DocumentWorkflow implements the “Document workflow” for publishable documents and is tailored specifically towards that workflow. “Simple documents”, like images and assets, have their own respective workflow implementations.

It currently is not possible to use the WorkflowPersistenceManager to invoke workflows on custom simple documents.

In “HSTTWO-2837 Non-publishable documents created by workflow remain in preview” Jeroen also questioned this coupling between the WPM and publishable documents:

I’m not so sure about the functional contract between WorkflowPersistenceManager and hippostdpubwf:document since it just triggers (repository) workflows which can be anything. If there is a contract, it’s really hidden and implicit.

Unfortunately, this comment was not followed upon. It does show however, that at the time, it was possible to use the WorkflowPersistenceManager to save non-publishable documents. And after the fix for HSTTWO-2837 it was even possible for these documents to be automatically be published (as even non-publishable documents need a “live” availability status to become visible).

However, this was then later reverted in HSTTWO-4686 by Ard. Since this change, the WorkflowPersistanceManagerImpl relies on the document workflow to update the availability status (through ((DocumentWorkflow)docWf).commitEditableInstance()). Casting to DocumentWorkflow instead of EditableWorkflow effectively broke the use-case the WorkflowPersistenceManager had for non-publishable documents.

I think there is a valid use case for the WorkflowPersistenceManagerImpl to be able to invoke any Workflow on any document type, and not tie this to the document workflow for publishable documents. The two aspects that broke support for non-publishable documents can easily be addressed in the WorkflowPersistenceManagerImpl.

WDYT? Should this be addressed in WorkflowPersistenceManagerImpl, or should users working with custom simple document workflows be expected to implement their own WorkflowPersistenceManager?


did you implement a custom workflow persistence manager? Did you adapt the process for writing images?