jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r915449 - in /jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav: jcr/AbstractResource.java jcr/DefaultItemCollection.java simple/DeltaVResourceImpl.java
Date Tue, 23 Feb 2010 17:31:04 GMT
Author: angela
Date: Tue Feb 23 17:31:04 2010
New Revision: 915449

URL: http://svn.apache.org/viewvc?rev=915449&view=rev
Log:
JCR-2510: AbstractResource: Use jcr:createdBy to expose DAV:creator-displayname

Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DeltaVResourceImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java?rev=915449&r1=915448&r2=915449&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/AbstractResource.java
Tue Feb 23 17:31:04 2010
@@ -571,8 +571,9 @@
 
         // DeltaV properties
         properties.add(supportedReports);
-        // creator-displayname, comment: not value available from jcr
+        // DAV:creator-displayname default value : not available
         properties.add(new DefaultDavProperty<String>(DeltaVConstants.CREATOR_DISPLAYNAME,
null, true));
+        // DAV:comment not value available from jcr
         properties.add(new DefaultDavProperty<String>(DeltaVConstants.COMMENT, null,
true));
 
         // 'workspace' property as defined by RFC 3253

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java?rev=915449&r1=915448&r2=915449&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java
Tue Feb 23 17:31:04 2010
@@ -61,6 +61,7 @@
 import org.apache.jackrabbit.webdav.DavResourceLocator;
 import org.apache.jackrabbit.webdav.DavServletResponse;
 import org.apache.jackrabbit.webdav.MultiStatusResponse;
+import org.apache.jackrabbit.webdav.version.DeltaVConstants;
 import org.apache.jackrabbit.webdav.util.HttpDateFormat;
 import org.apache.jackrabbit.webdav.io.InputContext;
 import org.apache.jackrabbit.webdav.io.OutputContext;
@@ -886,15 +887,20 @@
             // resource is serialized as system-view (xml)
             properties.add(new DefaultDavProperty<String>(DavPropertyName.GETCONTENTTYPE,
"text/xml"));
             Node n = (Node)item;
-            // overwrite the default creation date if possible
+            // overwrite the default creation date and creator-displayname if possible
             try {
                 if (n.hasProperty(JcrConstants.JCR_CREATED)) {
                     long creationTime = n.getProperty(JcrConstants.JCR_CREATED).getValue().getLong();
                     properties.add(new DefaultDavProperty<String>(DavPropertyName.CREATIONDATE,
                         HttpDateFormat.creationDateFormat().format(new Date(creationTime))));
                 }
+                // DAV:creator-displayname -> use jcr:createBy if present.
+                if (n.hasProperty(Property.JCR_CREATED_BY)) {
+                    String createdBy = n.getProperty(Property.JCR_CREATED_BY).getString();
+                    properties.add(new DefaultDavProperty<String>(DeltaVConstants.CREATOR_DISPLAYNAME,
createdBy, true));
+                }
             } catch (RepositoryException e) {
-                log.warn("Error while accessing jcr:created property");
+                log.warn("Error while accessing jcr:created or jcr:createdBy property");
             }
 
             // add node-specific resource properties

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DeltaVResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DeltaVResourceImpl.java?rev=915449&r1=915448&r2=915449&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DeltaVResourceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DeltaVResourceImpl.java
Tue Feb 23 17:31:04 2010
@@ -21,6 +21,9 @@
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.Property;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.ValueFormatException;
 
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.webdav.DavCompliance;
@@ -34,6 +37,7 @@
 import org.apache.jackrabbit.webdav.property.DavProperty;
 import org.apache.jackrabbit.webdav.property.DavPropertyName;
 import org.apache.jackrabbit.webdav.property.HrefProperty;
+import org.apache.jackrabbit.webdav.property.DefaultDavProperty;
 import org.apache.jackrabbit.webdav.version.DeltaVConstants;
 import org.apache.jackrabbit.webdav.version.DeltaVResource;
 import org.apache.jackrabbit.webdav.version.OptionsInfo;
@@ -247,6 +251,17 @@
             super.initProperties();
             if (exists()) {
                 properties.add(supportedReports);
+
+                // DAV:creator-displayname -> use jcr:createBy if present.
+                Node n = getNode();
+                try {
+                    if (n.hasProperty(Property.JCR_CREATED_BY)) {
+                        String createdBy = n.getProperty(Property.JCR_CREATED_BY).getString();
+                        properties.add(new DefaultDavProperty<String>(DeltaVConstants.CREATOR_DISPLAYNAME,
createdBy, true));
+                    }
+                } catch (RepositoryException e) {
+                    log.debug("Error while accessing jcr:createdBy property");
+                }
             }
         }
     }



Mime
View raw message