You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/09/25 18:37:15 UTC

svn commit: r291439 - in /incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation: atomapi/RollerAtomHandler.java atomapi04/AtomServlet.java atomapi04/RollerAtomHandler.java

Author: snoopdave
Date: Sun Sep 25 09:37:11 2005
New Revision: 291439

URL: http://svn.apache.org/viewcvs?rev=291439&view=rev
Log:
Updated Atom Protocol code for new ROME

Modified:
    incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java
    incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/AtomServlet.java
    incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/RollerAtomHandler.java

Modified: incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java?rev=291439&r1=291438&r2=291439&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java (original)
+++ incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi/RollerAtomHandler.java Sun Sep 25 09:37:11 2005
@@ -396,7 +396,12 @@
                 rollerEntry.setTitle(entry.getTitle());
                 
                 // TODO: don't assume type is HTML or TEXT
-                rollerEntry.setText(entry.getContent().getValue());
+                List contents = entry.getContents();
+                if (contents != null && contents.size() > 0) {
+                    Content romeContent = (Content)contents.get(0);
+                    rollerEntry.setText(romeContent.getValue());
+                }
+
                 
                 rollerEntry.setUpdateTime(new Timestamp(new Date().getTime()));
                 if (entry.getPublished() != null) {
@@ -767,10 +772,12 @@
         Content content = new Content();
         content.setType(Content.HTML);
         content.setValue(entry.getText());
+        List contents = new ArrayList();
+        contents.add(content);
         
         atomEntry.setId(        entry.getId());
         atomEntry.setTitle(     entry.getTitle());
-        atomEntry.setContent(   content);
+        atomEntry.setContents(  contents);
         atomEntry.setPublished( entry.getPubTime());
         atomEntry.setUpdated(   entry.getUpdateTime());
         
@@ -785,7 +792,7 @@
         altlink.setRel("alternate");
         altlink.setHref(entry.getPermaLink());
         links.add(altlink);
-        atomEntry.setLinks(links);
+        atomEntry.setAlternateLinks(links);
         
         return atomEntry;
     }
@@ -807,7 +814,10 @@
         }
         WeblogEntryData rollerEntry = new WeblogEntryData();
         rollerEntry.setTitle(entry.getTitle());
-        rollerEntry.setText(entry.getContent().getValue());
+        if (entry.getContents() != null && entry.getContents().size() > 0) {
+            Content content = (Content)entry.getContents().get(0);
+            rollerEntry.setText(content.getValue());
+        }
         rollerEntry.setPubTime(pubTime);
         rollerEntry.setUpdateTime(updateTime);
         rollerEntry.setWebsite(website);

Modified: incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/AtomServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/AtomServlet.java?rev=291439&r1=291438&r2=291439&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/AtomServlet.java (original)
+++ incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/AtomServlet.java Sun Sep 25 09:37:11 2005
@@ -189,7 +189,7 @@
                     
                     // call handler to post it
                     Entry savedEntry = handler.postEntry(pathInfo, unsavedEntry);
-                    Iterator links = savedEntry.getLinks().iterator();
+                    Iterator links = savedEntry.getAlternateLinks().iterator();
                     
                     // return alternate link as Location header
                     while (links.hasNext()) {

Modified: incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/RollerAtomHandler.java
URL: http://svn.apache.org/viewcvs/incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/RollerAtomHandler.java?rev=291439&r1=291438&r2=291439&view=diff
==============================================================================
--- incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/RollerAtomHandler.java (original)
+++ incubator/roller/branches/roller_2.0/sandbox/atomprotocol/src/org/roller/presentation/atomapi04/RollerAtomHandler.java Sun Sep 25 09:37:11 2005
@@ -397,7 +397,11 @@
                 rollerEntry.setTitle(entry.getTitle());
                 
                 // TODO: don't assume type is HTML or TEXT
-                rollerEntry.setText(entry.getContent().getValue());
+                List contents = entry.getContents();
+                if (contents != null && contents.size() > 0) {
+                    Content romeContent = (Content)contents.get(0);
+                    rollerEntry.setText(romeContent.getValue());
+                }
                 
                 rollerEntry.setUpdateTime(new Timestamp(new Date().getTime()));
                 if (entry.getPublished() != null) {
@@ -796,10 +800,12 @@
         Content content = new Content();
         content.setType(Content.HTML);
         content.setValue(entry.getText());
+        List contents = new ArrayList();
+        contents.add(content);
         
         atomEntry.setId(        entry.getId());
         atomEntry.setTitle(     entry.getTitle());
-        atomEntry.setContent(   content);
+        atomEntry.setContents(  contents);
         atomEntry.setPublished( entry.getPubTime());
         atomEntry.setUpdated(   entry.getUpdateTime());
         
@@ -814,7 +820,7 @@
         altlink.setRel("alternate");
         altlink.setHref(entry.getPermaLink());
         links.add(altlink);
-        atomEntry.setLinks(links);
+        atomEntry.setAlternateLinks(links);
         
         return atomEntry;
     }
@@ -836,7 +842,10 @@
         }
         WeblogEntryData rollerEntry = new WeblogEntryData();
         if (entry.getTitle() != null) rollerEntry.setTitle(entry.getTitle());
-        if (entry.getContent() != null) rollerEntry.setText(entry.getContent().getValue());
+        if (entry.getContents() != null && entry.getContents().size() > 0) {
+            Content content = (Content)entry.getContents().get(0);
+            rollerEntry.setText(content.getValue());
+        }
         rollerEntry.setPubTime(pubTime);
         rollerEntry.setUpdateTime(updateTime);
         rollerEntry.setWebsite(website);