Page tree
Skip to end of metadata
Go to start of metadata

Problem

When workflow or scheduled publication are used then last version doesn't have to be the one which was published last. Also backup version of current state(created before restoring previous version) is latest created version but is not published. Magnolia doesn't provide way how to determine which version was published last and so what content is on public instance.

Impossibility of determination of latest published version is problem for synchronization  MGNLSYNC-34 - Getting issue details... STATUS  and also for determination if content was modified or not (Storing of activation status - MGNLACTIVATION-135).

Investigation of  MGNLSYNC-34 - Getting issue details... STATUS

Use case 1

1. create page X (v1) on author
2. publish page X (v1) approve workflow
3. modify page X (v2) on author
4. publish page X (v2) on author BUT DO NOT COMPLETE THE WORKFLOW (do nothing or assign but do not approve and publish)
5. use Synch app to synch website workspace from / recursively
6. page X (v1) should exist on public, but page X (v2) exists on the public after the sync.

Use case 2

1. Modify page X (version n) 
2. Publish page X (version n) at a scheduled date. 
3. run Synchronization module before scheduled date for publication of page X
4. page X (version n) synced to public instance

Use case 3

1. create version 1 (publish, but do not approve workflow)
2. create version 2 (publish, but do not approve workflow)
3. approve version 1 workflow
4. so version 2 is not approved and on public is version 1
5. do synchronization -> version 2 was synchronized to public, but should be 1

Use case 4

1. create version 1 (publish, but do not approve workflow)
2. create version 2 (publish, but do not approve workflow)
3. approve version 2 workflow
4. approve version 1 workflow
5. so on public is version 1, because it was approved after version 2
6. do synchronization -> version 2 was synchronized to to public, but should be 1

Use case 5 - no workflow module (content is directly published to public)

1. publish/create version 1
2. publish/create version 2
3. restore version 1 - backup version 3 of current state is created
5. so on public is version 2
6. do synchronization -> version 3 was synchronized to to public, but should be 2

Idea 1 (not working in all use cases)

My idea how to solve it was to use last version created before activation time. It solves "Use case 1" and "Use case 2", but doesn't  work properly in rest of use cases.

Idea 2 (not working in all use cases)

To fix this use case we can check open tasks and find out what versions wasn't approved. This is ok for "Use case 1" and "Use case 3", but won't work for others.

Idea 3 (not working in all use cases)

Check also resolved tasks. This seems to be little bit overkill especially that activation can be single item, but also recursive. 

In case of recursive activation versionMap(contains all sub-nodes uuid and version name) is not stored to task item. The versionMap is available only in work item(jbpm), but that is not available after task resolution.

So this solution would required to store versionMap and time when task was resolved to task parameters.

Problem is that this doesn't solve usecase with scheduled activation, because time when task was resolved is different to activation time.

And it also can't work with "Use case 5" because of no workflow.

Solution

Introduce metadata property which would hold latest activated version name (similar to mgnl:lastActivated, mgnl:lastActivatedBy and mgnl:activationStatus). This solution solves all the described use cases. Property should be also useful for determination if content was modified or not.

Implementation

  1. add mgnl:lastActivatedVersion property definition to mgnl:activatable mixin.
  2. store mgnl:lastActivatedVersion when call info.magnolia.jcr.util.NodeTypes.Activatable#update
  3. publishing and activation modules need to provide published version name to info.magnolia.jcr.util.NodeTypes.Activatable#update
  4. synchronization module reads mgnl:lastActivatedVersion property and synchronize last activated version
  5. while restoring previous version we need handle "mgnl:lastActivatedVersion" - keep last value and do not restore the one from version
  • No labels