- Timestamp:
- 07/26/2019 05:12:05 AM (7 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
-
python/unifiedlogger/wing_project.wpr (modified) (6 diffs)
-
tmcsim/application.properties (modified) (1 diff)
-
tmcsim/cadsimulator/Coordinator.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/python/unifiedlogger/wing_project.wpr
r462 r465 183 183 'toolbox-percent': 1.0, 184 184 'toolbox-tree-sel': ''})], 185 'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('logging_service.py'), 186 {'attrib-starts': [('getSimTime|0|', 187 7)], 188 'code-line': ' print "Error loading json for elapsed time"\n', 189 'first-line': 0L, 185 'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('activitylog_watcher.py'), 186 {'attrib-starts': [], 187 'code-line': '# Local main for unit testing\n', 188 'first-line': 48L, 190 189 'folded-linenos': [], 191 'sel-line': 14L,192 'sel-line-start': 410L,193 'selection_end': 460L,194 'selection_start': 460L,190 'sel-line': 50L, 191 'sel-line-start': 1431L, 192 'selection_end': 1460L, 193 'selection_start': 1460L, 195 194 'zoom': 0L}, 196 1563914714.187541], 197 [loc('cad_watcher.py'), 198 {'attrib-starts': [('isFull|0|', 199 16)], 200 'code-line': '\n', 201 'first-line': 18L, 202 'folded-linenos': [], 203 'sel-line': 18L, 204 'sel-line-start': 559L, 205 'selection_end': 559L, 206 'selection_start': 559L, 207 'zoom': 0L}, 208 1563914983.485065], 209 [loc('activitylog_watcher.py'), 210 {'attrib-starts': [], 211 'code-line': '# Local main for unit testing\n', 212 'first-line': 48L, 213 'folded-linenos': [], 214 'sel-line': 50L, 215 'sel-line-start': 1431L, 216 'selection_end': 1460L, 217 'selection_start': 1460L, 218 'zoom': 0L}, 219 1563915276.741928], 195 1563915276.741928], 220 196 [loc('../../../../../../../../usr/lib/python2.7/ConfigParser.py'), 221 197 {'attrib-starts': [('ConfigParser|0|', … … 422 398 'selection_start': 565L, 423 399 'zoom': 0L}, 424 1563916220.372856]], 400 1563916220.372856], 401 [loc('activitylog_watcher.py'), 402 {'attrib-starts': [('getLogEntries|0|', 403 42)], 404 'code-line': ' resultList = []\n', 405 'first-line': 40L, 406 'folded-linenos': [], 407 'sel-line': 48L, 408 'sel-line-start': 1422L, 409 'selection_end': 1422L, 410 'selection_start': 1422L, 411 'zoom': 0L}, 412 1564099965.745285], 413 [loc('cad_watcher.py'), 414 {'attrib-starts': [('isFull|0|', 415 16)], 416 'code-line': '\n', 417 'first-line': 3L, 418 'folded-linenos': [], 419 'sel-line': 18L, 420 'sel-line-start': 559L, 421 'selection_end': 559L, 422 'selection_start': 559L, 423 'zoom': 0L}, 424 1564102192.752733]], 425 425 20), 426 'current-loc': loc(' activitylog_watcher.py'),426 'current-loc': loc('__main__.py'), 427 427 'editor-state-list': [(loc('activitylog_watcher.py'), 428 428 {'attrib-starts': [('getLogEntries|0|', … … 440 440 16)], 441 441 'code-line': '\n', 442 'first-line': 18L,442 'first-line': 3L, 443 443 'folded-linenos': [], 444 444 'sel-line': 18L, … … 500 500 loc('__main__.py')]), 501 501 'open_files': [u'../../../config/logging_service.cfg', 502 u'__main__.py',503 u'cad_watcher.py',504 502 u'cms_watcher.py', 505 503 u'logging_service.py', 506 u'activitylog_watcher.py']}, 504 u'activitylog_watcher.py', 505 u'cad_watcher.py', 506 u'__main__.py']}, 507 507 'saved_notebook_display': None, 508 508 'split_percents': {0: 0.5}, … … 519 519 'traversal_pos': ((0, 520 520 4), 521 156 3917662.000223),521 1564102198.163837), 522 522 'user_data': {}}, 523 523 'window-alloc': (29, … … 525 525 1197, 526 526 722)}]} 527 guimgr.recent-documents = [loc('activitylog_watcher.py'), 527 guimgr.recent-documents = [loc('__main__.py'), 528 loc('cad_watcher.py'), 529 loc('activitylog_watcher.py'), 528 530 loc('logging_service.py'), 529 531 loc('cms_watcher.py'), 530 loc('__main__.py'),531 loc('cad_watcher.py'),532 532 loc('../../../config/logging_service.cfg')] 533 533 guimgr.visual-state = {loc('get_app_properties.py'): {'attrib-starts': [], -
trunk/src/tmcsim/application.properties
r463 r465 1 # Tue, 23 Jul 2019 14:36:26-07001 #Fri, 26 Jul 2019 06:34:33 -0700 2 2 3 Application.revision=46 23 Application.revision=464 4 4 5 5 Application.buildnumber=170 -
trunk/src/tmcsim/cadsimulator/Coordinator.java
r448 r465 8 8 import java.text.DateFormat; 9 9 import java.text.SimpleDateFormat; 10 import java.util.ArrayList; 11 import java.util.Collections; 10 12 import java.util.Date; 11 13 import java.util.LinkedList; 14 import java.util.List; 12 15 import java.util.Observer; 13 16 import java.util.TreeMap; … … 744 747 Logger.getLogger(Coordinator.class.getName()).log(Level.SEVERE, null, ex); 745 748 } 746 // Initialize an output buffer 747 StringBuffer output = new StringBuffer(); 749 // Write output list to a file 750 try 751 { 752 PrintWriter writer = new PrintWriter(new FileWriter(kCADcommentLog)); 753 // process the list of comments obtained from helper method 754 for (String item: getSortedComments(incList)) 755 { 756 writer.print(item.substring(9)); 757 } 758 writer.close(); 759 } catch (Exception exc) 760 { 761 exc.printStackTrace(); 762 } 763 } 764 765 /** Extract a list of comments from the current incidents, ordered 766 * by timestamp. Fixes defect #175. 767 * Package private to allow unit testing. 768 * 769 * @param incidentList the incidents from which comments are desired 770 * @return list of comments, ready to be output. 771 */ 772 List<String> getSortedComments(Vector<Incident> incidentList) 773 { 774 // Initialize a list of for outputing CAD comments 775 ArrayList<String> commentList = new ArrayList<String>(); 748 776 // Process all the incidents 749 for (Incident incident: inc List)777 for (Incident incident: incidentList) 750 778 { 751 779 // Retrieve the table of comments/notes the users created … … 755 783 { 756 784 // Combine the fields into one output entry 785 String timestamp = (String)notesTable.getValueAt(row,1); 757 786 String initials = (String) notesTable.getValueAt(row,2); // user initials 758 787 // If there are user intials, include this item. 759 788 // Zero length initials mean it's a scripted item, ignore it. 789 StringBuffer output = new StringBuffer(); 760 790 if (initials.length() > 0) 761 {//CAD Log Entry, Incident #187, Sharon: REQUEST EXTRA ANCHOVIES 762 output.append("CAD log, "); 791 {//17:03:19 CAD Log Entry, Incident #187, Sharon: REQUEST EXTRA ANCHOVIES 792 output.append(timestamp); 793 output.append(" CAD log, "); 763 794 output.append("Incident #" + incident.logNum + ", "); 764 795 output.append(initials + ": "); 765 796 output.append(notesTable.getValueAt(row,4) + "\n"); // notes 797 commentList.add(output.toString()); // Add this comment to the list 766 798 } 767 799 } 768 800 } 769 // Write output buffer to a file 770 try 771 { 772 PrintWriter writer = new PrintWriter(new FileWriter(kCADcommentLog)); 773 writer.print(output); 774 writer.close(); 775 } catch (Exception exc) 776 { 777 exc.printStackTrace(); 778 } 779 } 780 801 // Order the comments by timestamp instead of incident number. 802 Collections.sort(commentList, new java.util.Comparator<String>() 803 { 804 // provide a comparator that can compare number strings 805 public int compare(String o1, String o2) 806 { 807 return extractInt(o1) - extractInt(o2); 808 } 809 // extract an integer from a String 810 int extractInt(String s) 811 { // remove all non-digits 812 String num = s.replaceAll("\\D", ""); 813 // return 0 if no digits found, else return the number 814 return num.isEmpty() ? 0 : Integer.parseInt(num); 815 } 816 }); 817 return commentList; 818 } 781 819 /** Write the currentSimTime to a file. 782 820 This will be read asynchronously by web clients, e.g.,
Note: See TracChangeset
for help on using the changeset viewer.
