bookmarks interface

-bugfix for tags
-defaulttag, if no tag is given

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1251 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 19 years ago
parent d0d1855520
commit 87ea300d71

@ -68,8 +68,12 @@ public class Bookmarks_p {
if(post.containsKey("add")){ //add an Entry
String url=(String) post.get("url");
String title=(String) post.get("title");
String tagsString = (String)post.get("tags");
if(tagsString.equals("")){
tagsString="unsorted"; //defaulttag
}
Vector tags=new Vector();
String[] tagsArray=((String)post.get("tags")).split(",");
String[] tagsArray=tagsString.split(",");
for(int i=0;i<tagsArray.length; i++){
tags.add(tagsArray[i].trim());
}

@ -58,13 +58,8 @@ import de.anomic.plasma.plasmaURL;
public class bookmarksDB {
kelondroMap tagsTable;
kelondroMap bookmarksTable;
private final File bookmarksFile;
private final File tagsFile;
private final int bufferkb;
public bookmarksDB(File bookmarksFile, File tagsFile, int bufferkb){
this.bookmarksFile=bookmarksFile;
this.tagsFile=tagsFile;
this.bufferkb=bufferkb;
if(bookmarksFile.exists() && tagsFile.exists()){
try {
this.bookmarksTable=new kelondroMap(new kelondroDyn(bookmarksFile, 1024*bufferkb));
@ -122,8 +117,11 @@ public class bookmarksDB {
}
private Vector string2vector(String string){
Vector ret=new Vector();
String[] hashes=string.split(",");
if(string.indexOf(",") > -1){
ret.copyInto(string.split(","));
for(int i=0;i<hashes.length;i++){
ret.add(hashes[i]);
}
}else{
ret = new Vector();
ret.add(string);
@ -215,18 +213,24 @@ public class bookmarksDB {
return tagName;
}
public Vector getUrlHashes(){
System.out.println(this.mem.get(URL_HASHES));
return string2vector((String)this.mem.get(URL_HASHES));
}
public void add(String urlHash){
String urlHashes = (String)this.mem.get(URL_HASHES);
Vector list;
String urlHashes = (String)mem.get(URL_HASHES);
/*Vector list;
if(urlHashes != null){
list=string2vector(urlHashes);
}else{
list=new Vector();
}
list.add(urlHash);
this.mem.put(URL_HASHES, vector2string(list));
this.mem.put(URL_HASHES, vector2string(list));*/
if(urlHashes!=null && !urlHashes.equals("")){
this.mem.put(URL_HASHES, urlHashes+","+urlHash);
}else{
this.mem.put(URL_HASHES, urlHash);
}
}
public void delete(String urlHash){
Vector list=string2vector((String) this.mem.get(URL_HASHES));
@ -311,7 +315,7 @@ public class bookmarksDB {
Iterator it=tags.iterator();
while(it.hasNext()){
String tagName=(String) it.next();
Tag tag=getTag((String) tagName);
Tag tag=getTag(tagName);
if(tag == null){
tag=new Tag(tagName);
}

Loading…
Cancel
Save