Changeset 7748 in josm for trunk/src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java
- Timestamp:
- 2014-11-25T23:51:45+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java
r7699 r7748 45 45 Map<Note, Exception> failedNotes = new HashMap<>(); 46 46 47 /** 48 * Constructs a new {@code UploadTask}. 49 * @param title message for the user 50 * @param monitor progress monitor 51 */ 47 52 public UploadTask(String title, ProgressMonitor monitor) { 48 53 super(title, monitor, false); … … 71 76 Main.debug("found note change to upload"); 72 77 } 73 try { 74 Note newNote; 75 switch (comment.getNoteAction()) { 76 case opened: 77 if (Main.isDebugEnabled()) { 78 Main.debug("opening new note"); 79 } 80 newNote = api.createNote(note.getLatLon(), comment.getText(), monitor); 81 note.setId(newNote.getId()); 82 break; 83 case closed: 84 if (Main.isDebugEnabled()) { 85 Main.debug("closing note " + note.getId()); 86 } 87 newNote = api.closeNote(note, comment.getText(), monitor); 88 break; 89 case commented: 90 if (Main.isDebugEnabled()) { 91 Main.debug("adding comment to note " + note.getId()); 92 } 93 newNote = api.addCommentToNote(note, comment.getText(), monitor); 94 break; 95 case reopened: 96 if (Main.isDebugEnabled()) { 97 Main.debug("reopening note " + note.getId()); 98 } 99 newNote = api.reopenNote(note, comment.getText(), monitor); 100 break; 101 default: 102 newNote = null; 103 } 104 updatedNotes.put(note, newNote); 105 } catch (Exception e) { 106 Main.error("Failed to upload note to server: " + note.getId()); 107 failedNotes.put(note, e); 108 } 78 processNoteComment(monitor, api, note, comment); 109 79 } 110 80 } 81 } 82 } 83 84 private void processNoteComment(ProgressMonitor monitor, OsmApi api, Note note, NoteComment comment) { 85 try { 86 Note newNote; 87 switch (comment.getNoteAction()) { 88 case opened: 89 if (Main.isDebugEnabled()) { 90 Main.debug("opening new note"); 91 } 92 newNote = api.createNote(note.getLatLon(), comment.getText(), monitor); 93 note.setId(newNote.getId()); 94 break; 95 case closed: 96 if (Main.isDebugEnabled()) { 97 Main.debug("closing note " + note.getId()); 98 } 99 newNote = api.closeNote(note, comment.getText(), monitor); 100 break; 101 case commented: 102 if (Main.isDebugEnabled()) { 103 Main.debug("adding comment to note " + note.getId()); 104 } 105 newNote = api.addCommentToNote(note, comment.getText(), monitor); 106 break; 107 case reopened: 108 if (Main.isDebugEnabled()) { 109 Main.debug("reopening note " + note.getId()); 110 } 111 newNote = api.reopenNote(note, comment.getText(), monitor); 112 break; 113 default: 114 newNote = null; 115 } 116 updatedNotes.put(note, newNote); 117 } catch (Exception e) { 118 Main.error("Failed to upload note to server: " + note.getId()); 119 failedNotes.put(note, e); 111 120 } 112 121 }
Note:
See TracChangeset
for help on using the changeset viewer.