cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1441146 - in /cxf/web/src/main/java/org/apache/cxf/cwiki: AbstractPage.java SiteExporter.java
Date Thu, 31 Jan 2013 19:17:42 GMT
Author: dkulp
Date: Thu Jan 31 19:17:40 2013
New Revision: 1441146

URL: http://svn.apache.org/viewvc?rev=1441146&view=rev
Log:
Get the blog attachments as well

Modified:
    cxf/web/src/main/java/org/apache/cxf/cwiki/AbstractPage.java
    cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/AbstractPage.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/AbstractPage.java?rev=1441146&r1=1441145&r2=1441146&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/AbstractPage.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/AbstractPage.java Thu Jan 31 19:17:40 2013
@@ -20,6 +20,9 @@
 package org.apache.cxf.cwiki;
 
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.w3c.dom.Element;
 
 import org.apache.cxf.helpers.DOMUtils;
@@ -34,6 +37,8 @@ public class AbstractPage implements Ser
     final String id;
     final String title;
     final String url;
+
+    Map<String, String> attachments;
     
     transient String directory;
     
@@ -97,4 +102,18 @@ public class AbstractPage implements Ser
     public String toString() {
         return "AbstractPage[id=" + id + ",title=" + title + ",url=" + url + "]";
     }
+    
+    public void addAttachment(String aid, String filename) {
+        if (attachments == null) {
+            attachments = new HashMap<String, String>();
+        }
+        attachments.put(aid, filename);
+    }
+    public String getAttachmentFilename(String aid) {
+        if (attachments == null) {
+            return null;
+        }
+        return attachments.get(aid);
+    }
+    
 }

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java?rev=1441146&r1=1441145&r2=1441146&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java Thu Jan 31 19:17:40 2013
@@ -398,6 +398,7 @@ public class SiteExporter implements Run
             System.out.println("(" + spaceKey + ") Rendering Blog Entry " + entry.getTitle()

                                + "    (" + count + "/" + total + ")");
             
+            loadAttachments(entry);
             String body = renderPage(entry);
             body = updateContentLinks(entry, body, null, mainDivClass);
             
@@ -448,7 +449,7 @@ public class SiteExporter implements Run
         }
     }
     
-    private void loadAttachments(Page p) throws Exception {
+    private void loadAttachments(AbstractPage p) throws Exception {
         Document doc = XMLUtils.newDocument();
         Element el = doc.createElementNS(SOAPNS, "ns1:getAttachments");
         Element el2 = doc.createElement("in0");
@@ -470,7 +471,7 @@ public class SiteExporter implements Run
                 
                 p.addAttachment(aid, filename);
                 
-                String dirName = p.createFileName();
+                String dirName = p.getPath();
                 dirName = dirName.substring(0, dirName.lastIndexOf(".")) + ".data";
                 File file = new File(outputDir, dirName);
                 if (!file.exists()) {



Mime
View raw message