This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git


The following commit(s) were added to refs/heads/master by this push:
     new 9902106  SLING-9417 Versioning support for nt:file as child of 
versioned node
9902106 is described below

commit 9902106a166b8d81aadbd28b752103e1844e2367
Author: Matthias Herold <[email protected]>
AuthorDate: Tue May 5 13:21:56 2020 +0200

    SLING-9417 Versioning support for nt:file as child of versioned node
---
 .../sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java    | 6 +++++-
 .../jcr/resource/internal/helper/jcr/JcrNodeResourceMetadata.java  | 7 ++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
 
b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
index 408b703..0612dde 100644
--- 
a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
+++ 
b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
@@ -20,6 +20,8 @@ import static org.apache.jackrabbit.JcrConstants.JCR_CONTENT;
 import static org.apache.jackrabbit.JcrConstants.JCR_DATA;
 import static org.apache.jackrabbit.JcrConstants.NT_FILE;
 import static org.apache.jackrabbit.JcrConstants.NT_LINKEDFILE;
+import static javax.jcr.nodetype.NodeType.NT_FROZEN_NODE;
+import static javax.jcr.Property.JCR_FROZEN_PRIMARY_TYPE;
 
 import java.io.InputStream;
 import java.net.URI;
@@ -182,7 +184,9 @@ class JcrNodeResource extends JcrItemResource<Node> { // 
this should be package
             try {
                 // find the content node: for nt:file it is jcr:content
                 // otherwise it is the node of this resource
-                Node content = node.isNodeType(NT_FILE)
+                Node content = (node.isNodeType(NT_FILE) ||
+                                (node.isNodeType(NT_FROZEN_NODE) &&
+                                 
node.getProperty(JCR_FROZEN_PRIMARY_TYPE).getString().equals(NT_FILE)))
                         ? node.getNode(JCR_CONTENT)
                         : node.isNodeType(NT_LINKEDFILE) ? 
node.getProperty(JCR_CONTENT).getNode() : node;
 
diff --git 
a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceMetadata.java
 
b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceMetadata.java
index d964543..06ac04e 100644
--- 
a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceMetadata.java
+++ 
b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceMetadata.java
@@ -25,6 +25,8 @@ import static org.apache.jackrabbit.JcrConstants.JCR_ENCODING;
 import static org.apache.jackrabbit.JcrConstants.JCR_LASTMODIFIED;
 import static org.apache.jackrabbit.JcrConstants.JCR_MIMETYPE;
 import static org.apache.jackrabbit.JcrConstants.NT_FILE;
+import static javax.jcr.nodetype.NodeType.NT_FROZEN_NODE;
+import static javax.jcr.Property.JCR_FROZEN_PRIMARY_TYPE;
 
 import java.util.Collection;
 import java.util.Map;
@@ -60,7 +62,10 @@ class JcrNodeResourceMetadata extends ResourceMetadata {
     private Node promoteNode() {
         // check stuff for nt:file nodes
         try {
-            if ( (!nodePromotionChecked) && node.isNodeType(NT_FILE)) {
+            if ( (!nodePromotionChecked) &&
+                    (node.isNodeType(NT_FILE) ||
+                     (node.isNodeType(NT_FROZEN_NODE) &&
+                      
node.getProperty(JCR_FROZEN_PRIMARY_TYPE).getString().equals(NT_FILE)))) {
                 creationTime = node.getProperty(JCR_CREATED).getLong();
 
                 // continue our stuff with the jcr:content node

Reply via email to