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 2007/02/03 23:33:52 UTC
svn commit: r503327 - in
/incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol:
AtomServlet.java RollerAtomHandler.java
Author: snoopdave
Date: Sat Feb 3 14:33:52 2007
New Revision: 503327
URL: http://svn.apache.org/viewvc?view=rev&rev=503327
Log:
Now passes APE testing without errors, but I need to figure out why index removal fails.
Modified:
incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java
Modified: incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java?view=diff&rev=503327&r1=503326&r2=503327
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/AtomServlet.java Sat Feb 3 14:33:52 2007
@@ -166,11 +166,11 @@
// call handler to post it
Entry savedEntry = handler.postEntry(pathInfo, unsavedEntry);
- // return alternate link as Location header
- Iterator links = savedEntry.getAlternateLinks().iterator();
+ // return member entry URI as location header
+ Iterator links = savedEntry.getOtherLinks().iterator();
while (links.hasNext()) {
Link link = (Link) links.next();
- if (link.getRel().equals("alternate") || link.getRel() == null) {
+ if (link.getRel().equals("edit") || link.getRel() == null) {
res.addHeader("Location", link.getHref());
break;
}
@@ -195,7 +195,7 @@
com.sun.syndication.feed.atom.Content content =
(com.sun.syndication.feed.atom.Content)resource.getContents().get(0);
- // return alternate link as Location header
+ // return member entry URI as location header
Iterator links = resource.getOtherLinks().iterator();
while (links.hasNext()) {
Link link = (Link) links.next();
Modified: incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java?view=diff&rev=503327&r1=503326&r2=503327
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/webservices/atomprotocol/RollerAtomHandler.java Sat Feb 3 14:33:52 2007
@@ -67,6 +67,7 @@
import org.apache.roller.config.RollerConfig;
import org.apache.roller.config.RollerRuntimeConfig;
import org.apache.roller.business.WeblogManager;
+import org.apache.roller.business.search.IndexManager;
import org.apache.roller.pojos.RollerPropertyData;
import org.apache.roller.pojos.WeblogEntryTagData;
import org.apache.roller.pojos.WeblogResource;
@@ -517,9 +518,7 @@
try { Thread.sleep(1000); } catch (Exception ignored) {}
CacheManager.invalidate(website);
- if (rollerEntry.isPublished()) {
- mRoller.getIndexManager().addEntryReIndexOperation(rollerEntry);
- }
+ reindexEntry(rollerEntry);
return createAtomEntry(rollerEntry);
}
throw new AtomNotAuthorizedException(
@@ -588,9 +587,7 @@
mRoller.flush();
CacheManager.invalidate(rollerEntry.getWebsite());
- if (rollerEntry.isPublished()) {
- mRoller.getIndexManager().addEntryReIndexOperation(rollerEntry);
- }
+ reindexEntry(rollerEntry);
return createAtomEntry(rollerEntry);
}
throw new AtomNotAuthorizedException("ERROR not authorized to update entry");
@@ -618,8 +615,8 @@
WeblogManager mgr = mRoller.getWeblogManager();
mgr.removeWeblogEntry(rollerEntry);
mRoller.flush();
- CacheManager.invalidate(rollerEntry.getWebsite());
- mRoller.getIndexManager().removeEntryIndexOperation(rollerEntry);
+ CacheManager.invalidate(rollerEntry.getWebsite());
+ reindexEntry(rollerEntry);
return;
}
} else if (pathInfo[1].equals("resource")) {
@@ -972,16 +969,22 @@
*/
private Entry createAtomEntry(WeblogEntryData entry) {
Entry atomEntry = new Entry();
+
Content content = new Content();
content.setType(Content.HTML);
content.setValue(entry.getText());
List contents = new ArrayList();
contents.add(content);
+ Content summary = new Content();
+ summary.setType(Content.HTML);
+ summary.setValue(entry.getSummary());
+
String absUrl = RollerRuntimeConfig.getAbsoluteContextURL();
atomEntry.setId( absUrl + entry.getPermaLink());
atomEntry.setTitle( entry.getTitle());
atomEntry.setContents( contents);
+ atomEntry.setSummary( summary);
atomEntry.setPublished( entry.getPubTime());
atomEntry.setUpdated( entry.getUpdateTime());
@@ -1100,6 +1103,9 @@
Content content = (Content)entry.getContents().get(0);
rollerEntry.setText(content.getValue());
}
+ if (entry.getSummary() != null) {
+ rollerEntry.setSummary(entry.getSummary().getValue());
+ }
rollerEntry.setPubTime(pubTime);
rollerEntry.setUpdateTime(updateTime);
@@ -1173,6 +1179,18 @@
}
}
return path;
+ }
+
+ private void reindexEntry(WeblogEntryData entry) throws RollerException {
+ IndexManager manager = mRoller.getIndexManager();
+
+ // TODO: figure out what's up here and at WeblogEntryFormAction line 696
+ //manager.removeEntryIndexOperation(entry);
+
+ // if published, index the entry
+ if (entry.isPublished()) {
+ manager.addEntryReIndexOperation(entry);
+ }
}
}