OSDN Git Service

Added function to find the children of a tag. Not currently used, but will be in...
authorRandy Baumgarte <randy@fbn.cx>
Sun, 3 Apr 2011 15:29:33 +0000 (11:29 -0400)
committerRandy Baumgarte <randy@fbn.cx>
Sun, 3 Apr 2011 18:03:37 +0000 (14:03 -0400)
src/cx/fbn/nevernote/sql/TagTable.java

index 8eed134..6fb443e 100644 (file)
@@ -489,4 +489,20 @@ public class TagTable {
                \r
                query.exec("Update tag set parentguid=null where parentguid not in (select distinct guid from tag);");  \r
        }\r
                \r
                query.exec("Update tag set parentguid=null where parentguid not in (select distinct guid from tag);");  \r
        }\r
+\r
+       \r
+       public List<String> findChildren(String guid, List<Tag> tagList) {\r
+               List<String> returnValue = new ArrayList<String>();\r
+               \r
+               for (int i=0; i<tagList.size(); i++) {\r
+                       if (tagList.get(i).getParentGuid().equalsIgnoreCase(guid)) {\r
+                               returnValue.add(tagList.get(i).getName());\r
+                               List<String> childMatch = findChildren(tagList.get(i).getGuid(), tagList);\r
+                               for (int j=0; j<childMatch.size(); j++) {\r
+                                       returnValue.add(childMatch.get(j));\r
+                               }\r
+                       }\r
+               }\r
+               return returnValue;\r
+       }\r
 }\r
 }\r