OSDN Git Service

Correct problem moving conflicting notes on linked notebooks.
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / sql / NoteTable.java
index bd2ab8e..598a648 100644 (file)
@@ -760,6 +760,34 @@ public class NoteTable {
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
                return notes;   \r
        }\r
        // Get a list of notes that need to be updated\r
+       public List <Note> getDirtyLinkedNotes() {\r
+               String guid;\r
+               Note tempNote;\r
+               List<Note> notes = new ArrayList<Note>();\r
+               List<String> index = new ArrayList<String>();\r
+               \r
+               boolean check;                  \r
+        NSqlQuery query = new NSqlQuery(db.getConnection());\r
+                                       \r
+               check = query.exec("Select guid from Note where isDirty = true and isExpunged = false and notebookGuid in (select guid from notebook where linked = true)");\r
+               if (!check) \r
+                       logger.log(logger.EXTREME, "Note SQL retrieve has failed: " +query.lastError().toString());\r
+               \r
+               // Get a list of the notes\r
+               while (query.next()) {\r
+                       guid = new String();\r
+                       guid = query.valueString(0);\r
+                       index.add(guid); \r
+               }       \r
+               \r
+               // Start getting notes\r
+               for (int i=0; i<index.size(); i++) {\r
+                       tempNote = getNote(index.get(i), true,true,false,true,true);\r
+                       notes.add(tempNote);\r
+               }\r
+               return notes;   \r
+       }\r
+       // Get a list of notes that need to be updated\r
        public List <Note> getDirtyLinked(String notebookGuid) {\r
                String guid;\r
                Note tempNote;\r
        public List <Note> getDirtyLinked(String notebookGuid) {\r
                String guid;\r
                Note tempNote;\r