Skip to content

Commit

Permalink
*) SOAP: bookmarks list now indicates if a bookmark is private (reque…
Browse files Browse the repository at this point in the history
…sted by KoH)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3775 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
(no author) committed May 31, 2007
1 parent 957a25a commit 92351c4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions htroot/xml/bookmarks/posts/all.java
Expand Up @@ -62,12 +62,17 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
boolean isAdmin=switchboard.verifyAuthentication(header, true);
serverObjects prop = new serverObjects();

Iterator it;
if(post != null && post.containsKey("tag")){
it=switchboard.bookmarksDB.getBookmarksIterator((String) post.get("tag"), isAdmin);
}else{
it=switchboard.bookmarksDB.getBookmarksIterator(isAdmin);
}

// if an extended xml should be used
boolean extendedXML = (post != null && post.containsKey("extendedXML"));

int count=0;
bookmarksDB.Bookmark bookmark;
Date date;
Expand All @@ -80,6 +85,12 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
date=new Date(bookmark.getTimeStamp());
prop.putSafeXML("posts_"+count+"_time", serverDate.dateToiso8601(date));
prop.putSafeXML("posts_"+count+"_tags", bookmark.getTagsString().replaceAll(","," "));

// additional XML tags
prop.put("posts_"+count+"_isExtended",extendedXML ? 1:0);
if (extendedXML) {
prop.putSafeXML("posts_"+count+"_isExtended_private", Boolean.toString(!bookmark.getPublic()));
}
count++;
}
prop.put("posts", count);
Expand Down
2 changes: 1 addition & 1 deletion htroot/xml/bookmarks/posts/all.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' standalone='yes'?>
<posts>
#{posts}#<post href="#[url]#" description="#[title]#" extended="#[description]#" hash="#[md5]#" tag="#[tags]#" time="#[time]#"/>
#{posts}#<post href="#[url]#" description="#[title]#" extended="#[description]#" hash="#[md5]#" tag="#[tags]#" time="#[time]#" #(isExtended)#::private="#[private]#"#(/isExtended)#/>
#{/posts}#
</posts>
10 changes: 10 additions & 0 deletions htroot/xml/bookmarks/posts/get.java
Expand Up @@ -50,6 +50,10 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
}else{
date=serverDate.dateToiso8601(new Date(System.currentTimeMillis()));
}

// if an extended xml should be used
boolean extendedXML = (post != null && post.containsKey("extendedXML"));

int count=0;

Date parsedDate = null;
Expand All @@ -73,6 +77,12 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
prop.putSafeXML("posts_"+count+"_md5", serverCodings.encodeMD5Hex(bookmark.getUrl()));
prop.putSafeXML("posts_"+count+"_time", date);
prop.putSafeXML("posts_"+count+"_tags", bookmark.getTagsString().replaceAll(","," "));

// additional XML tags
prop.put("posts_"+count+"_isExtended",extendedXML ? 1:0);
if (extendedXML) {
prop.putSafeXML("posts_"+count+"_isExtended_private", Boolean.toString(!bookmark.getPublic()));
}
count++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion htroot/xml/bookmarks/posts/get.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' standalone='yes'?>
<posts>
#{posts}#<post href="#[url]#" description="#[title]#" extended="#[description]#" hash="#[md5]#" tag="#[tags]#" time="#[time]#"/>
#{posts}#<post href="#[url]#" description="#[title]#" extended="#[description]#" hash="#[md5]#" tag="#[tags]#" time="#[time]#" #(isExtended)#::private="#[private]#"#(/isExtended)#/>
#{/posts}#
</posts>
1 change: 1 addition & 0 deletions source/de/anomic/soap/services/BookmarkService.java
Expand Up @@ -415,6 +415,7 @@ public Document getBookmarkList(String tag, String date) throws Exception {

// generating the template containing the network status information
serverObjects args = new serverObjects();
args.put("extendedXML", "");
if (tag != null) args.put("tag",tag);
if (date != null) args.put("date",date);

Expand Down

0 comments on commit 92351c4

Please sign in to comment.