From 644d4e38051bf185ee6467c72e30ce0e0d09198a Mon Sep 17 00:00:00 2001 From: Bruno Ilponse Date: Fri, 23 Nov 2018 11:27:34 +0100 Subject: [PATCH 1/2] Made compatible with nuxeo 9.10 (ecm.isTrashed not supported) Made the proxy factory inherit RenditionPublicationFactory to enable renditions --- nuxeo-tree-snapshot-core/pom.xml | 5 +++++ .../main/java/org/nuxeo/snapshot/SnapshotableAdapter.java | 2 +- .../java/org/nuxeo/snapshot/pub/FolderishProxyFactory.java | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nuxeo-tree-snapshot-core/pom.xml b/nuxeo-tree-snapshot-core/pom.xml index c10ef0e..6241780 100644 --- a/nuxeo-tree-snapshot-core/pom.xml +++ b/nuxeo-tree-snapshot-core/pom.xml @@ -44,6 +44,11 @@ org.nuxeo.ecm.automation nuxeo-automation-server + + org.nuxeo.ecm.platform + nuxeo-platform-rendition-publisher + + org.nuxeo.ecm.platform diff --git a/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java b/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java index 5ec181f..1378bad 100644 --- a/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java +++ b/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java @@ -145,7 +145,7 @@ public Snapshot createSnapshot(VersioningOption option) { doc.getCoreSession().save(); String query = "SELECT ecm:uuid FROM Document WHERE ecm:parentId = '" + doc.getId() - + "' AND ecm:isTrashed = 0 ORDER BY ecm:pos"; + + "' AND ecm:currentLifeCycleState <> 'deleted' ORDER BY ecm:pos"; try (IterableQueryResult res = doc.getCoreSession().queryAndFetch(query, "NXQL")) { vuuids = new String[(int) res.size()]; diff --git a/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/pub/FolderishProxyFactory.java b/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/pub/FolderishProxyFactory.java index 847259e..d24b27d 100644 --- a/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/pub/FolderishProxyFactory.java +++ b/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/pub/FolderishProxyFactory.java @@ -28,10 +28,11 @@ import org.nuxeo.ecm.platform.publisher.api.PublishedDocument; import org.nuxeo.ecm.platform.publisher.impl.core.SimpleCorePublishedDocument; import org.nuxeo.ecm.platform.publisher.task.CoreProxyWithWorkflowFactory; +import org.nuxeo.ecm.platform.rendition.publisher.RenditionPublicationFactory; import org.nuxeo.snapshot.Snapshot; import org.nuxeo.snapshot.Snapshotable; -public class FolderishProxyFactory extends CoreProxyWithWorkflowFactory { +public class FolderishProxyFactory extends RenditionPublicationFactory { protected DocumentModel subPublish(CoreSession session, DocumentModel parentProxy, Snapshot tree, boolean skipParent) { From ae35cbea7e273589d1ab030a7b136a3a9a9a0619 Mon Sep 17 00:00:00 2001 From: Bruno Ilponse Date: Tue, 27 Nov 2018 13:45:18 +0100 Subject: [PATCH 2/2] Reverted the change that made nuxeo-tree-snapshot compatible with nuxeo 9.10 --- .../src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java b/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java index 1378bad..5ec181f 100644 --- a/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java +++ b/nuxeo-tree-snapshot-core/src/main/java/org/nuxeo/snapshot/SnapshotableAdapter.java @@ -145,7 +145,7 @@ public Snapshot createSnapshot(VersioningOption option) { doc.getCoreSession().save(); String query = "SELECT ecm:uuid FROM Document WHERE ecm:parentId = '" + doc.getId() - + "' AND ecm:currentLifeCycleState <> 'deleted' ORDER BY ecm:pos"; + + "' AND ecm:isTrashed = 0 ORDER BY ecm:pos"; try (IterableQueryResult res = doc.getCoreSession().queryAndFetch(query, "NXQL")) { vuuids = new String[(int) res.size()];