[Hippo-cms7-user] Using Workflows from code

Berry van Halderen b.vanhalderen at onehippo.com
Fri Oct 7 13:09:15 CEST 2011

On Wed, Oct 5, 2011 at 10:30 PM, mindy <mindy.engelberg at disney.com> wrote:
> I'm getting further.  After looking at the source code, I see
> FullReviewedActiosnWorkflow also has a delete method so I called that.  But
> I got an exception telling me I can't delete the document because it is
> published.

Workflows are pluggable, so we can't give you an exhaustive list of
all possible jars needed.  But the two JARs you currently have
(reviewed actions and the builtin workflow) are by far the main ones.

> I tried again by first putting an unpublish call before the delete call.
> The unpublish worked but the delete call did not because the document no
> longer exists.
> So, I tried again, getting the document again (I guess unpublishing replaced
> it with another document with a different uuid?) and that time it deleted.

Yes, this is a generic issue, because workflow calls are executed in a
different session than yours (to obtain more rights amongst others),
they may change things and your session state does not reflect the
persisted state.  Handles are stable, so that is why all references
are to handles, not document instances.  In general, you should
perform a session.save() before doing a workflow call, and a
session.refresh(false) after a workflow call.  Then re-obtain the
specific document variant from the handle.  So
handleNode.getNode(handleNode.getName()) normally.

> But the translations are still in the repository so it's not fully deleted.
> Am I supposed to manually also delete all the translations?

That is not correct, the translations ought to get removed automatically.

> What is the correct way to delete a document?  Seems like I have to first
> unpublish it then re-get the document by its path and then delete it.  Is
> there anything else?  How do I get rid of the translation nodes related to
> that document?

Hmm, I think something failed in that case, can you check the log
files, because normally everything is deleted (or moved to the attic,
a trash-can like location).  When I tried it it worked.


More information about the Hippo-cms7-user mailing list