- Location:
- /trunk
- Files:
-
- 1 deleted
- 13 edited
-
src/tmcsim/cadsimulator/Coordinator.java (modified) (23 diffs)
-
src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java (modified) (4 diffs)
-
src/tmcsim/cadsimulator/viewer/actions/ExitAction.java (modified) (1 diff)
-
src/tmcsim/paramicscommunicator/ParamicsFileWriter.java (modified) (2 diffs)
-
src/tmcsim/paramicscommunicator/ParamicsCommunicator.java (modified) (5 diffs)
-
src/tmcsim/paramicscommunicator/ParamicsFileReader.java (modified) (2 diffs)
-
src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java (modified) (6 diffs)
-
test/tmcsim/cadsimulator/CADSimulatorFixture.java (modified) (3 diffs)
-
test/tmcsim/cadsimulator/CADSimulatorNetworkTest.java (deleted)
-
IDE_metadata/Eclipse (modified) (1 prop)
-
IDE_metadata/Eclipse/build.xml (modified) (1 diff)
-
IDE_metadata/NetBeans/TMCSim/build.xml (modified) (1 diff)
-
config/paramics_communicator_logging.properties (modified) (1 diff)
-
config/cad_simulator_paramics_config.properties (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
/trunk/src/tmcsim/cadsimulator/Coordinator.java
r27 r2 1 1 2 package tmcsim.cadsimulator; 2 3 4 import java.awt.List; 3 5 import java.io.File; 4 6 import java.rmi.RemoteException; … … 14 16 import java.util.logging.Level; 15 17 import java.util.logging.Logger; 18 19 import javax.swing.JList; 20 import javax.swing.Timer; 16 21 import javax.swing.table.DefaultTableModel; 17 22 import javax.xml.parsers.SAXParserFactory; 23 18 24 import tmcsim.cadmodels.CADRoutedMessage; 19 25 import tmcsim.cadmodels.CMSInfo; … … 37 43 import tmcsim.client.cadclientgui.data.Incident; 38 44 import tmcsim.client.cadclientgui.data.IncidentEvent; 39 import tmcsim.client.cadclientgui.enums.CADDataEnums.CARDFILE; 40 import tmcsim.client.cadclientgui.enums.CADDataEnums.EditCommand; 41 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_ACTIVITIES; 42 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_ADD_INFO; 43 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_CALLBACK; 44 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_CALLER; 45 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_EDIT_LOG; 46 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_GEN_INFO; 47 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_INFO; 48 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_LOC; 49 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_PROBLEM; 50 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_RESP; 51 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_TABLE; 52 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_TIMES; 53 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_VAL; 54 import tmcsim.client.cadclientgui.enums.CADDataEnums.TABLE; 45 import tmcsim.client.cadclientgui.enums.CADDataEnums.*; 55 46 import tmcsim.client.cadclientgui.enums.CADScriptTags.UNIT_TAGS; 56 47 import tmcsim.client.cadclientgui.enums.IncidentEnums; 57 48 import tmcsim.client.cadclientgui.enums.UnitStatusEnums; 58 import tmcsim.c ommon.CADEnums.PARAMICS_STATUS;59 import tmcsim.common.C ADEnums.SCRIPT_STATUS;49 import tmcsim.client.cadclientgui.screens.ScreenManager; 50 import tmcsim.common.CCTVInfo; 60 51 import tmcsim.common.ObserverMessage; 61 52 import tmcsim.common.ScriptException; 62 53 import tmcsim.common.SimulationException; 63 54 import tmcsim.common.XMLIncident; 55 import tmcsim.common.CADEnums.PARAMICS_STATUS; 56 import tmcsim.common.CADEnums.SCRIPT_STATUS; 64 57 import tmcsim.interfaces.CADClientInterface; 65 58 import tmcsim.interfaces.CoordinatorInterface; … … 67 60 68 61 /** 69 * Coordinator is used to control and manage interactions between all CAD 70 * Simulator Managers. The Coordinator is also registered as an RMI Object to71 * allow remote control and access to simulation data. A62 * Coordinator is used to control and manage interactions between all CAD 63 * Simulator Managers. The Coordinator is also registered as an RMI Object 64 * to allow remote control and access to simulation data. A 72 65 * SimulationManagerInterface Object is used to provide communication to a 73 * remotely connected SimulationManager. Observers may register with the66 * remotely connected SimulationManager. Observers may register with the 74 67 * Coordinator to listen for simulation data updates. 75 68 * … … 80 73 * @see SimulationControlManager 81 74 * @author Matthew Cechini 82 * @version 75 * @version 83 76 */ 84 77 @SuppressWarnings("serial") 85 78 public class Coordinator extends UnicastRemoteObject 86 implements CoordinatorInterface 87 { 88 89 /** 90 * Error logger. 91 */ 79 implements CoordinatorInterface { 80 81 /** Error logger. */ 92 82 private Logger coorLogger = Logger.getLogger("tmcsim.cadsimulator"); 93 /** 94 * List of all Observers that have been registered with the Coordinator. Due 95 * to being a remote object, Coordinator cannot extend the Observable class. 83 84 /** 85 * List of all Observers that have been registered with the Coordinator. Due 86 * to being a remote object, Coordinator cannot extend the Observable class. 96 87 * Therefore, the list is managed manually. 97 88 */ 98 89 private Vector<Observer> observerList = null; 99 /**100 * Interface object for RMI communication with the Simulation Manager. Only101 * one Simulation Manager may be connected at a time. When there is no102 * connected Manager, this object is set to null.90 91 /** 92 * Interface object for RMI communication with the Simulation Manager. Only one Simulation Manager 93 * may be connected at a time. When there is no connected Manager, this object is set to null. 103 94 */ 104 95 private static SimulationManagerInterface managerInt = null; 96 105 97 private static LinkedList<CADClientInterface> clientList; 98 106 99 private static CADData cadData; 100 107 101 private static CardfileData cardfileData; 108 109 /** 110 * Constructor. Call UnicastRemoteObject constructor and call102 103 /** 104 * Constructor. Call UnicastRemoteObject constructor and call 111 105 * initializeSimulation. 112 106 * 113 107 * @throws RemoteException 114 108 */ 115 public Coordinator() throws RemoteException 116 { 109 public Coordinator() throws RemoteException { 117 110 super(); 118 111 clientList = new LinkedList<CADClientInterface>(); 119 112 cadData = new CADData(); 120 cardfileData = new CardfileData(); 121 try 122 { 113 cardfileData = new CardfileData(); 114 try { 123 115 CardfileReader cfr = new CardfileReader("scripts/Cardfile.xml", cardfileData); 124 } catch (Exception e) 125 { 116 } catch (Exception e) { 126 117 System.out.println("Could not load cardfile script"); 127 118 } 128 119 129 120 observerList = new Vector<Observer>(); 130 121 } 131 132 public void registerForCallback(CADClientInterface client) throws RemoteException 133 { 122 123 public void registerForCallback(CADClientInterface client) throws RemoteException{ 134 124 clientList.add(client); 135 125 CADSimulator.theViewer.connectClient(); 136 } 137 138 public void unregisterForCallback(CADClientInterface client) throws RemoteException 139 { 126 } 127 128 public void unregisterForCallback(CADClientInterface client) throws RemoteException{ 140 129 clientList.remove(client); 141 130 CADSimulator.theViewer.disconnectClient(); 142 131 } 143 144 public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException 145 { 132 133 public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException{ 146 134 managerInt = simManInt; 147 135 CADSimulator.theViewer.setSimManagerStatus(true); 148 } 149 150 public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException 151 { 136 } 137 138 public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException { 152 139 managerInt = null; 153 140 CADSimulator.theViewer.setSimManagerStatus(false); 154 } 155 156 public void startSimulation() throws RemoteException, ScriptException 157 { 158 159 coorLogger.logp(Level.INFO, "Coordinator", "startSimulation", 160 "starting..."); 161 if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 162 { 141 } 142 143 public void startSimulation() throws RemoteException, ScriptException { 144 145 if(!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 163 146 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 164 } else if (CADSimulator.theParamicsSimMgr.isConnected()) 165 { 166 Runnable startRun = new Runnable() 167 { 168 public void run() 169 { 170 try 171 { 147 else if(CADSimulator.theParamicsSimMgr.isConnected()) { 148 Runnable startRun = new Runnable() { 149 public void run() { 150 try { 172 151 setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 173 152 174 153 long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 175 long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000);176 177 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 178 "Sleeping for " + sleepTime /1000 + " seconds.");154 long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 155 156 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 157 "Sleeping for " + sleepTime/1000 + " seconds."); 179 158 Thread.sleep(sleepTime); 180 181 //currentATMSTime += sleepTime; 182 //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 183 } catch (Exception e)184 {159 160 //currentATMSTime += sleepTime; 161 //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 162 } 163 catch (Exception e) { 185 164 setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 186 187 coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 165 166 coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 188 167 "Unable to connect to ATMS server.", e); 189 } finally190 {168 } 169 finally { 191 170 CADSimulator.theSimulationCntrlMgr.startSimulation(); 192 171 CADSimulator.theParamicsSimMgr.startSimulation(); 193 CADSimulator.theSoundPlayer.setAudioEnabled(true); 194 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation:run", 195 "Simulation has started."); 172 CADSimulator.theSoundPlayer.setAudioEnabled(true); 196 173 } 197 174 } 198 175 }; 199 176 200 177 Thread startThread = new Thread(startRun); 201 178 startThread.start(); 202 } else203 {179 } 180 else { 204 181 CADSimulator.theSimulationCntrlMgr.startSimulation(); 205 182 CADSimulator.theSoundPlayer.setAudioEnabled(true); 206 183 } 207 184 } 208 209 public void pauseSimulation() throws RemoteException210 {185 186 187 public void pauseSimulation() throws RemoteException { 211 188 CADSimulator.theSimulationCntrlMgr.pauseSimulation(); 212 189 CADSimulator.theSoundPlayer.setAudioEnabled(false); 213 190 } 214 215 public void resetSimulation() throws RemoteException 216 {217 191 192 193 public void resetSimulation() throws RemoteException { 194 218 195 CADSimulator.theIncidentMgr.resetIncidents(); 219 196 cadData.resetSimulation(); 220 197 221 198 CADSimulator.theSoundPlayer.setAudioEnabled(false); 222 199 CADSimulator.theSoundPlayer.deQueueAll(); 223 200 224 201 CADSimulator.theViewer.setTime(0); 225 202 226 203 setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED); 227 204 228 205 CMSDiversionDB.getInstance().resetDiversions(); 229 206 230 207 CADSimulator.theSimulationCntrlMgr.resetSimulation(); 231 208 CADSimulator.theParamicsSimMgr.resetSimulation(); 232 233 notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null)); 234 235 } 236 237 public void gotoSimulationTime(final long newSimTime) throws RemoteException238 {239 209 210 notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null)); 211 212 } 213 214 215 public void gotoSimulationTime(final long newSimTime) throws RemoteException { 216 240 217 boolean audioWasEnabled = CADSimulator.theSoundPlayer.getAudioEnabled(); 241 218 242 219 CADSimulator.theSoundPlayer.setAudioEnabled(false); 243 244 long tempTime = 0; 245 while (tempTime < newSimTime) 246 { 220 221 long tempTime = 0; 222 while(tempTime < newSimTime) { 247 223 tempTime++; 248 224 249 225 CADSimulator.theIncidentMgr.tick(tempTime); 250 } 226 } 251 227 CADSimulator.theSoundPlayer.setAudioEnabled(audioWasEnabled); 252 228 253 229 254 230 CADSimulator.theSimulationCntrlMgr.gotoSimulationTime(newSimTime); 255 256 Runnable gotoRun = new Runnable() 257 { 258 public void run() 259 { 231 232 Runnable gotoRun = new Runnable() { 233 234 public void run() { 260 235 CADSimulator.theViewer.setTime(newSimTime); 261 262 if (managerInt != null) 263 { 264 try 265 { 236 237 if(managerInt != null) { 238 try { 266 239 managerInt.tick(newSimTime); 267 } catch (RemoteException re)268 {240 } 241 catch (RemoteException re) { 269 242 //Simulation Manager has disappeared 270 243 managerInt = null; 271 244 CADSimulator.theViewer.setSimManagerStatus(false); 272 273 coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", 245 246 coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", 274 247 "Connection to Simulation Manager has been dropped.", re); 275 248 } 276 249 } 277 } 250 } 278 251 }; 279 252 280 253 Thread gotoThread = new Thread(gotoRun); 281 gotoThread.start(); 282 283 } 284 285 /** 286 * Sets the current script status. A thread is started to notify the 287 * CADSimulatorViewer and SimulationManager with the new status. 288 */ 289 public void setScriptStatus(final SCRIPT_STATUS status) 290 { 291 292 Runnable updateRun = new Runnable() 293 { 294 public void run() 295 { 254 gotoThread.start(); 255 256 } 257 258 259 /** 260 * Sets the current script status. A thread is started to notify 261 * the CADSimulatorViewer and SimulationManager with the new status. 262 */ 263 public void setScriptStatus(final SCRIPT_STATUS status) { 264 265 Runnable updateRun = new Runnable() { 266 267 public void run() { 296 268 297 269 CADSimulator.theViewer.setScriptStatus(status); 298 299 if (managerInt != null) 300 { 301 try 302 { 270 271 if(managerInt != null) { 272 try { 303 273 managerInt.setScriptStatus(status); 304 } catch (RemoteException re)305 {274 } 275 catch (RemoteException re) { 306 276 //Simulation Manager has disappeared 307 277 managerInt = null; 308 278 CADSimulator.theViewer.setSimManagerStatus(false); 309 279 310 coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", 280 coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", 311 281 "Connection to Simulation Manager has been dropped.", re); 312 } 282 } 313 283 } 314 284 } 315 285 }; 316 286 317 287 Thread updateThread = new Thread(updateRun); 318 288 updateThread.start(); 319 } 320 321 /** 322 * Sets the current paramics status. A thread is started to notify the 323 * CADSimulatorViewer and SimulationManager with the new status. 324 */ 325 public void setParamicsStatus(final PARAMICS_STATUS status) 326 { 327 328 Runnable updateRun = new Runnable() 329 { 330 public void run() 331 { 289 } 290 291 /** 292 * Sets the current paramics status. A thread is started to notify 293 * the CADSimulatorViewer and SimulationManager with the new status. 294 */ 295 public void setParamicsStatus(final PARAMICS_STATUS status) { 296 297 Runnable updateRun = new Runnable(){ 298 299 public void run() { 332 300 CADSimulator.theViewer.setParamicsStatus(status); 333 334 if (managerInt != null) 335 { 336 try 337 { 301 302 if(managerInt != null) { 303 try { 338 304 managerInt.setParamicsStatus(status); 339 } catch (RemoteException re)340 {305 } 306 catch (RemoteException re) { 341 307 //Simulation Manager has disappeared 342 308 managerInt = null; 343 309 CADSimulator.theViewer.setSimManagerStatus(false); 344 310 345 coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 311 coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 346 312 "Connection to Simulation Manager has been dropped.", re); 347 } 348 } 313 } 314 } 315 } 316 }; 317 318 Thread updateThread = new Thread(updateRun); 319 updateThread.start(); 320 321 } 322 323 public void connectToParamics() throws RemoteException { 324 CADSimulator.theParamicsSimMgr.connectToParamics(); 325 } 326 public void disconnectFromParamics() throws RemoteException { 327 CADSimulator.theParamicsSimMgr.disconnectFromParamics(); 328 } 329 330 public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException { 331 CADSimulator.theParamicsSimMgr.loadParamicsNetwork(networkID); 332 } 333 334 public PARAMICS_STATUS getParamicsStatus() throws RemoteException { 335 return CADSimulator.theParamicsSimMgr.getParamicsStatus(); 336 } 337 338 public int getParamicsNetworkLoaded() throws RemoteException { 339 return CADSimulator.theParamicsSimMgr.getParamicsNetworkLoaded(); 340 } 341 342 public long getCurrentSimulationTime() throws RemoteException { 343 return CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 344 } 345 346 public void triggerIncident(Integer incidentNumber) throws RemoteException, ScriptException { 347 348 if(!CADSimulator.theSimulationCntrlMgr.simulationStarted()) 349 throw new ScriptException(ScriptException.SIM_NOT_STARTED); 350 else if(!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 351 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 352 353 CADSimulator.theIncidentMgr.triggerIncident(incidentNumber, 354 CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()); 355 } 356 357 public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException { 358 CADSimulator.theIncidentMgr.deleteIncident(incidentNumber); 359 360 if(CADSimulator.theIncidentMgr.getIncidentList().size() == 0) { 361 setScriptStatus(SCRIPT_STATUS.NO_SCRIPT); 362 } 363 364 if(managerInt != null) { 365 try { 366 managerInt.incidentRemoved(incidentNumber); 349 367 } 350 }; 351 352 Thread updateThread = new Thread(updateRun); 353 updateThread.start(); 354 355 } 356 357 public void connectToParamics() throws RemoteException 358 { 359 CADSimulator.theParamicsSimMgr.connectToParamics(); 360 } 361 362 public void disconnectFromParamics() throws RemoteException 363 { 364 CADSimulator.theParamicsSimMgr.disconnectFromParamics(); 365 } 366 367 public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException 368 { 369 CADSimulator.theParamicsSimMgr.loadParamicsNetwork(networkID); 370 } 371 372 public PARAMICS_STATUS getParamicsStatus() throws RemoteException 373 { 374 return CADSimulator.theParamicsSimMgr.getParamicsStatus(); 375 } 376 377 public int getParamicsNetworkLoaded() throws RemoteException 378 { 379 return CADSimulator.theParamicsSimMgr.getParamicsNetworkLoaded(); 380 } 381 382 public long getCurrentSimulationTime() throws RemoteException 383 { 384 return CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 385 } 386 387 public void triggerIncident(Integer incidentNumber) throws RemoteException, ScriptException 388 { 389 390 if (!CADSimulator.theSimulationCntrlMgr.simulationStarted()) 391 { 392 throw new ScriptException(ScriptException.SIM_NOT_STARTED); 393 } else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 394 { 395 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 396 } 397 398 CADSimulator.theIncidentMgr.triggerIncident(incidentNumber, 399 CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()); 400 } 401 402 public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException 403 { 404 CADSimulator.theIncidentMgr.deleteIncident(incidentNumber); 405 406 if (CADSimulator.theIncidentMgr.getIncidentList().size() == 0) 407 { 408 setScriptStatus(SCRIPT_STATUS.NO_SCRIPT); 409 } 410 411 if (managerInt != null) 412 { 413 try 414 { 415 managerInt.incidentRemoved(incidentNumber); 416 } catch (RemoteException re) 417 { 368 catch (RemoteException re) { 418 369 //Simulation Manager has disappeared 419 370 managerInt = null; 420 371 CADSimulator.theViewer.setSimManagerStatus(false); 421 372 422 coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", 373 coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", 423 374 "Connection to Simulation Manager has been dropped.", re); 375 } 376 } 377 } 378 379 public void rescheduleIncident(Integer incidentNumber, long newTime) 380 throws RemoteException, ScriptException { 381 382 if (newTime < CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()) { 383 throw new ScriptException(ScriptException.TIME_PASSED); 384 } 385 386 CADSimulator.theIncidentMgr.rescheduleIncident(incidentNumber, newTime); 387 } 388 389 public void addIncident(Incident newIncident) throws RemoteException { 390 391 CADSimulator.theIncidentMgr.addIncident(newIncident); 392 393 if(managerInt != null) { 394 try { 395 managerInt.incidentAdded(newIncident); 424 396 } 425 } 426 } 427 428 public void rescheduleIncident(Integer incidentNumber, long newTime) 429 throws RemoteException, ScriptException 430 { 431 432 if (newTime < CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()) 433 { 434 throw new ScriptException(ScriptException.TIME_PASSED); 435 } 436 437 CADSimulator.theIncidentMgr.rescheduleIncident(incidentNumber, newTime); 438 } 439 440 public void addIncident(Incident newIncident) throws RemoteException 441 { 442 443 CADSimulator.theIncidentMgr.addIncident(newIncident); 444 445 if (managerInt != null) 446 { 447 try 448 { 449 managerInt.incidentAdded(newIncident); 450 } catch (RemoteException re) 451 { 397 catch (RemoteException re) { 452 398 //Simulation Manager has disappeared 453 399 managerInt = null; 454 400 CADSimulator.theViewer.setSimManagerStatus(false); 455 401 456 coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", 402 coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", 457 403 "Connection to Simulation Manager has been dropped.", re); 458 } 459 } 460 } 461 462 public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException 463 { 464 465 466 try 467 { 404 } 405 } 406 } 407 408 409 public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException { 410 411 412 try { 468 413 CADSimulator.theIncidentMgr.clearIncidents(); 469 414 cadData.clearData(); 470 415 471 416 ScriptHandler sh = new ScriptHandler(); 472 417 473 418 SAXParserFactory.newInstance().newSAXParser().parse(scriptFile, sh); 474 419 475 420 cadData.setIncidentsFromXML(sh.getIncidents()); 476 421 cadData.setUnitsFromXML(sh.getUnits()); 477 422 refreshClients(); 478 423 CADSimulator.theIncidentMgr.addIncidents(sh.getIncidents()); 479 480 resetSimulation(); 481 } catch (Exception e) 482 { 483 e.printStackTrace(); 484 } 485 486 } 487 488 public Vector<Incident> getIncidentList() throws RemoteException 489 { 424 425 resetSimulation(); 426 } 427 catch (Exception e) {e.printStackTrace();} 428 429 } 430 431 public Vector<Incident> getIncidentList() throws RemoteException { 490 432 return CADSimulator.theIncidentMgr.getIncidentList(); 491 433 } 492 493 public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException 494 { 434 435 public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException { 495 436 return CADSimulator.theIncidentMgr.getTriggeredEvents(); 496 437 } 497 438 498 public SCRIPT_STATUS getScriptStatus() throws RemoteException 499 { 500 if (CADSimulator.theIncidentMgr.areIncidentsLoaded()) 501 { 502 if (CADSimulator.theSimulationCntrlMgr.simulationStarted()) 503 { 439 public SCRIPT_STATUS getScriptStatus() throws RemoteException { 440 if(CADSimulator.theIncidentMgr.areIncidentsLoaded()) { 441 if(CADSimulator.theSimulationCntrlMgr.simulationStarted()) 504 442 return SCRIPT_STATUS.SCRIPT_RUNNING; 505 } else 506 { 507 for (Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) 508 { 509 if (inc.hasOccured() == true) 510 { 443 else { 444 for(Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) { 445 if(inc.hasOccured() == true) 511 446 return SCRIPT_STATUS.SCRIPT_PAUSED_STARTED; 512 }513 447 } 514 448 return SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED; … … 517 451 return SCRIPT_STATUS.NO_SCRIPT; 518 452 } 519 520 /** 521 * Route a message to a CAD terminal. If the new message is an incident 522 * update, the current message text will be the requested incident's log 523 * number. Set the message's text to the XML representation of the requested 524 * IncidentInquiry object. Notify observers with the new message. 453 454 /** 455 * Route a message to a CAD terminal. If the new message is 456 * an incident update, the current message text will be the 457 * requested incident's log number. Set the message's text 458 * to the XML representation of the requested IncidentInquiry 459 * object. Notify observers with the new message. 525 460 * 526 461 * @param newMessage Routed message received from CAD Client. 527 462 */ 528 public void routeMessage(CADRoutedMessage newMessage) 529 { 530 463 public void routeMessage(CADRoutedMessage newMessage) { 464 531 465 //if this is an incidentUpdate 532 466 /* 533 467 * TODO Is this a priority?? 534 if(newMessage.incidentUpdate) {535 IncidentInquiryModel tempII = new IncidentInquiryModel(536 newMessage.fromPosition,537 CADScreenNum.ONE,538 Integer.parseInt(newMessage.message));539 540 for(IncidentInquiryModel_obj iimo : getIncidentInquiryModelObjects(541 Integer.parseInt(newMessage.message))) {542 tempII.addModelObject(iimo);543 }544 545 XMLWriter tempWriter = new XMLWriter();546 tempII.toXML(tempWriter);547 newMessage.message = tempWriter.getString();548 }549 */550 468 if(newMessage.incidentUpdate) { 469 IncidentInquiryModel tempII = new IncidentInquiryModel( 470 newMessage.fromPosition, 471 CADScreenNum.ONE, 472 Integer.parseInt(newMessage.message)); 473 474 for(IncidentInquiryModel_obj iimo : getIncidentInquiryModelObjects( 475 Integer.parseInt(newMessage.message))) { 476 tempII.addModelObject(iimo); 477 } 478 479 XMLWriter tempWriter = new XMLWriter(); 480 tempII.toXML(tempWriter); 481 newMessage.message = tempWriter.getString(); 482 } 483 */ 484 551 485 notifyObservers(new ObserverMessage(ObserverMessage.messageType.ROUTED_MESSAGE, 552 486 newMessage)); 553 487 554 } 555 556 public TreeSet<String> getCMSIDs() throws RemoteException557 {488 } 489 490 491 public TreeSet<String> getCMSIDs() throws RemoteException { 558 492 return new TreeSet<String>(CMSDiversionDB.getInstance().getAllDiversions().keySet()); 559 493 } 560 561 public CMSInfo getCMSDiversionInfo(String theCMSID) throws RemoteException 562 { 494 495 public CMSInfo getCMSDiversionInfo(String theCMSID) throws RemoteException { 563 496 return CMSDiversionDB.getInstance().getDiversion(theCMSID); 564 } 565 566 public void applyDiversions(CMSInfo theDiversion) throws RemoteException 567 { 497 } 498 499 public void applyDiversions(CMSInfo theDiversion) throws RemoteException { 568 500 CMSDiversionDB.getInstance().updateDiversions(theDiversion); 569 501 CADSimulator.theParamicsSimMgr.updateDiversion(theDiversion); 570 } 571 572 /** 573 * Method updates the simulation with the new Incident information. The574 * parameter IncidentInquiryModel_obj Object is used to create a new575 * IncidentEvent Object which is finalized and sent to the IncidentManager576 * for simulation updating.577 * 502 } 503 504 /** 505 * Method updates the simulation with the new Incident information. 506 * The parameter IncidentInquiryModel_obj Object is used to create 507 * a new IncidentEvent Object which is finalized and sent to the 508 * IncidentManager for simulation updating. 509 * 578 510 * @param update IncidentInquiryModel_obj containing CAD line update 579 511 * @see IncidentManager 580 512 */ 581 public void commandLineUpdate(IncidentInquiryModel_obj modelInfo) 582 { 583 513 public void commandLineUpdate(IncidentInquiryModel_obj modelInfo) { 514 584 515 long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 585 516 586 517 IncidentEvent triggeredEvent = new IncidentEvent(currentSimTime); 587 triggeredEvent.eventInfo = modelInfo;588 518 triggeredEvent.eventInfo = modelInfo; 519 589 520 triggeredEvent.finalizeEvent(currentSimTime, CADSimulator.getCADTime()); 590 521 591 CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent); 592 522 CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent); 523 593 524 updateIncidentInGUI(modelInfo.getLogNumber(), triggeredEvent); 594 595 } 596 597 /** 598 * If the Simulation has started, spawn a thread to update the 599 * CADSimulatorViewer, SimulationManager, and IncidentManager with the new 600 * simulation time. If the current time is a 30 second interval, notify the 525 526 } 527 528 529 /** 530 * If the Simulation has started, spawn a thread to update the 531 * CADSimulatorViewer, SimulationManager, and IncidentManager with the new 532 * simulation time. If the current time is a 30 second interval, notify the 601 533 * ParamicsControlManager to send an IncidentUpdate. 602 * 534 * 603 535 * @see SimulationControlManager 604 536 * @see ParamicsControlManager 605 537 * @see IncidentManager 606 538 */ 607 public void tick() 608 { 609 if (CADSimulator.theSimulationCntrlMgr.simulationStarted()) 610 { 611 539 public void tick() { 540 if(CADSimulator.theSimulationCntrlMgr.simulationStarted()) { 541 612 542 final long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 613 614 Runnable timeRun = new Runnable() 615 { 616 public void run() 617 { 543 544 Runnable timeRun = new Runnable() { 545 546 public void run() { 618 547 CADSimulator.theViewer.setTime(currentSimTime); 619 548 620 549 //send an update every 30 seconds 621 if (currentSimTime % 30 == 0) 622 { 550 if(currentSimTime % 30 == 0) 623 551 CADSimulator.theParamicsSimMgr.sendIncidentUpdate(currentSimTime); 624 } 625 626 if (managerInt != null) 627 { 628 try 629 { 552 553 if(managerInt != null) { 554 try { 630 555 managerInt.tick(currentSimTime); 631 } catch (RemoteException re)632 {556 } 557 catch (RemoteException re) { 633 558 //Simulation Manager has disappeared 634 559 managerInt = null; 635 560 CADSimulator.theViewer.setSimManagerStatus(false); 636 561 637 coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 562 coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 638 563 "Connection to Simulation Manager has been dropped.", re); 639 564 } 640 565 } 641 566 642 567 CADSimulator.theIncidentMgr.tick(currentSimTime); 643 } 568 } 644 569 }; 645 570 646 571 Thread timeThread = new Thread(timeRun); 647 timeThread.start(); 648 } 649 } 572 timeThread.start(); 573 } 574 } 575 650 576 651 577 /** 652 578 * Method notifies observers with an IncidentSummaryModel_obj to signify 653 * that a new Incident has started. Then spawn a thread to notify the579 * that a new Incident has started. Then spawn a thread to notify the 654 580 * SimulationManager with the Incident's log number has started. 655 * 581 * 656 582 * @param completedEvent Completed IncidentEvent. 657 583 */ 658 public void incidentStarted(final IncidentEvent completedEvent) 659 { 584 public void incidentStarted(final IncidentEvent completedEvent) { 660 585 notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_SUMMARY, 661 new IncidentSummaryModel_obj(completedEvent.eventInfo.getHeader()))); 662 586 new IncidentSummaryModel_obj(completedEvent.eventInfo.getHeader()))); 587 663 588 incidentStartedInGUI(completedEvent.eventInfo.getLogNumber()); 664 665 Runnable startRun = new Runnable() 666 { 667 public void run() 668 { 669 if (managerInt != null) 670 { 671 try 672 { 589 590 Runnable startRun = new Runnable() { 591 public void run() { 592 if(managerInt != null) { 593 try { 673 594 managerInt.incidentStarted(completedEvent.eventInfo.getLogNumber()); 674 } catch (RemoteException re)675 {595 } 596 catch (RemoteException re) { 676 597 //Simulation Manager has disappeared 677 598 managerInt = null; 678 599 CADSimulator.theViewer.setSimManagerStatus(false); 679 600 680 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", 601 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", 681 602 "Connection to Simulation Manager has been dropped.", re); 603 } 604 } 605 } 606 }; 607 608 Thread startThread = new Thread(startRun); 609 startThread.start(); 610 } 611 612 /** 613 * Method notifies observers with the IncidentEvent Object to signify 614 * that a new IncidentEvent has completed. All XMLIncident Objects 615 * in the completed IncidentEvent is sent to the ParamicsControlManager 616 * for transmission to Paramics. All CCTVInfo Objects are sent to the 617 * MediaManager for media control. A thread is then spawned to notify the 618 * SimulationManager with the completed IncidentEvent. 619 * 620 * @param completedEvent Completed IncidentEvent. 621 * @see ParamicsControlManager 622 * @see MediaManager 623 */ 624 public void incidentUpdated(final IncidentEvent completedEvent) { 625 notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_INQUIRY, 626 completedEvent.eventInfo)); 627 628 for(XMLIncident xmlInc : completedEvent.XMLIncidents) 629 CADSimulator.theParamicsSimMgr.updateIncident(xmlInc); 630 631 632 /*for(CCTVInfo info : completedEvent.cctvInfos) { 633 CADSimulator.theMediaMgr.triggerIncident(info, 634 completedEvent.eventInfo.getLogNumber()); 635 }*/ 636 637 Runnable displayRun = new Runnable() { 638 public void run() { 639 if(managerInt != null) { 640 try { 641 managerInt.eventOccured( 642 completedEvent.eventInfo.getLogNumber(), 643 completedEvent); 682 644 } 645 catch (RemoteException re) { 646 //Simulation Manager has disappeared 647 managerInt = null; 648 CADSimulator.theViewer.setSimManagerStatus(false); 649 650 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run", 651 "Connection to Simulation Manager has been dropped.", re); 652 } 683 653 } 684 654 } 685 655 }; 686 656 687 Thread startThread = new Thread(startRun);688 startThread.start();689 }690 691 /**692 * Method notifies observers with the IncidentEvent Object to signify that a693 * new IncidentEvent has completed. All XMLIncident Objects in the completed694 * IncidentEvent is sent to the ParamicsControlManager for transmission to695 * Paramics. All CCTVInfo Objects are sent to the MediaManager for media696 * control. A thread is then spawned to notify the SimulationManager with697 * the completed IncidentEvent.698 *699 * @param completedEvent Completed IncidentEvent.700 * @see ParamicsControlManager701 * @see MediaManager702 */703 public void incidentUpdated(final IncidentEvent completedEvent)704 {705 notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_INQUIRY,706 completedEvent.eventInfo));707 708 for (XMLIncident xmlInc : completedEvent.XMLIncidents)709 {710 CADSimulator.theParamicsSimMgr.updateIncident(xmlInc);711 }712 713 714 /*for(CCTVInfo info : completedEvent.cctvInfos) {715 CADSimulator.theMediaMgr.triggerIncident(info,716 completedEvent.eventInfo.getLogNumber());717 }*/718 719 Runnable displayRun = new Runnable()720 {721 public void run()722 {723 if (managerInt != null)724 {725 try726 {727 managerInt.eventOccured(728 completedEvent.eventInfo.getLogNumber(),729 completedEvent);730 } catch (RemoteException re)731 {732 //Simulation Manager has disappeared733 managerInt = null;734 CADSimulator.theViewer.setSimManagerStatus(false);735 736 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run",737 "Connection to Simulation Manager has been dropped.", re);738 }739 }740 }741 };742 743 657 Thread displayThread = new Thread(displayRun); 744 displayThread.start(); 745 } 746 658 displayThread.start(); 659 } 660 747 661 /** 748 662 * @see IncidentManager 749 663 */ 750 public boolean incidentExists(Integer logNumber) 751 { 664 public boolean incidentExists(Integer logNumber) { 752 665 return CADSimulator.theIncidentMgr.incidentExists(logNumber); 753 666 } … … 756 669 * @see IncidentManager 757 670 */ 758 public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects() 759 { 671 public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects() { 760 672 return CADSimulator.theIncidentMgr.getIncidentBoardModelObjects(); 761 } 673 } 762 674 763 675 /** 764 676 * @see IncidentManager 765 677 */ 766 public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber) 767 { 678 public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber) { 768 679 return CADSimulator.theIncidentMgr.getIncidentInquiryModelObjects(logNumber); 769 } 680 } 770 681 771 682 /** 772 683 * @see IncidentManager 773 684 */ 774 public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects() 775 { 685 public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects() { 776 686 return CADSimulator.theIncidentMgr.getIncidentSummaryModelObjects(); 777 } 778 687 } 688 689 779 690 /** 780 691 * Adds an observer to the list of observers. … … 782 693 * @param o New observer object. 783 694 */ 784 public void addObserver(Observer o) 785 { 786 observerList.add(o); 787 } 788 789 /** 790 * Removes an observer from the list of observers. If the observer is not 791 * found, this method returns false, else true is returned for a successful 792 * removal. 695 public void addObserver(Observer o) { 696 observerList.add(o); 697 } 698 699 /** 700 * Removes an observer from the list of observers. If the observer 701 * is not found, this method returns false, else true is returned for 702 * a successful removal. 793 703 * 794 704 * @param o Observer to be removed. 795 705 * @returns True if remove was successful, false if not. 796 */ 797 public boolean removeObserver(Observer o) 798 { 706 */ 707 public boolean removeObserver(Observer o) { 799 708 return observerList.remove(o); 800 709 } 801 802 /** 803 * Notify all registered observers with the parameter ObserverMessage 804 * object. 710 711 /** 712 * Notify all registered observers with the parameter ObserverMessage object. 805 713 * 806 714 * @param newMsg The ObserverMessage to be sent. 807 715 */ 808 private void notifyObservers(ObserverMessage newMsg) 809 { 810 for (Observer o : observerList) 811 { 812 o.update(null, newMsg); 813 } 814 } 815 816 public void refreshClients() throws RemoteException 817 { 818 for (int i = 0; i < clientList.size(); i++) 819 { 716 private void notifyObservers(ObserverMessage newMsg) { 717 for(Observer o : observerList) 718 o.update(null, newMsg); 719 } 720 721 public void refreshClients() throws RemoteException{ 722 for(int i = 0; i < clientList.size(); i++){ 820 723 clientList.get(i).refresh(); 821 724 } 822 725 } 823 726 824 727 /** 825 728 * Checks the CADData for an existing incident with id 826 *827 729 * @param id the incident id 828 730 * @return true if CADData contains such an incident, otherwise false. 829 731 * @throws RemoteException 830 732 */ 831 public boolean checkForValidIncidentID(int id) throws RemoteException 832 { 733 public boolean checkForValidIncidentID(int id) throws RemoteException{ 833 734 return cadData.checkForValidId(id); 834 } 835 836 /** 735 } 736 737 738 /** 837 739 * Uses an Incident's masterInc to lookup its ID. 838 *839 740 * @param masterInc the Incident to look up 840 741 * @return the same Incident's ID, -1 if invalid masterInc 841 742 * @throws RemoteException 842 743 */ 843 public int getIncidentId(String masterInc) throws RemoteException 844 { 845 return cadData.getIncidentId(masterInc); 846 } 847 744 public int getIncidentId(String masterInc) throws RemoteException{ 745 return cadData.getIncidentId(masterInc); 746 } 747 848 748 /** 849 749 * Returns a table model out of CADData based on tag. 850 * 851 * @param tag a CADDataEnums tag 852 * @throws RemoteException 853 */ 854 public DefaultTableModel getCadDataTable(TABLE tag) throws RemoteException 855 { 856 if (tag.equals(TABLE.ASSIGNED_INCIDENTS)) 857 { 750 * @param tag a CADDataEnums tag 751 * @throws RemoteException 752 */ 753 public DefaultTableModel getCadDataTable(TABLE tag) throws RemoteException{ 754 if(tag.equals(TABLE.ASSIGNED_INCIDENTS)){ 858 755 return cadData.tableForAssignedIncidents(); 859 } else if (tag.equals(TABLE.UNIT_STATUS))860 {756 } 757 else if(tag.equals(TABLE.UNIT_STATUS)){ 861 758 return cadData.tableForUnitStatus(); 862 } else if (tag.equals(TABLE.PENDING_INCIDENTS))863 {759 } 760 else if(tag.equals(TABLE.PENDING_INCIDENTS)){ 864 761 return cadData.tableForPendingIncidents(); 865 } else if (tag.equals(TABLE.INCIDENT_EDITOR))866 {762 } 763 else if(tag.equals(TABLE.INCIDENT_EDITOR)){ 867 764 return cadData.tableForIncidentEditor(); 868 } else869 {765 } 766 else{ 870 767 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataTable"); 871 768 } 872 769 } 873 770 874 771 /** 875 772 * Returns the specified incident's table based on the tag. 876 *877 773 * @param tag a CADDataEnums tag 878 774 * @param incidentId the incident's ID to look up … … 880 776 * @throws RemoteException 881 777 */ 882 public DefaultTableModel getCadDataIncidentTable(INC_TABLE tag, int incidentId) throws RemoteException 883 { 884 if (tag.equals(INC_TABLE.COMMENTS_NOTES)) 885 { 886 return cadData.getIncident(incidentId).getCommentsNotesTable(); 887 } 888 return null; 889 } 890 778 public DefaultTableModel getCadDataIncidentTable(INC_TABLE tag, int incidentId) throws RemoteException{ 779 if(tag.equals(INC_TABLE.COMMENTS_NOTES)){ 780 return cadData.getIncident(incidentId).getCommentsNotesTable(); 781 } 782 return null; 783 } 784 891 785 /** 892 786 * Adds a row of data to a specified incident's table based on the tag. 893 *894 787 * @param tag a CADDataEnums tag 895 788 * @param incidentId the incident's ID to look up … … 897 790 * @throws RemoteException 898 791 */ 899 public void addCadDataIncidentTable(INC_TABLE tag, int incidentId, String[] fields) throws RemoteException 900 { 901 if (tag.equals(INC_TABLE.COMMENTS_NOTES)) 902 { 903 cadData.getIncident(incidentId).addToCommentsNotesTable(fields); 904 } 905 } 906 792 public void addCadDataIncidentTable(INC_TABLE tag, int incidentId, String[] fields) throws RemoteException{ 793 if(tag.equals(INC_TABLE.COMMENTS_NOTES)){ 794 cadData.getIncident(incidentId).addToCommentsNotesTable(fields); 795 } 796 } 797 907 798 /** 908 799 * Adds a row to the specified data table based on the incoming fields. 909 * 910 * @param tag a CADDataEnums tag 911 * @param incidentId the incident's ID to look up 912 * @throws RemoteException 913 */ 914 public void addCadDataTableRow(TABLE tag, String field1, String field2, String field3, String field4) throws RemoteException 915 { 916 } 917 800 * @param tag a CADDataEnums tag 801 * @param incidentId the incident's ID to look up 802 * @throws RemoteException 803 */ 804 public void addCadDataTableRow(TABLE tag, String field1, String field2, String field3, String field4) throws RemoteException{ 805 806 } 807 808 809 918 810 /** 919 811 * Returns an object out of Incident based on tag. 920 * 921 * @param tag a CADDataEnums tag 922 * @param incidentId the incident's ID to look up 923 * @throws RemoteException 924 */ 925 public Object getCadDataIncVal(INC_VAL tag, int incidentId) throws RemoteException 926 { 927 if (tag.equals(INC_VAL.LOG_NUM)) 928 { 812 * @param tag a CADDataEnums tag 813 * @param incidentId the incident's ID to look up 814 * @throws RemoteException 815 */ 816 public Object getCadDataIncVal(INC_VAL tag, int incidentId) throws RemoteException{ 817 if(tag.equals(INC_VAL.LOG_NUM)){ 929 818 return cadData.getIncident(incidentId).getLogNum(); 930 } else if (tag.equals(INC_VAL.MASTER_INC))931 {819 } 820 else if(tag.equals(INC_VAL.MASTER_INC)){ 932 821 return cadData.getIncident(incidentId).getMasterInc(); 933 } else if (tag.equals(INC_VAL.OAU))934 {822 } 823 else if(tag.equals(INC_VAL.OAU)){ 935 824 return cadData.getIncident(incidentId).getOau(); 936 } else if (tag.equals(INC_VAL.P))937 {825 } 826 else if(tag.equals(INC_VAL.P)){ 938 827 return cadData.getIncident(incidentId).getP(); 939 } else if (tag.equals(INC_VAL.DESCRIPTION))940 {828 } 829 else if(tag.equals(INC_VAL.DESCRIPTION)){ 941 830 return cadData.getIncident(incidentId).getDescription(); 942 } else if (tag.equals(INC_VAL.RP))943 {831 } 832 else if(tag.equals(INC_VAL.RP)){ 944 833 return cadData.getIncident(incidentId).getRp(); 945 } else if (tag.equals(INC_VAL.RP_TYPE))946 {834 } 835 else if(tag.equals(INC_VAL.RP_TYPE)){ 947 836 return cadData.getIncident(incidentId).getRpType(); 948 } else if (tag.equals(INC_VAL.ALI))949 {837 } 838 else if(tag.equals(INC_VAL.ALI)){ 950 839 return cadData.getIncident(incidentId).getAli(); 951 } else if (tag.equals(INC_VAL.MEDIA))952 {840 } 841 else if(tag.equals(INC_VAL.MEDIA)){ 953 842 return cadData.getIncident(incidentId).getMedia(); 954 } else955 {843 } 844 else{ 956 845 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncVal"); 957 846 } 958 847 } 959 848 960 849 /** 961 850 * Set incidentId's field based on tag to value. 962 * 963 * @param tag a CADDataEnums tag 964 * @param incidentId the incident's ID to look up 965 * @throws RemoteException 966 */ 967 public void setCadDataIncVal(INC_VAL tag, int incidentId, String value) throws RemoteException 968 { 969 if (tag.equals(INC_VAL.OAU)) 970 { 851 * @param tag a CADDataEnums tag 852 * @param incidentId the incident's ID to look up 853 * @throws RemoteException 854 */ 855 public void setCadDataIncVal(INC_VAL tag, int incidentId, String value) throws RemoteException{ 856 if(tag.equals(INC_VAL.OAU)){ 971 857 cadData.getIncident(incidentId).setOau(value); 972 } else if (tag.equals(INC_VAL.P))973 {858 } 859 else if(tag.equals(INC_VAL.P)){ 974 860 cadData.getIncident(incidentId).setP(value); 975 } else if (tag.equals(INC_VAL.DESCRIPTION))976 {861 } 862 else if(tag.equals(INC_VAL.DESCRIPTION)){ 977 863 cadData.getIncident(incidentId).setDescription(value); 978 } else if (tag.equals(INC_VAL.RP))979 {864 } 865 else if(tag.equals(INC_VAL.RP)){ 980 866 cadData.getIncident(incidentId).setRp(value); 981 } else if (tag.equals(INC_VAL.RP_TYPE))982 {867 } 868 else if(tag.equals(INC_VAL.RP_TYPE)){ 983 869 cadData.getIncident(incidentId).setRpType(value); 984 } else if (tag.equals(INC_VAL.ALI))985 {870 } 871 else if(tag.equals(INC_VAL.ALI)){ 986 872 cadData.getIncident(incidentId).setAli(value); 987 } else if (tag.equals(INC_VAL.MEDIA))988 {873 } 874 else if(tag.equals(INC_VAL.MEDIA)){ 989 875 cadData.getIncident(incidentId).setMedia(value); 990 } else991 {876 } 877 else{ 992 878 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncVal"); 993 879 } 994 880 } 881 995 882 996 883 /** 997 884 * Returns a string out of IncidentLocation based on tag. 998 * 999 * @param tag a CADDataEnums tag 1000 * @param incidentId the incident's ID to look up 1001 * @throws RemoteException 1002 */ 1003 public String getCadDataIncLoc(INC_LOC tag, int incidentId) throws RemoteException 1004 { 1005 if (tag.equals(INC_LOC.ADDRESS)) 1006 { 885 * @param tag a CADDataEnums tag 886 * @param incidentId the incident's ID to look up 887 * @throws RemoteException 888 */ 889 public String getCadDataIncLoc(INC_LOC tag, int incidentId) throws RemoteException { 890 if(tag.equals(INC_LOC.ADDRESS)){ 1007 891 return cadData.getIncident(incidentId).getIncidentLocation().getAddress(); 1008 } else if (tag.equals(INC_LOC.LOC))1009 {892 } 893 else if(tag.equals(INC_LOC.LOC)){ 1010 894 return cadData.getIncident(incidentId).getIncidentLocation().getLoc(); 1011 } else if (tag.equals(INC_LOC.CITY))1012 {895 } 896 else if(tag.equals(INC_LOC.CITY)){ 1013 897 return cadData.getIncident(incidentId).getIncidentLocation().getCity(); 1014 } else if (tag.equals(INC_LOC.COUNTY))1015 {898 } 899 else if(tag.equals(INC_LOC.COUNTY)){ 1016 900 return cadData.getIncident(incidentId).getIncidentLocation().getCounty(); 1017 } else if (tag.equals(INC_LOC.STATE))1018 {901 } 902 else if(tag.equals(INC_LOC.STATE)){ 1019 903 return cadData.getIncident(incidentId).getIncidentLocation().getState(); 1020 } else if (tag.equals(INC_LOC.ZIP))1021 {904 } 905 else if(tag.equals(INC_LOC.ZIP)){ 1022 906 return cadData.getIncident(incidentId).getIncidentLocation().getZip(); 1023 } else if (tag.equals(INC_LOC.BEAT))1024 {907 } 908 else if(tag.equals(INC_LOC.BEAT)){ 1025 909 return cadData.getIncident(incidentId).getIncidentLocation().getBeat(); 1026 } else if (tag.equals(INC_LOC.AREA))1027 {910 } 911 else if(tag.equals(INC_LOC.AREA)){ 1028 912 return cadData.getIncident(incidentId).getIncidentLocation().getArea(); 1029 } else if (tag.equals(INC_LOC.SECTOR))1030 {913 } 914 else if(tag.equals(INC_LOC.SECTOR)){ 1031 915 return cadData.getIncident(incidentId).getIncidentLocation().getSector(); 1032 } else if (tag.equals(INC_LOC.SECTOR_CODE))1033 {916 } 917 else if(tag.equals(INC_LOC.SECTOR_CODE)){ 1034 918 return cadData.getIncident(incidentId).getIncidentLocation().getSectorCode(); 1035 } else if (tag.equals(INC_LOC.DIVISION))1036 {919 } 920 else if(tag.equals(INC_LOC.DIVISION)){ 1037 921 return cadData.getIncident(incidentId).getIncidentLocation().getDivision(); 1038 } else if (tag.equals(INC_LOC.APT))1039 {922 } 923 else if(tag.equals(INC_LOC.APT)){ 1040 924 return cadData.getIncident(incidentId).getIncidentLocation().getApt(); 1041 } else if (tag.equals(INC_LOC.BUILDING))1042 {925 } 926 else if(tag.equals(INC_LOC.BUILDING)){ 1043 927 return cadData.getIncident(incidentId).getIncidentLocation().getBuilding(); 1044 } else if (tag.equals(INC_LOC.CROSS_ST))1045 {928 } 929 else if(tag.equals(INC_LOC.CROSS_ST)){ 1046 930 return cadData.getIncident(incidentId).getIncidentLocation().getCrossSt(); 1047 } else if (tag.equals(INC_LOC.LAW))1048 {931 } 932 else if(tag.equals(INC_LOC.LAW)){ 1049 933 return cadData.getIncident(incidentId).getIncidentLocation().getLaw(); 1050 } else if (tag.equals(INC_LOC.FIRE))1051 {934 } 935 else if(tag.equals(INC_LOC.FIRE)){ 1052 936 return cadData.getIncident(incidentId).getIncidentLocation().getFire(); 1053 } else if (tag.equals(INC_LOC.EMS))1054 {937 } 938 else if(tag.equals(INC_LOC.EMS)){ 1055 939 return cadData.getIncident(incidentId).getIncidentLocation().getEms(); 1056 } else1057 {940 } 941 else{ 1058 942 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncLoc"); 1059 943 } … … 1062 946 /** 1063 947 * Set incidentId's field based on tag to value. 1064 * 1065 * @param tag a CADDataEnums tag 1066 * @param incidentId the incident's ID to look up 1067 * @throws RemoteException 1068 */ 1069 public void setCadDataIncLoc(INC_LOC tag, int incidentId, String value) throws RemoteException 1070 { 1071 if (tag.equals(INC_LOC.ADDRESS)) 1072 { 948 * @param tag a CADDataEnums tag 949 * @param incidentId the incident's ID to look up 950 * @throws RemoteException 951 */ 952 public void setCadDataIncLoc(INC_LOC tag, int incidentId, String value) throws RemoteException{ 953 if(tag.equals(INC_LOC.ADDRESS)){ 1073 954 cadData.getIncident(incidentId).getIncidentLocation().setAddress(value); 1074 } else if (tag.equals(INC_LOC.LOC))1075 {955 } 956 else if(tag.equals(INC_LOC.LOC)){ 1076 957 cadData.getIncident(incidentId).getIncidentLocation().setLoc(value); 1077 } else if (tag.equals(INC_LOC.CITY))1078 {958 } 959 else if(tag.equals(INC_LOC.CITY)){ 1079 960 cadData.getIncident(incidentId).getIncidentLocation().setCity(value); 1080 } else if (tag.equals(INC_LOC.COUNTY))1081 {961 } 962 else if(tag.equals(INC_LOC.COUNTY)){ 1082 963 cadData.getIncident(incidentId).getIncidentLocation().setCounty(value); 1083 } else if (tag.equals(INC_LOC.STATE))1084 {964 } 965 else if(tag.equals(INC_LOC.STATE)){ 1085 966 cadData.getIncident(incidentId).getIncidentLocation().setState(value); 1086 } else if (tag.equals(INC_LOC.ZIP))1087 {967 } 968 else if(tag.equals(INC_LOC.ZIP)){ 1088 969 cadData.getIncident(incidentId).getIncidentLocation().setZip(value); 1089 } else if (tag.equals(INC_LOC.BEAT))1090 {970 } 971 else if(tag.equals(INC_LOC.BEAT)){ 1091 972 cadData.getIncident(incidentId).getIncidentLocation().setBeat(value); 1092 } else if (tag.equals(INC_LOC.AREA))1093 {973 } 974 else if(tag.equals(INC_LOC.AREA)){ 1094 975 cadData.getIncident(incidentId).getIncidentLocation().setArea(value); 1095 } else if (tag.equals(INC_LOC.SECTOR))1096 {976 } 977 else if(tag.equals(INC_LOC.SECTOR)){ 1097 978 cadData.getIncident(incidentId).getIncidentLocation().setSector(value); 1098 } else if (tag.equals(INC_LOC.SECTOR_CODE))1099 {979 } 980 else if(tag.equals(INC_LOC.SECTOR_CODE)){ 1100 981 cadData.getIncident(incidentId).getIncidentLocation().setSectorCode(value); 1101 } else if (tag.equals(INC_LOC.DIVISION))1102 {982 } 983 else if(tag.equals(INC_LOC.DIVISION)){ 1103 984 cadData.getIncident(incidentId).getIncidentLocation().setDivision(value); 1104 } else if (tag.equals(INC_LOC.APT))1105 {985 } 986 else if(tag.equals(INC_LOC.APT)){ 1106 987 cadData.getIncident(incidentId).getIncidentLocation().setApt(value); 1107 } else if (tag.equals(INC_LOC.BUILDING))1108 {988 } 989 else if(tag.equals(INC_LOC.BUILDING)){ 1109 990 cadData.getIncident(incidentId).getIncidentLocation().setBuilding(value); 1110 } else if (tag.equals(INC_LOC.CROSS_ST))1111 {991 } 992 else if(tag.equals(INC_LOC.CROSS_ST)){ 1112 993 cadData.getIncident(incidentId).getIncidentLocation().setCrossSt(value); 1113 } else if (tag.equals(INC_LOC.LAW))1114 {994 } 995 else if(tag.equals(INC_LOC.LAW)){ 1115 996 cadData.getIncident(incidentId).getIncidentLocation().setLaw(value); 1116 } else if (tag.equals(INC_LOC.FIRE))1117 {997 } 998 else if(tag.equals(INC_LOC.FIRE)){ 1118 999 cadData.getIncident(incidentId).getIncidentLocation().setFire(value); 1119 } else if (tag.equals(INC_LOC.EMS))1120 {1000 } 1001 else if(tag.equals(INC_LOC.EMS)){ 1121 1002 cadData.getIncident(incidentId).getIncidentLocation().setEms(value); 1122 } else1123 {1003 } 1004 else{ 1124 1005 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncLoc"); 1125 1006 } 1126 1007 } 1127 1008 1128 1009 /** 1129 1010 * Returns a string out of IncidentCaller based on tag. 1130 * 1131 * @param tag a CADDataEnums tag 1132 * @param incidentId the incident's ID to look up 1133 * @throws RemoteException 1134 */ 1135 public String getCadDataIncCaller(INC_CALLER tag, int incidentId) throws RemoteException 1136 { 1137 if (tag.equals(INC_CALLER.TYPE)) 1138 { 1011 * @param tag a CADDataEnums tag 1012 * @param incidentId the incident's ID to look up 1013 * @throws RemoteException 1014 */ 1015 public String getCadDataIncCaller(INC_CALLER tag, int incidentId) throws RemoteException { 1016 if(tag.equals(INC_CALLER.TYPE)){ 1139 1017 return cadData.getIncident(incidentId).getIncidentCaller().getCallerType(); 1140 } else if (tag.equals(INC_CALLER.NAME))1141 {1018 } 1019 else if(tag.equals(INC_CALLER.NAME)){ 1142 1020 return cadData.getIncident(incidentId).getIncidentCaller().getCallerName(); 1143 } else if (tag.equals(INC_CALLER.PHONE))1144 {1021 } 1022 else if(tag.equals(INC_CALLER.PHONE)){ 1145 1023 return cadData.getIncident(incidentId).getIncidentCaller().getPhone(); 1146 } else if (tag.equals(INC_CALLER.EXT))1147 {1024 } 1025 else if(tag.equals(INC_CALLER.EXT)){ 1148 1026 return cadData.getIncident(incidentId).getIncidentCaller().getExt(); 1149 } else1150 {1027 } 1028 else{ 1151 1029 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCaller"); 1152 1030 } … … 1155 1033 /** 1156 1034 * Set incidentId's field based on tag to value. 1157 * 1158 * @param tag a CADDataEnums tag 1159 * @param incidentId the incident's ID to look up 1160 * @throws RemoteException 1161 */ 1162 public void setCadDataIncCaller(INC_CALLER tag, int incidentId, String value) throws RemoteException 1163 { 1164 if (tag.equals(INC_CALLER.TYPE)) 1165 { 1035 * @param tag a CADDataEnums tag 1036 * @param incidentId the incident's ID to look up 1037 * @throws RemoteException 1038 */ 1039 public void setCadDataIncCaller(INC_CALLER tag, int incidentId, String value) throws RemoteException{ 1040 if(tag.equals(INC_CALLER.TYPE)){ 1166 1041 cadData.getIncident(incidentId).getIncidentCaller().setCallerType(value); 1167 } else if (tag.equals(INC_CALLER.NAME))1168 {1042 } 1043 else if(tag.equals(INC_CALLER.NAME)){ 1169 1044 cadData.getIncident(incidentId).getIncidentCaller().setCallerName(value); 1170 } else if (tag.equals(INC_CALLER.PHONE))1171 {1045 } 1046 else if(tag.equals(INC_CALLER.PHONE)){ 1172 1047 cadData.getIncident(incidentId).getIncidentCaller().setPhone(value); 1173 } else if (tag.equals(INC_CALLER.EXT))1174 {1048 } 1049 else if(tag.equals(INC_CALLER.EXT)){ 1175 1050 cadData.getIncident(incidentId).getIncidentCaller().setExt(value); 1176 } else1177 {1051 } 1052 else{ 1178 1053 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncCaller"); 1179 1054 } 1180 1055 } 1181 1056 1182 1057 /** 1183 1058 * Returns a string out of IncidentProblem based on tag. 1184 * 1185 * @param tag a CADDataEnums tag 1186 * @param incidentId the incident's ID to look up 1187 * @throws RemoteException 1188 */ 1189 public String getCadDataIncProblem(INC_PROBLEM tag, int incidentId) throws RemoteException 1190 { 1191 if (tag.equals(INC_PROBLEM.PROBLEM)) 1192 { 1059 * @param tag a CADDataEnums tag 1060 * @param incidentId the incident's ID to look up 1061 * @throws RemoteException 1062 */ 1063 public String getCadDataIncProblem(INC_PROBLEM tag, int incidentId) throws RemoteException { 1064 if(tag.equals(INC_PROBLEM.PROBLEM)){ 1193 1065 return cadData.getIncident(incidentId).getProblem().getProblem(); 1194 } else if (tag.equals(INC_PROBLEM.CODE))1195 {1066 } 1067 else if(tag.equals(INC_PROBLEM.CODE)){ 1196 1068 return cadData.getIncident(incidentId).getProblem().getProblemCode(); 1197 } else if (tag.equals(INC_PROBLEM.PRIORITY))1198 {1069 } 1070 else if(tag.equals(INC_PROBLEM.PRIORITY)){ 1199 1071 return cadData.getIncident(incidentId).getProblem().getPriority(); 1200 } else1201 {1072 } 1073 else{ 1202 1074 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncProblem"); 1203 1075 } 1204 1076 } 1205 1077 1206 1078 /** 1207 1079 * Set incidentId's field based on tag to value. 1208 * 1209 * @param tag a CADDataEnums tag 1210 * @param incidentId the incident's ID to look up 1211 * @throws RemoteException 1212 */ 1213 public void setCadDataIncProblem(INC_PROBLEM tag, int incidentId, String value) throws RemoteException 1214 { 1215 if (tag.equals(INC_PROBLEM.PROBLEM)) 1216 { 1080 * @param tag a CADDataEnums tag 1081 * @param incidentId the incident's ID to look up 1082 * @throws RemoteException 1083 */ 1084 public void setCadDataIncProblem(INC_PROBLEM tag, int incidentId, String value) throws RemoteException{ 1085 if(tag.equals(INC_PROBLEM.PROBLEM)){ 1217 1086 cadData.getIncident(incidentId).getProblem().setProblem(value); 1218 } else if (tag.equals(INC_PROBLEM.CODE))1219 {1087 } 1088 else if(tag.equals(INC_PROBLEM.CODE)){ 1220 1089 cadData.getIncident(incidentId).getProblem().setProblemCode(value); 1221 } else if (tag.equals(INC_PROBLEM.PRIORITY))1222 {1090 } 1091 else if(tag.equals(INC_PROBLEM.PRIORITY)){ 1223 1092 cadData.getIncident(incidentId).getProblem().setPriority(value); 1224 } else1225 {1093 } 1094 else{ 1226 1095 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncProblem"); 1227 1096 } … … 1230 1099 /** 1231 1100 * Returns a string out of IncidentGeneralInfo based on tag. 1232 * 1233 * @param tag a CADDataEnums tag 1234 * @param incidentId the incident's ID to look up 1235 * @throws RemoteException 1236 */ 1237 public String getCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId) throws RemoteException 1238 { 1239 if (tag.equals(INC_GEN_INFO.JURISDICTION)) 1240 { 1101 * @param tag a CADDataEnums tag 1102 * @param incidentId the incident's ID to look up 1103 * @throws RemoteException 1104 */ 1105 public String getCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId) throws RemoteException { 1106 if(tag.equals(INC_GEN_INFO.JURISDICTION)){ 1241 1107 return cadData.getIncident(incidentId).getGenInfo().getJurisdiction(); 1242 } else if (tag.equals(INC_GEN_INFO.ALARM))1243 {1108 } 1109 else if(tag.equals(INC_GEN_INFO.ALARM)){ 1244 1110 return cadData.getIncident(incidentId).getGenInfo().getAlarm(); 1245 } else if (tag.equals(INC_GEN_INFO.AGY))1246 {1111 } 1112 else if(tag.equals(INC_GEN_INFO.AGY)){ 1247 1113 return cadData.getIncident(incidentId).getGenInfo().getAgy(); 1248 } else1249 {1114 } 1115 else{ 1250 1116 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncGenInfo"); 1251 1117 } … … 1254 1120 /** 1255 1121 * Set incidentId's field based on tag to value. 1256 * 1257 * @param tag a CADDataEnums tag 1258 * @param incidentId the incident's ID to look up 1259 * @throws RemoteException 1260 */ 1261 public void setCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId, String value) throws RemoteException 1262 { 1263 if (tag.equals(INC_GEN_INFO.JURISDICTION)) 1264 { 1122 * @param tag a CADDataEnums tag 1123 * @param incidentId the incident's ID to look up 1124 * @throws RemoteException 1125 */ 1126 public void setCadDataIncGenInfo(INC_GEN_INFO tag, int incidentId, String value) throws RemoteException{ 1127 if(tag.equals(INC_GEN_INFO.JURISDICTION)){ 1265 1128 cadData.getIncident(incidentId).getGenInfo().setJurisdiction(value); 1266 } else if (tag.equals(INC_GEN_INFO.ALARM))1267 {1129 } 1130 else if(tag.equals(INC_GEN_INFO.ALARM)){ 1268 1131 cadData.getIncident(incidentId).getGenInfo().setAlarm(value); 1269 } else if (tag.equals(INC_GEN_INFO.AGY))1270 {1132 } 1133 else if(tag.equals(INC_GEN_INFO.AGY)){ 1271 1134 cadData.getIncident(incidentId).getGenInfo().setAgy(value); 1272 } else1273 {1135 } 1136 else{ 1274 1137 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncGenInfo"); 1275 1138 } 1276 1139 } 1277 1140 1278 1141 /** 1279 1142 * Returns a string out of IncidentResponse based on tag. 1280 * 1281 * @param tag a CADDataEnums tag 1282 * @param incidentId the incident's ID to look up 1283 * @throws RemoteException 1284 */ 1285 public String getCadDataIncResp(INC_RESP tag, int incidentId) throws RemoteException 1286 { 1287 if (tag.equals(INC_RESP.PLAN)) 1288 { 1143 * @param tag a CADDataEnums tag 1144 * @param incidentId the incident's ID to look up 1145 * @throws RemoteException 1146 */ 1147 public String getCadDataIncResp(INC_RESP tag, int incidentId) throws RemoteException { 1148 if(tag.equals(INC_RESP.PLAN)){ 1289 1149 return cadData.getIncident(incidentId).getResponse().getPlan(); 1290 } else if (tag.equals(INC_RESP.AREA))1291 {1150 } 1151 else if(tag.equals(INC_RESP.AREA)){ 1292 1152 return cadData.getIncident(incidentId).getResponse().getArea(); 1293 } else1294 {1153 } 1154 else{ 1295 1155 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncResp"); 1296 1156 } 1297 1157 } 1298 1158 1299 1159 /** 1300 1160 * Set incidentId's field based on tag to value. 1301 * 1302 * @param tag a CADDataEnums tag 1303 * @param incidentId the incident's ID to look up 1304 * @throws RemoteException 1305 */ 1306 public void setCadDataIncResp(INC_RESP tag, int incidentId, String value) throws RemoteException 1307 { 1308 if (tag.equals(INC_RESP.PLAN)) 1309 { 1161 * @param tag a CADDataEnums tag 1162 * @param incidentId the incident's ID to look up 1163 * @throws RemoteException 1164 */ 1165 public void setCadDataIncResp(INC_RESP tag, int incidentId, String value) throws RemoteException{ 1166 if(tag.equals(INC_RESP.PLAN)){ 1310 1167 cadData.getIncident(incidentId).getResponse().setPlan(value); 1311 } else if (tag.equals(INC_RESP.AREA))1312 {1168 } 1169 else if(tag.equals(INC_RESP.AREA)){ 1313 1170 cadData.getIncident(incidentId).getResponse().setArea(value); 1314 } else1315 {1171 } 1172 else{ 1316 1173 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncResp"); 1317 1174 } … … 1320 1177 /** 1321 1178 * Returns a string out of IncidentAdditionalInfo based on tag. 1322 * 1323 * @param tag a CADDataEnums tag 1324 * @param incidentId the incident's ID to look up 1325 * @throws RemoteException 1326 */ 1327 public String getCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId) throws RemoteException 1328 { 1329 if (tag.equals(INC_ADD_INFO.TYPE)) 1330 { 1179 * @param tag a CADDataEnums tag 1180 * @param incidentId the incident's ID to look up 1181 * @throws RemoteException 1182 */ 1183 public String getCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId) throws RemoteException { 1184 if(tag.equals(INC_ADD_INFO.TYPE)){ 1331 1185 return cadData.getIncident(incidentId).getAdditionalInfo().getType(); 1332 } else if (tag.equals(INC_ADD_INFO.TYPE_CODE))1333 {1186 } 1187 else if(tag.equals(INC_ADD_INFO.TYPE_CODE)){ 1334 1188 return cadData.getIncident(incidentId).getAdditionalInfo().getTypeCode(); 1335 } else if (tag.equals(INC_ADD_INFO.MACHINE))1336 {1189 } 1190 else if(tag.equals(INC_ADD_INFO.MACHINE)){ 1337 1191 return cadData.getIncident(incidentId).getAdditionalInfo().getMachine(); 1338 } else if (tag.equals(INC_ADD_INFO.CALL_STATUS))1339 {1192 } 1193 else if(tag.equals(INC_ADD_INFO.CALL_STATUS)){ 1340 1194 return cadData.getIncident(incidentId).getAdditionalInfo().getCallStatus(); 1341 } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT))1342 {1195 } 1196 else if(tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)){ 1343 1197 return cadData.getIncident(incidentId).getAdditionalInfo().getCallTakerExt(); 1344 } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL))1345 {1198 } 1199 else if(tag.equals(INC_ADD_INFO.ALARM_LEVEL)){ 1346 1200 return cadData.getIncident(incidentId).getAdditionalInfo().getAlarmLevel(); 1347 } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA))1348 {1201 } 1202 else if(tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)){ 1349 1203 return cadData.getIncident(incidentId).getAdditionalInfo().getRotationProviderArea(); 1350 } else if (tag.equals(INC_ADD_INFO.COMMENT))1351 {1204 } 1205 else if(tag.equals(INC_ADD_INFO.COMMENT)){ 1352 1206 return cadData.getIncident(incidentId).getAdditionalInfo().getComment(); 1353 } else1354 {1207 } 1208 else{ 1355 1209 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncAddInfo"); 1356 1210 } … … 1359 1213 /** 1360 1214 * Set incidentId's field based on tag to value. 1361 * 1362 * @param tag a CADDataEnums tag 1363 * @param incidentId the incident's ID to look up 1364 * @throws RemoteException 1365 */ 1366 public void setCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId, String value) throws RemoteException 1367 { 1368 if (tag.equals(INC_ADD_INFO.TYPE)) 1369 { 1215 * @param tag a CADDataEnums tag 1216 * @param incidentId the incident's ID to look up 1217 * @throws RemoteException 1218 */ 1219 public void setCadDataIncAddInfo(INC_ADD_INFO tag, int incidentId, String value) throws RemoteException{ 1220 if(tag.equals(INC_ADD_INFO.TYPE)){ 1370 1221 cadData.getIncident(incidentId).getAdditionalInfo().setType(value); 1371 } else if (tag.equals(INC_ADD_INFO.TYPE_CODE))1372 {1222 } 1223 else if(tag.equals(INC_ADD_INFO.TYPE_CODE)){ 1373 1224 cadData.getIncident(incidentId).getAdditionalInfo().setTypeCode(value); 1374 } else if (tag.equals(INC_ADD_INFO.MACHINE))1375 {1225 } 1226 else if(tag.equals(INC_ADD_INFO.MACHINE)){ 1376 1227 cadData.getIncident(incidentId).getAdditionalInfo().setMachine(value); 1377 } else if (tag.equals(INC_ADD_INFO.CALL_STATUS))1378 {1228 } 1229 else if(tag.equals(INC_ADD_INFO.CALL_STATUS)){ 1379 1230 cadData.getIncident(incidentId).getAdditionalInfo().setCallStatus(value); 1380 } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT))1381 {1231 } 1232 else if(tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)){ 1382 1233 cadData.getIncident(incidentId).getAdditionalInfo().setCallTakerExt(value); 1383 } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL))1384 {1234 } 1235 else if(tag.equals(INC_ADD_INFO.ALARM_LEVEL)){ 1385 1236 cadData.getIncident(incidentId).getAdditionalInfo().setAlarmLevel(value); 1386 } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA))1387 {1237 } 1238 else if(tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)){ 1388 1239 cadData.getIncident(incidentId).getAdditionalInfo().setRotationProviderArea(value); 1389 } else if (tag.equals(INC_ADD_INFO.COMMENT))1390 {1240 } 1241 else if(tag.equals(INC_ADD_INFO.COMMENT)){ 1391 1242 cadData.getIncident(incidentId).getAdditionalInfo().setComment(value); 1392 } else1393 {1243 } 1244 else{ 1394 1245 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncAddInfo"); 1395 1246 } 1396 1247 } 1397 1248 1398 1249 /** 1399 1250 * Returns a string out of IncidentActivities based on tag. 1400 * 1401 * @param tag a CADDataEnums tag 1402 * @param incidentId the incident's ID to look up 1403 * @throws RemoteException 1404 */ 1405 public String getCadDataIncActivities(INC_ACTIVITIES tag, int incidentId) throws RemoteException 1406 { 1407 if (tag.equals(INC_ACTIVITIES.VEHICLE)) 1408 { 1251 * @param tag a CADDataEnums tag 1252 * @param incidentId the incident's ID to look up 1253 * @throws RemoteException 1254 */ 1255 public String getCadDataIncActivities(INC_ACTIVITIES tag, int incidentId) throws RemoteException { 1256 if(tag.equals(INC_ACTIVITIES.VEHICLE)){ 1409 1257 return cadData.getIncident(incidentId).getActivities().getVehicle(); 1410 } else if (tag.equals(INC_ACTIVITIES.ACTIVITY))1411 {1258 } 1259 else if(tag.equals(INC_ACTIVITIES.ACTIVITY)){ 1412 1260 return cadData.getIncident(incidentId).getActivities().getActivity(); 1413 } else if (tag.equals(INC_ACTIVITIES.LOCATION))1414 {1261 } 1262 else if(tag.equals(INC_ACTIVITIES.LOCATION)){ 1415 1263 return cadData.getIncident(incidentId).getActivities().getLocation(); 1416 } else if (tag.equals(INC_ACTIVITIES.COMMENT))1417 {1264 } 1265 else if(tag.equals(INC_ACTIVITIES.COMMENT)){ 1418 1266 return cadData.getIncident(incidentId).getActivities().getComment(); 1419 } else if (tag.equals(INC_ACTIVITIES.DISP))1420 {1267 } 1268 else if(tag.equals(INC_ACTIVITIES.DISP)){ 1421 1269 return cadData.getIncident(incidentId).getActivities().getDisp(); 1422 } else1423 {1270 } 1271 else{ 1424 1272 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncActivities"); 1425 1273 } … … 1428 1276 /** 1429 1277 * Set incidentId's field based on tag to value. 1430 * 1431 * @param tag a CADDataEnums tag 1432 * @param incidentId the incident's ID to look up 1433 * @throws RemoteException 1434 */ 1435 public void setCadDataIncActivities(INC_ACTIVITIES tag, int incidentId, String value) throws RemoteException 1436 { 1437 if (tag.equals(INC_ACTIVITIES.VEHICLE)) 1438 { 1278 * @param tag a CADDataEnums tag 1279 * @param incidentId the incident's ID to look up 1280 * @throws RemoteException 1281 */ 1282 public void setCadDataIncActivities(INC_ACTIVITIES tag, int incidentId, String value) throws RemoteException{ 1283 if(tag.equals(INC_ACTIVITIES.VEHICLE)){ 1439 1284 cadData.getIncident(incidentId).getActivities().setVehicle(value); 1440 } else if (tag.equals(INC_ACTIVITIES.ACTIVITY))1441 {1285 } 1286 else if(tag.equals(INC_ACTIVITIES.ACTIVITY)){ 1442 1287 cadData.getIncident(incidentId).getActivities().setActivity(value); 1443 } else if (tag.equals(INC_ACTIVITIES.LOCATION))1444 {1288 } 1289 else if(tag.equals(INC_ACTIVITIES.LOCATION)){ 1445 1290 cadData.getIncident(incidentId).getActivities().setLocation(value); 1446 } else if (tag.equals(INC_ACTIVITIES.COMMENT))1447 {1291 } 1292 else if(tag.equals(INC_ACTIVITIES.COMMENT)){ 1448 1293 cadData.getIncident(incidentId).getActivities().setComment(value); 1449 } else if (tag.equals(INC_ACTIVITIES.DISP))1450 {1294 } 1295 else if(tag.equals(INC_ACTIVITIES.DISP)){ 1451 1296 cadData.getIncident(incidentId).getActivities().setDisp(value); 1452 } else1453 {1297 } 1298 else{ 1454 1299 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncActivities"); 1455 1300 } 1456 1301 } 1457 1302 1458 1303 /** 1459 1304 * Returns a string out of IncidentCallback based on tag. 1460 * 1461 * @param tag a CADDataEnums tag 1462 * @param incidentId the incident's ID to look up 1463 * @throws RemoteException 1464 */ 1465 public String getCadDataIncCallBack(INC_CALLBACK tag, int incidentId) throws RemoteException 1466 { 1467 if (tag.equals(INC_CALLBACK.INITIAL)) 1468 { 1305 * @param tag a CADDataEnums tag 1306 * @param incidentId the incident's ID to look up 1307 * @throws RemoteException 1308 */ 1309 public String getCadDataIncCallBack(INC_CALLBACK tag, int incidentId) throws RemoteException { 1310 if(tag.equals(INC_CALLBACK.INITIAL)){ 1469 1311 return cadData.getIncident(incidentId).getCallBacks().getInitial(); 1470 } else if (tag.equals(INC_CALLBACK.COMMENT))1471 {1312 } 1313 else if(tag.equals(INC_CALLBACK.COMMENT)){ 1472 1314 return cadData.getIncident(incidentId).getCallBacks().getComment(); 1473 } else1474 {1315 } 1316 else{ 1475 1317 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCallBack"); 1476 1318 } … … 1479 1321 /** 1480 1322 * Returns a string out of IncidentEditLog based on tag. 1481 * 1482 * @param tag a CADDataEnums tag 1483 * @param incidentId the incident's ID to look up 1484 * @throws RemoteException 1485 */ 1486 public String getCadDataIncEditLog(INC_EDIT_LOG tag, int incidentId) throws RemoteException 1487 { 1488 if (tag.equals(INC_EDIT_LOG.EDIT)) 1489 { 1323 * @param tag a CADDataEnums tag 1324 * @param incidentId the incident's ID to look up 1325 * @throws RemoteException 1326 */ 1327 public String getCadDataIncEditLog(INC_EDIT_LOG tag, int incidentId) throws RemoteException { 1328 if(tag.equals(INC_EDIT_LOG.EDIT)){ 1490 1329 return cadData.getIncident(incidentId).getEditLog().getEdit(); 1491 } else if (tag.equals(INC_EDIT_LOG.REASON))1492 {1330 } 1331 else if(tag.equals(INC_EDIT_LOG.REASON)){ 1493 1332 return cadData.getIncident(incidentId).getEditLog().getReason(); 1494 } else if (tag.equals(INC_EDIT_LOG.CHANGE_BY))1495 {1333 } 1334 else if(tag.equals(INC_EDIT_LOG.CHANGE_BY)){ 1496 1335 return cadData.getIncident(incidentId).getEditLog().getChangeBy(); 1497 } else if (tag.equals(INC_EDIT_LOG.TERMINAL))1498 {1336 } 1337 else if(tag.equals(INC_EDIT_LOG.TERMINAL)){ 1499 1338 return cadData.getIncident(incidentId).getEditLog().getTerminal(); 1500 } else1501 {1339 } 1340 else{ 1502 1341 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncEditLog"); 1503 1342 } … … 1506 1345 /** 1507 1346 * Returns a string out of IncidentInfo based on tag. 1508 * 1509 * @param tag a CADDataEnums tag 1510 * @param incidentId the incident's ID to look up 1511 * @throws RemoteException 1512 */ 1513 public String getCadDataIncInfo(INC_INFO tag, int incidentId) throws RemoteException 1514 { 1515 if (tag.equals(INC_INFO.CALL_INITIATED)) 1516 { 1347 * @param tag a CADDataEnums tag 1348 * @param incidentId the incident's ID to look up 1349 * @throws RemoteException 1350 */ 1351 public String getCadDataIncInfo(INC_INFO tag, int incidentId) throws RemoteException { 1352 if(tag.equals(INC_INFO.CALL_INITIATED)){ 1517 1353 return cadData.getIncident(incidentId).getInfo().getCallInit(); 1518 } else if (tag.equals(INC_INFO.CALL_TAKEN))1519 {1354 } 1355 else if(tag.equals(INC_INFO.CALL_TAKEN)){ 1520 1356 return cadData.getIncident(incidentId).getInfo().getCallTaken(); 1521 } else if (tag.equals(INC_INFO.TIME_IN_Q))1522 {1357 } 1358 else if(tag.equals(INC_INFO.TIME_IN_Q)){ 1523 1359 return cadData.getIncident(incidentId).getInfo().getTimeInQ(); 1524 } else if (tag.equals(INC_INFO.LAST_UPDATED))1525 {1360 } 1361 else if(tag.equals(INC_INFO.LAST_UPDATED)){ 1526 1362 return cadData.getIncident(incidentId).getInfo().getLastUpdated(); 1527 } else1528 {1363 } 1364 else{ 1529 1365 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncInfo"); 1530 1366 } … … 1533 1369 /** 1534 1370 * Returns a string out of IncidentTimes based on tag. 1535 * 1536 * @param tag a CADDataEnums tag 1537 * @param incidentId the incident's ID to look up 1538 * @throws RemoteException 1539 */ 1540 public String getCadDataIncTimes(INC_TIMES tag, int incidentId) throws RemoteException 1541 { 1371 * @param tag a CADDataEnums tag 1372 * @param incidentId the incident's ID to look up 1373 * @throws RemoteException 1374 */ 1375 public String getCadDataIncTimes(INC_TIMES tag, int incidentId) throws RemoteException { 1542 1376 // TODO Auto-generated method stub 1543 1377 return null; 1544 1378 } 1545 1379 1546 1380 /** 1547 1381 * Returns a CardfileList matching the tag. 1548 1382 */ 1549 public CardfileList getCardfileList(CARDFILE tag) throws RemoteException 1550 { 1551 if (tag.equals(CARDFILE.COASTAL_DIVISION_UNITS)) 1552 { 1383 public CardfileList getCardfileList(CARDFILE tag) throws RemoteException{ 1384 if(tag.equals(CARDFILE.COASTAL_DIVISION_UNITS)){ 1553 1385 return cardfileData.getCoastalDivisionUnitList(); 1554 } else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER))1555 {1386 } 1387 else if(tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)){ 1556 1388 return cardfileData.getPoliceSheriffCoronerList(); 1557 } else if (tag.equals(CARDFILE.COURTS))1558 {1389 } 1390 else if(tag.equals(CARDFILE.COURTS)){ 1559 1391 return cardfileData.getCourtsList(); 1560 } else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION))1561 {1392 } 1393 else if(tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)){ 1562 1394 return cardfileData.getPublicTransportationList(); 1563 } else if (tag.equals(CARDFILE.GG_OTHER))1564 {1395 } 1396 else if(tag.equals(CARDFILE.GG_OTHER)){ 1565 1397 return cardfileData.getGgOtherList(); 1566 } else if (tag.equals(CARDFILE.MY_MISC))1567 {1398 } 1399 else if(tag.equals(CARDFILE.MY_MISC)){ 1568 1400 return cardfileData.getMyMiscList(); 1569 } else if (tag.equals(CARDFILE.SL_MISC))1570 {1401 } 1402 else if(tag.equals(CARDFILE.SL_MISC)){ 1571 1403 return cardfileData.getSlMiscList(); 1572 } else if (tag.equals(CARDFILE.VT_MISC))1573 {1404 } 1405 else if(tag.equals(CARDFILE.VT_MISC)){ 1574 1406 return cardfileData.getVlMiscList(); 1575 } else if (tag.equals(CARDFILE.CHP_OFFICES))1576 {1407 } 1408 else if(tag.equals(CARDFILE.CHP_OFFICES)){ 1577 1409 return cardfileData.getChpOfficesList(); 1578 } else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES))1579 {1410 } 1411 else if(tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)){ 1580 1412 return cardfileData.getStateAgenciesFacilitiesList(); 1581 } else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS))1582 {1413 } 1414 else if(tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)){ 1583 1415 return cardfileData.getGovernmentOfficialsList(); 1584 } else if (tag.equals(CARDFILE.FEDERAL_AGENCIES))1585 {1416 } 1417 else if(tag.equals(CARDFILE.FEDERAL_AGENCIES)){ 1586 1418 return cardfileData.getFederalAgenciesList(); 1587 } else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK))1588 {1419 } 1420 else if(tag.equals(CARDFILE.RANCHES_LIVESTOCK)){ 1589 1421 return cardfileData.getRanchesLivestockList(); 1590 } else if (tag.equals(CARDFILE.FIRE_EMS))1591 {1422 } 1423 else if(tag.equals(CARDFILE.FIRE_EMS)){ 1592 1424 return cardfileData.getFireEmsList(); 1593 } else if (tag.equals(CARDFILE.JAILS))1594 {1425 } 1426 else if(tag.equals(CARDFILE.JAILS)){ 1595 1427 return cardfileData.getJailsList(); 1596 } else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS))1597 {1428 } 1429 else if(tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)){ 1598 1430 return cardfileData.getHospitalsMedCentersList(); 1599 } else if (tag.equals(CARDFILE.TOW_COMPANIES))1600 {1431 } 1432 else if(tag.equals(CARDFILE.TOW_COMPANIES)){ 1601 1433 return cardfileData.getTowCompaniesList(); 1602 } else if (tag.equals(CARDFILE.CALTRANS))1603 {1434 } 1435 else if(tag.equals(CARDFILE.CALTRANS)){ 1604 1436 return cardfileData.getCalTransList(); 1605 } else if (tag.equals(CARDFILE.COUNTY_ROADS))1606 {1437 } 1438 else if(tag.equals(CARDFILE.COUNTY_ROADS)){ 1607 1439 return cardfileData.getCountyRoadsList(); 1608 } else if (tag.equals(CARDFILE.UTILITIES))1609 {1440 } 1441 else if(tag.equals(CARDFILE.UTILITIES)){ 1610 1442 return cardfileData.getUtilitiesList(); 1611 } else if (tag.equals(CARDFILE.ANIMAL_CONTROL))1612 {1443 } 1444 else if(tag.equals(CARDFILE.ANIMAL_CONTROL)){ 1613 1445 return cardfileData.getAnimalControlList(); 1614 } else if (tag.equals(CARDFILE.AIRPORTS))1615 {1446 } 1447 else if(tag.equals(CARDFILE.AIRPORTS)){ 1616 1448 return cardfileData.getAirportsList(); 1617 } else if (tag.equals(CARDFILE.CREDIT_CARDS))1618 {1449 } 1450 else if(tag.equals(CARDFILE.CREDIT_CARDS)){ 1619 1451 return cardfileData.getCreditCardsList(); 1620 } else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS))1621 {1452 } 1453 else if(tag.equals(CARDFILE.GG_CRISIS_SHELTERS)){ 1622 1454 return cardfileData.getGgCrisisSheltersList(); 1623 } else if (tag.equals(CARDFILE.RANGES))1624 {1455 } 1456 else if(tag.equals(CARDFILE.RANGES)){ 1625 1457 return cardfileData.getRangesList(); 1626 } else if (tag.equals(CARDFILE.HOTLINES))1627 {1458 } 1459 else if(tag.equals(CARDFILE.HOTLINES)){ 1628 1460 return cardfileData.getHotlinesList(); 1629 } else if (tag.equals(CARDFILE.HWY_PATROLS_OOS))1630 {1461 } 1462 else if(tag.equals(CARDFILE.HWY_PATROLS_OOS)){ 1631 1463 return cardfileData.getHwyPatrolsOosList(); 1632 } else if (tag.equals(CARDFILE.PARKS_RECREATION))1633 {1464 } 1465 else if(tag.equals(CARDFILE.PARKS_RECREATION)){ 1634 1466 return cardfileData.getParksRecreationList(); 1635 } else if (tag.equals(CARDFILE.SHELTERS))1636 {1467 } 1468 else if(tag.equals(CARDFILE.SHELTERS)){ 1637 1469 return cardfileData.getSheltersList(); 1638 } else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES))1639 {1470 } 1471 else if(tag.equals(CARDFILE.SL_COUNTY_SERVICES)){ 1640 1472 return cardfileData.getSlCountyServicesList(); 1641 } else if (tag.equals(CARDFILE.SL_RESOURCES))1642 {1473 } 1474 else if(tag.equals(CARDFILE.SL_RESOURCES)){ 1643 1475 return cardfileData.getSlResourcesList(); 1644 } else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR))1645 {1476 } 1477 else if(tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)){ 1646 1478 return cardfileData.getTruckTireRepairList(); 1647 } else if (tag.equals(CARDFILE.MCC_EMPLOYEES))1648 {1479 } 1480 else if(tag.equals(CARDFILE.MCC_EMPLOYEES)){ 1649 1481 return cardfileData.getMccEmployeesList(); 1650 } else if (tag.equals(CARDFILE.GATE_ACCESS_CODES))1651 {1482 } 1483 else if(tag.equals(CARDFILE.GATE_ACCESS_CODES)){ 1652 1484 return cardfileData.getGateAccessCodesList(); 1653 } else if (tag.equals(CARDFILE.VT_CALL_SIGNS))1654 {1485 } 1486 else if(tag.equals(CARDFILE.VT_CALL_SIGNS)){ 1655 1487 return cardfileData.getVtCallSignsList(); 1656 } else if (tag.equals(CARDFILE.SLCC_EMPLOYEES))1657 {1488 } 1489 else if(tag.equals(CARDFILE.SLCC_EMPLOYEES)){ 1658 1490 return cardfileData.getSlccEmployeesList(); 1659 } else1660 {1491 } 1492 else{ 1661 1493 throw new RemoteException("Wrong Enum sent into Coordinator.getCardfileList"); 1662 1494 } 1663 1495 } 1664 1665 /** 1666 * Receives the fields of the ChangeLog in Cardfile.java and uses those 1667 * fields to make changes to its own copy of the Cardfiledata. 1668 */ 1669 public void editCardfile(ChangeLog log) throws RemoteException 1670 { 1671 1496 1497 /** 1498 * Receives the fields of the ChangeLog in Cardfile.java and uses those fields 1499 * to make changes to its own copy of the Cardfiledata. 1500 */ 1501 public void editCardfile(ChangeLog log) throws RemoteException{ 1502 1672 1503 CardfileList selectedList; 1673 1674 if (log.listTitle.equals(CARDFILE.COASTAL_DIVISION_UNITS.tag)) 1675 { 1504 1505 if(log.listTitle.equals(CARDFILE.COASTAL_DIVISION_UNITS.tag)){ 1676 1506 selectedList = cardfileData.getCoastalDivisionUnitList(); 1677 } else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag))1678 {1507 } 1508 else if(log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)){ 1679 1509 selectedList = cardfileData.getPoliceSheriffCoronerList(); 1680 } else if (log.listTitle.equals(CARDFILE.COURTS.tag))1681 {1510 } 1511 else if(log.listTitle.equals(CARDFILE.COURTS.tag)){ 1682 1512 selectedList = cardfileData.getCourtsList(); 1683 } else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag))1684 {1513 } 1514 else if(log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)){ 1685 1515 selectedList = cardfileData.getPublicTransportationList(); 1686 } else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag))1687 {1516 } 1517 else if(log.listTitle.equals(CARDFILE.GG_OTHER.tag)){ 1688 1518 selectedList = cardfileData.getGgOtherList(); 1689 } else if (log.listTitle.equals(CARDFILE.MY_MISC.tag))1690 {1519 } 1520 else if(log.listTitle.equals(CARDFILE.MY_MISC.tag)){ 1691 1521 selectedList = cardfileData.getMyMiscList(); 1692 } else if (log.listTitle.equals(CARDFILE.SL_MISC.tag))1693 {1522 } 1523 else if(log.listTitle.equals(CARDFILE.SL_MISC.tag)){ 1694 1524 selectedList = cardfileData.getSlMiscList(); 1695 } else if (log.listTitle.equals(CARDFILE.VT_MISC.tag))1696 {1525 } 1526 else if(log.listTitle.equals(CARDFILE.VT_MISC.tag)){ 1697 1527 selectedList = cardfileData.getVlMiscList(); 1698 } else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag))1699 {1528 } 1529 else if(log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)){ 1700 1530 selectedList = cardfileData.getChpOfficesList(); 1701 } else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag))1702 {1531 } 1532 else if(log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)){ 1703 1533 selectedList = cardfileData.getStateAgenciesFacilitiesList(); 1704 } else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag))1705 {1534 } 1535 else if(log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)){ 1706 1536 selectedList = cardfileData.getGovernmentOfficialsList(); 1707 } else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag))1708 {1537 } 1538 else if(log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)){ 1709 1539 selectedList = cardfileData.getFederalAgenciesList(); 1710 } else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag))1711 {1540 } 1541 else if(log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)){ 1712 1542 selectedList = cardfileData.getRanchesLivestockList(); 1713 } else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag))1714 {1543 } 1544 else if(log.listTitle.equals(CARDFILE.FIRE_EMS.tag)){ 1715 1545 selectedList = cardfileData.getFireEmsList(); 1716 } else if (log.listTitle.equals(CARDFILE.JAILS.tag))1717 {1546 } 1547 else if(log.listTitle.equals(CARDFILE.JAILS.tag)){ 1718 1548 selectedList = cardfileData.getJailsList(); 1719 } else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag))1720 {1549 } 1550 else if(log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)){ 1721 1551 selectedList = cardfileData.getHospitalsMedCentersList(); 1722 } else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag))1723 {1552 } 1553 else if(log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)){ 1724 1554 selectedList = cardfileData.getTowCompaniesList(); 1725 } else if (log.listTitle.equals(CARDFILE.CALTRANS.tag))1726 {1555 } 1556 else if(log.listTitle.equals(CARDFILE.CALTRANS.tag)){ 1727 1557 selectedList = cardfileData.getCalTransList(); 1728 } else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag))1729 {1558 } 1559 else if(log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)){ 1730 1560 selectedList = cardfileData.getCountyRoadsList(); 1731 } else if (log.listTitle.equals(CARDFILE.UTILITIES.tag))1732 {1561 } 1562 else if(log.listTitle.equals(CARDFILE.UTILITIES.tag)){ 1733 1563 selectedList = cardfileData.getUtilitiesList(); 1734 } else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag))1735 {1564 } 1565 else if(log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)){ 1736 1566 selectedList = cardfileData.getAnimalControlList(); 1737 } else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag))1738 {1567 } 1568 else if(log.listTitle.equals(CARDFILE.AIRPORTS.tag)){ 1739 1569 selectedList = cardfileData.getAirportsList(); 1740 } else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag))1741 {1570 } 1571 else if(log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)){ 1742 1572 selectedList = cardfileData.getCreditCardsList(); 1743 } else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag))1744 {1573 } 1574 else if(log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)){ 1745 1575 selectedList = cardfileData.getGgCrisisSheltersList(); 1746 } else if (log.listTitle.equals(CARDFILE.RANGES.tag))1747 {1576 } 1577 else if(log.listTitle.equals(CARDFILE.RANGES.tag)){ 1748 1578 selectedList = cardfileData.getRangesList(); 1749 } else if (log.listTitle.equals(CARDFILE.HOTLINES.tag))1750 {1579 } 1580 else if(log.listTitle.equals(CARDFILE.HOTLINES.tag)){ 1751 1581 selectedList = cardfileData.getHotlinesList(); 1752 } else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag))1753 {1582 } 1583 else if(log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)){ 1754 1584 selectedList = cardfileData.getHwyPatrolsOosList(); 1755 } else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag))1756 {1585 } 1586 else if(log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)){ 1757 1587 selectedList = cardfileData.getParksRecreationList(); 1758 } else if (log.listTitle.equals(CARDFILE.SHELTERS.tag))1759 {1588 } 1589 else if(log.listTitle.equals(CARDFILE.SHELTERS.tag)){ 1760 1590 selectedList = cardfileData.getSheltersList(); 1761 } else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag))1762 {1591 } 1592 else if(log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)){ 1763 1593 selectedList = cardfileData.getSlCountyServicesList(); 1764 } else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag))1765 {1594 } 1595 else if(log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)){ 1766 1596 selectedList = cardfileData.getSlResourcesList(); 1767 } else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag))1768 {1597 } 1598 else if(log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)){ 1769 1599 selectedList = cardfileData.getTruckTireRepairList(); 1770 } else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag))1771 {1600 } 1601 else if(log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)){ 1772 1602 selectedList = cardfileData.getMccEmployeesList(); 1773 } else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag))1774 {1603 } 1604 else if(log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)){ 1775 1605 selectedList = cardfileData.getGateAccessCodesList(); 1776 } else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag))1777 {1606 } 1607 else if(log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)){ 1778 1608 selectedList = cardfileData.getVtCallSignsList(); 1779 } else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag))1780 {1609 } 1610 else if(log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)){ 1781 1611 selectedList = cardfileData.getSlccEmployeesList(); 1782 } else1783 {1612 } 1613 else{ 1784 1614 throw new RemoteException("Wrong Enum sent into Coordinator.editCardfileDataObject"); 1785 1615 } 1786 1616 1787 1617 CardfileDataObject cfdo = cardfileData.getCardfileDataObject(selectedList, log.id); 1788 if (cfdo != null && log.command.equals(EditCommand.NAME)) 1789 { 1618 if(cfdo != null && log.command.equals(EditCommand.NAME)){ 1790 1619 cfdo.setName(log.newValue); 1791 selectedList.resort(cardfileData.getCardfileDataIndex(selectedList, log.id));1792 } else if (cfdo != null && log.command.equals(EditCommand.ADDRESS))1793 {1620 selectedList.resort(cardfileData.getCardfileDataIndex(selectedList,log.id)); 1621 } 1622 else if(cfdo != null && log.command.equals(EditCommand.ADDRESS)){ 1794 1623 cfdo.setAddress(log.newValue); 1795 } else if (cfdo != null && log.command.equals(EditCommand.CITY))1796 {1624 } 1625 else if(cfdo != null && log.command.equals(EditCommand.CITY)){ 1797 1626 cfdo.setCity(log.newValue); 1798 } else if (cfdo != null && log.command.equals(EditCommand.STATE))1799 {1627 } 1628 else if(cfdo != null && log.command.equals(EditCommand.STATE)){ 1800 1629 cfdo.setState(log.newValue); 1801 } else if (cfdo != null && log.command.equals(EditCommand.ZIP))1802 {1630 } 1631 else if(cfdo != null && log.command.equals(EditCommand.ZIP)){ 1803 1632 cfdo.setZip(log.newValue); 1804 } else if (cfdo != null && log.command.equals(EditCommand.PHONE1))1805 {1633 } 1634 else if(cfdo != null && log.command.equals(EditCommand.PHONE1)){ 1806 1635 cfdo.setPhone1(log.newValue); 1807 } else if (cfdo != null && log.command.equals(EditCommand.PHONE2))1808 {1636 } 1637 else if(cfdo != null && log.command.equals(EditCommand.PHONE2)){ 1809 1638 cfdo.setPhone2(log.newValue); 1810 } else if (cfdo != null && log.command.equals(EditCommand.FAX))1811 {1639 } 1640 else if(cfdo != null && log.command.equals(EditCommand.FAX)){ 1812 1641 cfdo.setFax(log.newValue); 1813 } else if (log.command.equals(EditCommand.OBJECT_DELETE))1814 {1815 selectedList.removeDataObject(cardfileData.getCardfileDataIndex(selectedList, log.id));1816 } else if (log.command.equals(EditCommand.OBJECT_ADD))1817 {1642 } 1643 else if(log.command.equals(EditCommand.OBJECT_DELETE)){ 1644 selectedList.removeDataObject(cardfileData.getCardfileDataIndex(selectedList,log.id)); 1645 } 1646 else if(log.command.equals(EditCommand.OBJECT_ADD)){ 1818 1647 selectedList.addDataObject(log.newCardfileObject); 1819 } else if (log.command.equals(EditCommand.TABLE_ADD)) 1820 { 1821 if (cfdo != null) 1822 { 1823 cfdo.addComment(log.tableFields); 1648 } 1649 else if(log.command.equals(EditCommand.TABLE_ADD)){ 1650 if(cfdo != null){ 1651 cfdo.addComment(log.tableFields); 1824 1652 } 1825 } else if (log.command.equals(EditCommand.TABLE_DELETE)) 1826 { 1827 if (cfdo != null) 1828 { 1653 } 1654 else if(log.command.equals(EditCommand.TABLE_DELETE)){ 1655 if(cfdo != null){ 1829 1656 cfdo.removeComment(log.timeStamp); 1830 1657 } 1831 } else 1832 { 1833 } 1834 1835 1836 } 1837 1658 } 1659 else{ 1660 1661 } 1662 1663 1664 } 1665 1838 1666 /** 1839 1667 * Obtain a new unique ID for a cardfileDataObject. 1840 1668 */ 1841 public int obtainNewUniqueId() throws RemoteException 1842 { 1669 public int obtainNewUniqueId() throws RemoteException{ 1843 1670 return cardfileData.obtainNewUniqueId(); 1844 1671 } 1845 1672 1846 1673 /** 1847 1674 * Returns a value from Unit based on tag. 1848 *1849 1675 * @param unitNum the unitNum to look up 1850 * @throws RemoteException 1851 */ 1852 public UnitStatusEnums getCadDataUnitStatus(String unitNum) throws RemoteException 1853 { 1676 * @throws RemoteException 1677 */ 1678 public UnitStatusEnums getCadDataUnitStatus(String unitNum) throws RemoteException{ 1854 1679 return cadData.getUnit(unitNum).getUnitStatus(); 1855 1680 } 1856 1681 1857 1682 /** 1858 1683 * Returns a string field from Unit based on tag. 1859 *1860 1684 * @param tag a CADScriptTags tag 1861 1685 * @param unitNum the unitNum to look up … … 1863 1687 * @throws RemoteException 1864 1688 */ 1865 public String getCadDataUnitValue(String unitNum, UNIT_TAGS tag) throws RemoteException 1866 { 1867 if (tag.equals(UNIT_TAGS.MASTER_INC_NUM)) 1868 { 1689 public String getCadDataUnitValue(String unitNum, UNIT_TAGS tag) throws RemoteException{ 1690 if(tag.equals(UNIT_TAGS.MASTER_INC_NUM)){ 1869 1691 return cadData.getUnit(unitNum).getMasterInc(); 1870 } else if (tag.equals(UNIT_TAGS.STATUS))1871 {1692 } 1693 else if(tag.equals(UNIT_TAGS.STATUS)){ 1872 1694 return cadData.getUnit(unitNum).getStatus(); 1873 } else if (tag.equals(UNIT_TAGS.OOS))1874 {1695 } 1696 else if(tag.equals(UNIT_TAGS.OOS)){ 1875 1697 return cadData.getUnit(unitNum).getOos(); 1876 } else if (tag.equals(UNIT_TAGS.TYPE))1877 {1698 } 1699 else if(tag.equals(UNIT_TAGS.TYPE)){ 1878 1700 return cadData.getUnit(unitNum).getType(); 1879 } else if (tag.equals(UNIT_TAGS.CURR_LOC))1880 {1701 } 1702 else if(tag.equals(UNIT_TAGS.CURR_LOC)){ 1881 1703 return cadData.getUnit(unitNum).getCurrentLocation(); 1882 } else if (tag.equals(UNIT_TAGS.DESTINATION))1883 {1704 } 1705 else if(tag.equals(UNIT_TAGS.DESTINATION)){ 1884 1706 return cadData.getUnit(unitNum).getDestination(); 1885 } else if (tag.equals(UNIT_TAGS.MISC_INFO))1886 {1707 } 1708 else if(tag.equals(UNIT_TAGS.MISC_INFO)){ 1887 1709 return cadData.getUnit(unitNum).getMisc(); 1888 } else if (tag.equals(UNIT_TAGS.STACK))1889 {1710 } 1711 else if(tag.equals(UNIT_TAGS.STACK)){ 1890 1712 return cadData.getUnit(unitNum).getStack(); 1891 } else if (tag.equals(UNIT_TAGS.AREA))1892 {1713 } 1714 else if(tag.equals(UNIT_TAGS.AREA)){ 1893 1715 return cadData.getUnit(unitNum).getArea(); 1894 } else if (tag.equals(UNIT_TAGS.OFFICER))1895 {1716 } 1717 else if(tag.equals(UNIT_TAGS.OFFICER)){ 1896 1718 return cadData.getUnit(unitNum).getOfficer(); 1897 } else if (tag.equals(UNIT_TAGS.BADGE_NUM))1898 {1719 } 1720 else if(tag.equals(UNIT_TAGS.BADGE_NUM)){ 1899 1721 return cadData.getUnit(unitNum).getBadge(); 1900 } else if (tag.equals(UNIT_TAGS.TIMER))1901 {1722 } 1723 else if(tag.equals(UNIT_TAGS.TIMER)){ 1902 1724 return cadData.getUnit(unitNum).getTimerInString(); 1903 } else if (tag.equals(UNIT_TAGS.OFFICE))1904 {1725 } 1726 else if(tag.equals(UNIT_TAGS.OFFICE)){ 1905 1727 return cadData.getUnit(unitNum).getOffice(); 1906 } else if (tag.equals(UNIT_TAGS.P))1907 {1728 } 1729 else if(tag.equals(UNIT_TAGS.P)){ 1908 1730 return cadData.getUnit(unitNum).getP(); 1909 } else if (tag.equals(UNIT_TAGS.AGY))1910 {1731 } 1732 else if(tag.equals(UNIT_TAGS.AGY)){ 1911 1733 return cadData.getUnit(unitNum).getAgy(); 1912 } else if (tag.equals(UNIT_TAGS.ALIAS))1913 {1734 } 1735 else if(tag.equals(UNIT_TAGS.ALIAS)){ 1914 1736 return cadData.getUnit(unitNum).getAlias(); 1915 } else1916 {1737 } 1738 else{ 1917 1739 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataUnitValue"); 1918 1740 } … … 1921 1743 /** 1922 1744 * Sets a field from Unit based on tag. 1923 *1924 1745 * @param tag a CADScriptTags tag 1925 1746 * @param unitNum the unitNum to look up … … 1927 1748 * @throws RemoteException 1928 1749 */ 1929 public void setCadDataUnitValue(String unitNum, UNIT_TAGS tag, Object value) throws RemoteException 1930 { 1931 if (tag.equals(UNIT_TAGS.MASTER_INC_NUM)) 1932 { 1933 cadData.getUnit(unitNum).setMasterInc((String) value); 1934 } else if (tag.equals(UNIT_TAGS.STATUS)) 1935 { 1936 cadData.getUnit(unitNum).setStatus((String) value); 1937 } else if (tag.equals(UNIT_TAGS.OOS)) 1938 { 1939 cadData.getUnit(unitNum).setOos((String) value); 1940 } else if (tag.equals(UNIT_TAGS.TYPE)) 1941 { 1942 cadData.getUnit(unitNum).setType((String) value); 1943 } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 1944 { 1945 cadData.getUnit(unitNum).setCurrentLocation((String) value); 1946 } else if (tag.equals(UNIT_TAGS.DESTINATION)) 1947 { 1948 cadData.getUnit(unitNum).setDestination((String) value); 1949 } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 1950 { 1951 cadData.getUnit(unitNum).setMisc((String) value); 1952 } else if (tag.equals(UNIT_TAGS.STACK)) 1953 { 1954 cadData.getUnit(unitNum).setStack((String) value); 1955 } else if (tag.equals(UNIT_TAGS.AREA)) 1956 { 1957 cadData.getUnit(unitNum).setArea((String) value); 1958 } else if (tag.equals(UNIT_TAGS.OFFICER)) 1959 { 1960 cadData.getUnit(unitNum).setOfficer((String) value); 1961 } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 1962 { 1963 cadData.getUnit(unitNum).setBadge((String) value); 1964 } else if (tag.equals(UNIT_TAGS.UNIT_STATUS)) 1965 { 1966 cadData.getUnit(unitNum).setUnitStatus((UnitStatusEnums) value); 1967 } else if (tag.equals(UNIT_TAGS.OFFICE)) 1968 { 1969 cadData.getUnit(unitNum).setOffice((String) value); 1970 } else if (tag.equals(UNIT_TAGS.P)) 1971 { 1972 cadData.getUnit(unitNum).setP((String) value); 1973 } else if (tag.equals(UNIT_TAGS.AGY)) 1974 { 1975 cadData.getUnit(unitNum).setAgy((String) value); 1976 } else if (tag.equals(UNIT_TAGS.ALIAS)) 1977 { 1978 cadData.getUnit(unitNum).setAlias((String) value); 1979 } else 1980 { 1750 public void setCadDataUnitValue(String unitNum, UNIT_TAGS tag, Object value) throws RemoteException{ 1751 if(tag.equals(UNIT_TAGS.MASTER_INC_NUM)){ 1752 cadData.getUnit(unitNum).setMasterInc((String)value); 1753 } 1754 else if(tag.equals(UNIT_TAGS.STATUS)){ 1755 cadData.getUnit(unitNum).setStatus((String)value); 1756 } 1757 else if(tag.equals(UNIT_TAGS.OOS)){ 1758 cadData.getUnit(unitNum).setOos((String)value); 1759 } 1760 else if(tag.equals(UNIT_TAGS.TYPE)){ 1761 cadData.getUnit(unitNum).setType((String)value); 1762 } 1763 else if(tag.equals(UNIT_TAGS.CURR_LOC)){ 1764 cadData.getUnit(unitNum).setCurrentLocation((String)value); 1765 } 1766 else if(tag.equals(UNIT_TAGS.DESTINATION)){ 1767 cadData.getUnit(unitNum).setDestination((String)value); 1768 } 1769 else if(tag.equals(UNIT_TAGS.MISC_INFO)){ 1770 cadData.getUnit(unitNum).setMisc((String)value); 1771 } 1772 else if(tag.equals(UNIT_TAGS.STACK)){ 1773 cadData.getUnit(unitNum).setStack((String)value); 1774 } 1775 else if(tag.equals(UNIT_TAGS.AREA)){ 1776 cadData.getUnit(unitNum).setArea((String)value); 1777 } 1778 else if(tag.equals(UNIT_TAGS.OFFICER)){ 1779 cadData.getUnit(unitNum).setOfficer((String)value); 1780 } 1781 else if(tag.equals(UNIT_TAGS.BADGE_NUM)){ 1782 cadData.getUnit(unitNum).setBadge((String)value); 1783 } 1784 else if(tag.equals(UNIT_TAGS.UNIT_STATUS)){ 1785 cadData.getUnit(unitNum).setUnitStatus((UnitStatusEnums)value); 1786 } 1787 else if(tag.equals(UNIT_TAGS.OFFICE)){ 1788 cadData.getUnit(unitNum).setOffice((String)value); 1789 } 1790 else if(tag.equals(UNIT_TAGS.P)){ 1791 cadData.getUnit(unitNum).setP((String)value); 1792 } 1793 else if(tag.equals(UNIT_TAGS.AGY)){ 1794 cadData.getUnit(unitNum).setAgy((String)value); 1795 } 1796 else if(tag.equals(UNIT_TAGS.ALIAS)){ 1797 cadData.getUnit(unitNum).setAlias((String)value); 1798 } 1799 else{ 1981 1800 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataUnitValue"); 1982 1801 } 1983 1802 } 1984 1803 1985 1804 /** 1986 1805 * Assigns a unit to the specified incident. 1987 *1988 1806 * @param unitNum the unitNum to look up 1989 1807 * @param id the incident id that this unit is assigned to. 1990 1808 * @throws RemoteException 1991 1809 */ 1992 public void setCadDataUnitAssignedId(String unitNum, int id) throws RemoteException 1993 { 1810 public void setCadDataUnitAssignedId(String unitNum, int id) throws RemoteException{ 1994 1811 cadData.getUnit(unitNum).setAssignedIncidentId(id); 1995 1812 } 1996 1813 1997 1814 /** 1998 1815 * Adds a unit to the incident's list of assigned units. 1999 *2000 1816 * @param incidentId the incident 2001 1817 * @param assignedUnitNum the unit that's been assigned to the incident 2002 1818 * @throws RemoteException 2003 1819 */ 2004 public void addCadDataIncidentAssignedUnitNum(int incidentId, String assignedUnitNum) throws RemoteException 2005 { 1820 public void addCadDataIncidentAssignedUnitNum(int incidentId, String assignedUnitNum) throws RemoteException{ 2006 1821 cadData.getIncident(incidentId).addAssignedUnitNum(assignedUnitNum); 2007 1822 } 2008 1823 2009 1824 /** 2010 1825 * Sets the specified incident to the specified status. 2011 *2012 1826 * @param incidentId the incident 2013 1827 * @param status the status of the incident 2014 1828 * @throws RemoteException 2015 1829 */ 2016 public void setCadDataIncidentStatus(int incidentId, IncidentEnums status) throws RemoteException 2017 { 1830 public void setCadDataIncidentStatus(int incidentId, IncidentEnums status) throws RemoteException{ 2018 1831 cadData.getIncident(incidentId).setIncidentStatus(status); 2019 1832 } 2020 2021 /** 1833 1834 /** 2022 1835 * Returns a LinkedList containing entries that match the search string. 2023 *2024 1836 * @param search the string entry to be searched 2025 1837 * @return linked list of CardfileDataObjects matching search 2026 1838 */ 2027 public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException 2028 { 1839 public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException{ 2029 1840 return cardfileData.getSearchList(search); 2030 1841 } 2031 2032 /** 2033 * Updates the server database so clients can view additional informations 2034 * as events complete 2035 * 1842 1843 /** 1844 * Updates the server database so clients can view additional informations as events complete 2036 1845 * @param incidentNumber the incident in which the event occurred 2037 * @return completedEvent IncidentEvent with information to be added to 2038 * server database 2039 */ 2040 public void updateIncidentInGUI(Integer incidentNumber, IncidentEvent completedEvent) 2041 { 1846 * @return completedEvent IncidentEvent with information to be added to server database 1847 */ 1848 public void updateIncidentInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 2042 1849 updateDetailsInGUI(incidentNumber, completedEvent); 2043 1850 updateUnitsInGUI(incidentNumber, completedEvent); 2044 1851 } 2045 2046 /** 2047 * Updates the server database so clients can view details as events 2048 * complete 2049 * 1852 1853 /** 1854 * Updates the server database so clients can view details as events complete 2050 1855 * @param incidentNumber the incident in which the event occurred 2051 * @return completedEvent IncidentEvent with details to be added to server 2052 * database 2053 */ 2054 public void updateDetailsInGUI(Integer incidentNumber, IncidentEvent completedEvent) 2055 { 1856 * @return completedEvent IncidentEvent with details to be added to server database 1857 */ 1858 public void updateDetailsInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 2056 1859 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 2057 1860 DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 2058 for (int i = 0; i < completedEvent.eventInfo.getDetails().size(); i++) 2059 { 2060 String[] fields = 2061 { 2062 dateFormat.format(new Date()), 2063 timeFormat.format(new Date()), 2064 "", "", completedEvent.eventInfo.getDetails().elementAt(i).details 2065 }; 2066 2067 try 2068 { 1861 for(int i = 0; i < completedEvent.eventInfo.getDetails().size(); i++){ 1862 String[] fields = {dateFormat.format(new Date()), 1863 timeFormat.format(new Date()), 1864 "","",completedEvent.eventInfo.getDetails().elementAt(i).details}; 1865 1866 try{ 2069 1867 addCadDataIncidentTable(INC_TABLE.COMMENTS_NOTES, incidentNumber, fields); 2070 } catch (RemoteException e) 2071 { 1868 }catch(RemoteException e){ 2072 1869 e.printStackTrace(); 2073 } 2074 } 2075 } 2076 2077 /** 2078 * Updates the server database so clients can view unit updates as events 2079 * complete 2080 * 1870 } 1871 } 1872 } 1873 1874 /** 1875 * Updates the server database so clients can view unit updates as events complete 2081 1876 * @param incidentNumber the incident in which the event occurred 2082 * @return completedEvent IncidentEvent with unit updates to be added to 2083 * server database 2084 */ 2085 public void updateUnitsInGUI(Integer incidentNumber, IncidentEvent completedEvent) 2086 { 2087 for (int i = 0; i < completedEvent.eventInfo.getUnits().size(); i++) 2088 { 1877 * @return completedEvent IncidentEvent with unit updates to be added to server database 1878 */ 1879 public void updateUnitsInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 1880 for(int i = 0; i < completedEvent.eventInfo.getUnits().size(); i++){ 2089 1881 IncidentInquiryUnitsAssigned unit = completedEvent.eventInfo.getUnits().get(i); 2090 if (unit.statusType.equals("ENRT")) 2091 { 1882 if(unit.statusType.equals("ENRT")){ 2092 1883 cadData.unitAssignedToIncident(unit.beat, incidentNumber, unit.isPrimary); 2093 } else if (unit.statusType.equals("1097")) 2094 { 1884 }else if(unit.statusType.equals("1097")){ 2095 1885 cadData.unitArrivedAtIncidentScene(unit.beat, incidentNumber, unit.isPrimary); 2096 } else if (unit.statusType.equals("1098")) 2097 { 1886 }else if(unit.statusType.equals("1098")){ 2098 1887 cadData.unitAvailable(unit.beat); 2099 1888 } 2100 1889 } 2101 1890 } 2102 1891 2103 1892 /** 2104 1893 * Sets the specified incidentNumber to viewable in the GUI. 2105 *2106 1894 * @param incidentNumber the number of the Incident started 2107 1895 */ 2108 public void incidentStartedInGUI(Integer incidentNumber) 2109 { 1896 public void incidentStartedInGUI(Integer incidentNumber){ 2110 1897 Date date = new Date(); 2111 1898 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); -
/trunk/src/tmcsim/cadsimulator/viewer/CADSimulatorViewer.java
r24 r8 3 3 import java.awt.AWTEvent; 4 4 import java.awt.Dimension; 5 import java.awt.event.ActionEvent;6 import java.awt.event.KeyEvent;7 5 import java.awt.event.WindowEvent; 6 8 7 import javax.swing.JFrame; 9 8 import javax.swing.JMenu; … … 12 11 import javax.swing.JOptionPane; 13 12 import javax.swing.JTabbedPane; 14 import javax.swing.KeyStroke; 13 15 14 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 16 15 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; … … 21 20 22 21 /** 23 * This class provides a GUI to view current status information for the CAD24 * Simulator.22 * This class provides a GUI to view current status information for the 23 * CAD Simulator. 25 24 * 26 25 * @see SimulationStatusPanel 27 26 * @see MediaStatusPanel 28 * @author Matthew Cechini 27 * @author Matthew Cechini 29 28 * @version $Revision: 1.3 $ $Date: 2006/06/06 20:46:41 $ 30 29 */ 31 30 @SuppressWarnings("serial") 32 public class CADSimulatorViewer extends JFrame 33 { 31 public class CADSimulatorViewer extends JFrame { 34 32 35 /** 36 * Panel to display simulation information. 37 */ 33 /** Panel to display simulation information. */ 38 34 private SimulationStatusPanel simulationPanel; 39 /** 40 * Panel to display media control information. 41 */ 35 36 /** Panel to display media control information. */ 42 37 private MediaStatusPanel mediaPanel; 43 44 /** 45 * Constructor. 46 */ 47 public CADSimulatorViewer() 48 { 38 39 /** Constructor. */ 40 public CADSimulatorViewer() { 49 41 super("CAD Simulator"); 50 42 51 43 initComponents(); 52 } 53 54 /** 44 } 45 46 /** 55 47 * @see SimulationStatusPanel 56 48 */ 57 public void connectClient() 58 { 49 public void connectClient() { 59 50 simulationPanel.connectClient(); 60 51 } 61 62 /** 52 53 /** 63 54 * @see SimulationStatusPanel 64 55 */ 65 public void disconnectClient() 66 { 56 public void disconnectClient() { 67 57 simulationPanel.disconnectClient(); 68 58 } 69 70 /** 59 60 /** 71 61 * @see SimulationStatusPanel 72 62 */ 73 public void setSimManagerStatus(boolean connection) 74 { 75 simulationPanel.setSimManagerStatus(connection); 63 public void setSimManagerStatus(boolean connection) { 64 simulationPanel.setSimManagerStatus(connection); 76 65 } 77 78 /** 66 67 /** 79 68 * @see SimulationStatusPanel 80 69 */ 81 public void setTime(long seconds) 82 { 70 public void setTime(long seconds) { 83 71 simulationPanel.setTime(seconds); 84 72 } 85 73 86 /** 74 /** 87 75 * @see SimulationStatusPanel 88 76 */ 89 public void setScriptStatus(SCRIPT_STATUS newStatus) 90 { 91 simulationPanel.setScriptStatus(newStatus); 77 public void setScriptStatus(SCRIPT_STATUS newStatus) { 78 simulationPanel.setScriptStatus(newStatus); 79 } 80 81 /** 82 * @see SimulationStatusPanel 83 */ 84 public void setParamicsStatus(PARAMICS_STATUS newStatus) { 85 simulationPanel.setParamicsStatus(newStatus); 86 } 87 88 /** 89 * @see SimulationStatusPanel 90 */ 91 public void setParamicsNetworkLoaded(String networkID) { 92 simulationPanel.setParamicsNetworkLoaded(networkID); 92 93 } 93 94 94 /** 95 * @see SimulationStatusPanel 96 */ 97 public void setParamicsStatus(PARAMICS_STATUS newStatus) 98 { 99 simulationPanel.setParamicsStatus(newStatus); 100 } 101 102 /** 103 * @see SimulationStatusPanel 104 */ 105 public void setParamicsNetworkLoaded(String networkID) 106 { 107 simulationPanel.setParamicsNetworkLoaded(networkID); 108 } 109 110 /** 95 /** 111 96 * @see MediaStatusPanel 112 97 */ 113 public void updateDVDStatus(DVDStatusUpdate update) 114 { 98 public void updateDVDStatus(DVDStatusUpdate update) { 115 99 mediaPanel.updateDVDStatus(update); 116 100 } 117 101 118 /** 102 /** 119 103 * @see MediaStatusPanel 120 104 */ 121 public void updateDVDTitle(DVDTitleUpdate update) 122 { 105 public void updateDVDTitle(DVDTitleUpdate update) { 123 106 mediaPanel.updateDVDTitle(update); 124 107 } 125 108 126 109 /** 127 * Method calls the processEvent() method with a WINDOW_CLOSING WindowEvent128 * to start the application closing process.110 * Method calls the processEvent() method with a WINDOW_CLOSING 111 * WindowEvent to start the application closing process. 129 112 */ 130 public void closeViewer() 131 { 113 public void closeViewer() { 132 114 processEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING)); 133 115 } 134 116 135 117 /** 136 * Overloads the processEvent method. If the AWTEvent is a WINDOW_CLOSING137 * event, prompt the user to confirm the action. If confirmed, close the138 * application.118 * Overloads the processEvent method. If the AWTEvent is a 119 * WINDOW_CLOSING event, prompt the user to confirm the action. 120 * If confirmed, close the application. 139 121 */ 140 protected void processEvent(AWTEvent evt) 141 { 142 143 if (evt.getID() == WindowEvent.WINDOW_CLOSING) 144 { 122 protected void processEvent(AWTEvent evt) { 123 124 if(evt.getID() == WindowEvent.WINDOW_CLOSING) { 145 125 int option = JOptionPane.showConfirmDialog(null, 146 "Closing the CAD Simulator will stop the current " 147 +"simulation. Do you wish to continue exiting?",126 "Closing the CAD Simulator will stop the current " + 127 "simulation. Do you wish to continue exiting?", 148 128 "Confirm Exit", 149 129 JOptionPane.YES_NO_OPTION); 130 131 if(option != JOptionPane.NO_OPTION) { 132 System.exit(0); 133 } 134 } 135 } 136 137 /** Initialize GUI Components */ 138 private void initComponents() { 150 139 151 if (option != JOptionPane.NO_OPTION) 152 { 153 System.exit(0); 154 } 155 } 156 } 157 158 /** 159 * Initialize GUI Components 160 */ 161 private void initComponents() 162 { 163 164 140 165 141 simulationPanel = new SimulationStatusPanel(); 166 mediaPanel = new MediaStatusPanel();167 142 mediaPanel = new MediaStatusPanel(); 143 168 144 cadSimTabbedPane = new JTabbedPane(); 169 145 cadSimTabbedPane.addTab("Status", simulationPanel); 170 146 cadSimTabbedPane.addTab("Media", mediaPanel); 171 172 add(cadSimTabbedPane); 147 148 add(cadSimTabbedPane); 173 149 174 150 menubar = new JMenuBar(); 175 151 176 152 fileMenu = new JMenu("File"); 177 fileMenu.setMnemonic(KeyEvent.VK_F);178 153 menubar.add(fileMenu); 179 154 180 155 exitMenuItem = new JMenuItem(new ExitAction(this)); 181 exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(182 KeyEvent.VK_X, ActionEvent.ALT_MASK));183 156 fileMenu.add(exitMenuItem); 184 157 185 158 javax.swing.JMenu helpMenu = new javax.swing.JMenu("Help"); 186 159 javax.swing.JMenuItem aboutItem = new javax.swing.JMenuItem("About"); … … 196 169 helpMenu.add(aboutItem); 197 170 menubar.add(helpMenu); 198 171 199 172 setJMenuBar(menubar); 200 201 setPreferredSize(new Dimension(500, 575)); 173 174 setPreferredSize(new Dimension(500, 575)); 202 175 pack(); 203 176 setResizable(false); 204 177 } 178 179 205 180 private JTabbedPane cadSimTabbedPane; 181 206 182 private JMenuBar menubar; 183 207 184 private JMenu fileMenu; 185 208 186 private JMenuItem exitMenuItem; 187 209 188 } -
/trunk/src/tmcsim/cadsimulator/viewer/actions/ExitAction.java
r24 r2 2 2 3 3 import java.awt.event.ActionEvent; 4 4 5 import javax.swing.AbstractAction; 6 5 7 import tmcsim.cadsimulator.viewer.CADSimulatorViewer; 6 8 7 9 /** 8 * Abstract action to exit the CADSimulator. When the action is performed the9 * CADSimulatorView.closeViewer() method is called.10 * 10 * Abstract action to exit the CADSimulator. When the action is performed 11 * the CADSimulatorView.closeViewer() method is called. 12 * 11 13 * @author Matthew Cechini 12 * @version 14 * @version 13 15 */ 14 16 @SuppressWarnings("serial") 15 public class ExitAction extends AbstractAction 16 { 17 public class ExitAction extends AbstractAction { 17 18 18 /** 19 * Reference to the CADSimulatorViewer. 20 */ 19 /** Reference to the CADSimulatorViewer. */ 21 20 private CADSimulatorViewer theViewer; 22 21 23 public ExitAction(CADSimulatorViewer viewer) 24 { 22 public ExitAction(CADSimulatorViewer viewer) { 25 23 super("Exit"); 26 24 27 25 theViewer = viewer; 28 26 } 27 28 public void actionPerformed(ActionEvent arg0) { 29 theViewer.closeViewer(); 30 } 29 31 30 public void actionPerformed(ActionEvent arg0)31 {32 //theViewer.closeViewer();33 /* closeViewer() will prompt the user for confirmation.34 * 26 Apr 2016 I'm tired of seeing the confirmation message,35 * so if the user chooses File>Exit, assume they intend to exit36 * and don't ask for confirmation. If they click window close37 * button, they will still get the confirmation prompt. jdalbey38 */39 System.exit(0);40 }41 32 } -
/trunk/src/tmcsim/paramicscommunicator/ParamicsFileWriter.java
r25 r2 1 1 package tmcsim.paramicscommunicator; 2 2 3 3 4 import java.io.File; … … 10 11 import java.util.logging.Level; 11 12 import java.util.logging.Logger; 13 12 14 import org.apache.xml.serialize.OutputFormat; 13 15 import org.apache.xml.serialize.XMLSerializer; 14 16 import org.w3c.dom.Element; 17 15 18 import tmcsim.paramicscommunicator.FileIOUpdate.IO_TYPE; 16 19 17 20 /** 18 * The ParamicsFileWriter handles writing messages to a target file which is19 * read by Paramics.Messages are received through the writeMessage() method.21 * The ParamicsFileWriter handles writing messages to a target file which 22 * is read by Paramics. Messages are received through the writeMessage() method. 20 23 * This object handles queueing messages and writing as the file becomes 21 * available. New data is written to the target file when it has been modified22 * (cleared) by Paramics. If this does not happen, messages are queued and a23 * timer is used to periodically determine if the file has become available for24 * writing.25 * 24 * available. New data is written to the target file when it has been 25 * modified (cleared) by Paramics. If this does not happen, messages 26 * are queued and a timer is used to periodically determine if the 27 * file has become available for writing. 28 * 26 29 * @author Matthew Cechini 27 30 * @version 28 31 */ 29 public class ParamicsFileWriter extends Observable 30 { 31 32 /** 33 * Duration (in ms) that the TimerTask will be scheduled to retry writing to 34 * the target file. Default = 2000ms 32 public class ParamicsFileWriter extends Observable { 33 34 /** 35 * Duration (in ms) that the TimerTask will be scheduled to 36 * retry writing to the target file. Default = 2000ms 35 37 */ 36 38 private static long TIMER_DURATION = 2000; 37 /** 38 * Error Logger. 39 */ 39 40 /** Error Logger. */ 40 41 private Logger paramLogger = Logger.getLogger("tmcsim.paramicscommunicator"); 41 /** 42 * Linked List of messages that have been received 43 */ 42 43 /** Linked List of messages that have been received */ 44 44 private LinkedList<Element> queuedMessages = null; 45 /** 46 * 47 */ 45 46 /** */ 48 47 private String writerID = null; 49 /** 50 * File name of the file where data is written 51 */ 48 49 /** File name of the file where data is written */ 52 50 private String outputFile = null; 53 /** 54 * FileWriter used to write data to the output file. 55 */ 51 52 /** FileWriter used to write data to the output file. */ 56 53 private FileWriter fileWriter = null; 57 /** 58 * Value (seconds since 1/1/1970) of output file's last modifcation time 59 */ 60 private long lastModified = 0; 61 /** 62 * Timer used to schedule file writing tasks. 63 */ 54 55 /** Value (seconds since 1/1/1970) of output file's last modifcation time */ 56 private long lastModified = 0; 57 58 /** Timer used to schedule file writing tasks. */ 64 59 private Timer writerTimer = null; 65 /** 66 * Synchronizing lock to protect File IO and message queuing. 67 */ 68 private Object lock = null; 69 60 70 61 /** 71 62 * A TimerTask to retry writing messages that have been queued within this 72 * ParamicsWriter. If a message has been queued, see if the target file has 73 * been modified since last write. If so, write the first queued message to 74 * the file and remove the message from the queue. If writing is 75 * unsuccessful, do not remove the message from the queue. If there are no 76 * more messages in the queue, cancel this timer. 77 */ 78 private class WriterTimerTask extends TimerTask 79 { 80 81 public void run() 82 { 83 84 synchronized (lock) 85 { 86 paramLogger.log(Level.INFO, "ParamicsFileWriter, WriterTimerTask " 87 + "run() started, current queue size = " + queuedMessages.size()); 88 63 * ParamicsWriter. If a message has been queued, see if the target file 64 * has been modified since last write. If so, write the first queued message 65 * to the file and remove the message from the queue. If writing is unsuccessful, 66 * do not remove the message from the queue. If there are no more messages in 67 * the queue, cancel this timer. 68 */ 69 private class WriterTimerTask extends TimerTask { 70 public void run() { 71 72 synchronized(lock) { 73 89 74 //if we've queued something, continue. 90 if (queuedMessages.size() > 0) 91 { 92 75 if(queuedMessages.size() > 0) { 76 93 77 //if file has been modified, write to it 94 if (lastModified < new File(outputFile).lastModified()) 95 { 96 try 97 { 78 if(lastModified < new File(outputFile).lastModified()) 79 { 80 try { 98 81 writeToFile(queuedMessages.getFirst()); 99 82 queuedMessages.remove(0); 100 } catch (IOException ioe)101 {102 paramLogger.logp(Level.SEVERE, "ParamicsFileWriter.WriterTimerTask",103 "run()", "Exception in writing to the target file: "104 + outputFile + ". Queue size = " + queuedMessages.size(), ioe);105 83 } 106 84 catch (IOException ioe) { 85 paramLogger.logp(Level.SEVERE, "ParamicsFileWriter.WriterTimerTask", 86 "run()", "Exception in writing to the target file: " + 87 outputFile + ". Queue size = " + queuedMessages.size(), ioe); 88 } 89 107 90 //all queued messages gone, cancel timer 108 if (queuedMessages.size() == 0) 109 { 91 if(queuedMessages.size() == 0) 110 92 this.cancel(); 111 } 112 } 93 } 113 94 } 114 } 95 } 115 96 } 116 97 } 117 118 /** 119 * Constructor. Initialize data objects. If the target file exists, delete 120 * it, and then create a new file. 98 99 /** Synchronizing lock to protect File IO and message queuing. */ 100 private Object lock = null; 101 102 /** 103 * Constructor. Initialize data objects. If the target file exists, delete 104 * it, and then create a new file. 121 105 * 122 106 * @param workingDir Directory path where the output file is to be written 123 107 * @param mess The ParamicsCommMessage containing the outputFile filename. 124 108 */ 125 public ParamicsFileWriter(String id, String workingDir, String targetFile) 126 { 127 128 try 129 { 109 public ParamicsFileWriter(String id, String workingDir, String targetFile) { 110 111 try { 130 112 writerID = id; 131 132 queuedMessages = new LinkedList<Element>(); 133 lock = new Object(); 134 135 outputFile = workingDir + targetFile; 136 137 File tempFile = new File(outputFile); 138 if (tempFile.exists()) 139 { 113 114 queuedMessages = new LinkedList<Element>(); 115 lock = new Object(); 116 117 outputFile = workingDir + targetFile; 118 119 File tempFile = new File(outputFile); 120 if(tempFile.exists()) { 140 121 tempFile.delete(); 141 122 } 142 123 143 tempFile.createNewFile(); 144 145 writerTimer = new Timer(); 146 147 } catch (IOException ioe) 148 { 149 paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", "Constructor", 124 tempFile.createNewFile(); 125 126 writerTimer = new Timer(); 127 128 } catch (IOException ioe) { 129 paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", "Constructor", 150 130 "Unable to create Paramics File Writer.", ioe); 151 131 } 152 132 153 133 } 154 134 135 155 136 /** 156 137 * Method is called when a message has been received from the CAD Simulator. 157 * If the message queue is not empty, add the new message to the queue. If158 * the output file has not been modified (read) since last write, add the159 * message to the queue and set a timer to repeatedly check for modification160 * to the output file. Else, write the new message to the file. If there is161 * an error in writing the data, queue the message start a timer to retry162 * t he writing.138 * If the message queue is not empty, add the new message to the queue. 139 * If the output file has not been modified (read) since last write, 140 * add the message to the queue and set a timer to repeatedly check for 141 * modification to the output file. Else, write the new message to the file. 142 * If there is an error in writing the data, queue the message start a timer 143 * to retry the writing. 163 144 * 164 * @param newMessage The received message which is to be written to the 165 * output file. 166 */ 167 public void writeMessage(Element messageElem) 168 { 169 170 synchronized (lock) 171 { 172 paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 173 + "current queue size = " + queuedMessages.size()); 174 175 //messages already queued... get in line. 176 if (queuedMessages.size() > 0) 177 { 145 * @param newMessage The received message which is to be written to 146 * the output file. 147 */ 148 public void writeMessage(Element messageElem) { 149 150 synchronized(lock) { 151 152 //messages already queued... get in line. 153 if(queuedMessages.size() > 0) { 178 154 queuedMessages.add(messageElem); 179 155 180 paramLogger.log(Level.INFO, "Queueing message, new queue " 181 + "size = " + queuedMessages.size()); 182 } //No modification since last write. (first queue) 183 else if (lastModified >= new File(outputFile).lastModified()) 184 { 185 paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 186 + "adding msg to queue."); 187 queuedMessages.add(messageElem); 188 189 writerTimer.scheduleAtFixedRate(new WriterTimerTask(), 156 paramLogger.log(Level.INFO, "Queueing message, new queue " + 157 "size = " + queuedMessages.size()); 158 } 159 //No modification since last write. (first queue) 160 else if (lastModified >= new File(outputFile).lastModified()) { 161 queuedMessages.add(messageElem); 162 163 writerTimer.scheduleAtFixedRate(new WriterTimerTask(), 190 164 0L, TIMER_DURATION); 191 165 192 166 paramLogger.log(Level.INFO, "First message queued"); 193 } //free and clear, write. 194 else 195 { 196 paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage " 197 + "try to writeToFile" + outputFile); 198 try 199 { 167 } 168 //free and clear, write. 169 else { 170 try { 200 171 writeToFile(messageElem); 201 } catch (IOException ioe)202 {203 paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", 204 "writeMessage()", "Exception in writing to the " 205 +"target file: " + outputFile, ioe);206 172 } 173 catch(IOException ioe) { 174 paramLogger.logp(Level.SEVERE, "ParamicsFileWriter", 175 "writeMessage()", "Exception in writing to the " + 176 "target file: " + outputFile, ioe); 177 207 178 queuedMessages.add(messageElem); 208 209 writerTimer.scheduleAtFixedRate(new WriterTimerTask(), 179 180 writerTimer.scheduleAtFixedRate(new WriterTimerTask(), 210 181 0L, TIMER_DURATION); 211 182 } 212 paramLogger.log(Level.INFO, "ParamicsFileWriter, writeMessage "213 + "writeToFile succeeded.");214 183 } 215 184 } 216 185 } 217 186 218 187 /** 219 188 * Method writes data to the output file. 220 * 189 * 221 190 * @param output Data to be written to the file. 222 191 */ 223 private void writeToFile(Element output) throws IOException 224 { 225 192 private void writeToFile(Element output) throws IOException { 193 226 194 fileWriter = new FileWriter(outputFile); 227 228 OutputFormat of = new OutputFormat("XML", "ISO-8859-1",true);195 196 OutputFormat of = new OutputFormat("XML","ISO-8859-1",true); 229 197 of.setIndent(1); 230 198 of.setIndenting(true); 231 199 232 200 XMLSerializer serializer = new XMLSerializer(fileWriter, of); 233 201 serializer.asDOMSerializer(); 234 202 serializer.serialize(output); 235 203 236 /** 237 * Added by Nathaniel Lehrer 238 */ 239 try 240 { 204 /** Added by Nathaniel Lehrer */ 205 try { 241 206 java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream(); 242 207 new XMLSerializer(outputStream, of).serialize(output); 243 208 tmcsim.paramicslog.ParamicsLog.getInstance().writeToLog(outputStream.toString()); 244 } catch (Exception e) 245 { 209 } catch(Exception e) { 246 210 System.out.println(e); 247 211 } 248 /** 249 * End Add by Nathaniel Lehrer 250 */ 212 /** End Add by Nathaniel Lehrer */ 213 251 214 fileWriter.flush(); 252 215 fileWriter.close(); 253 254 lastModified = new File(outputFile).lastModified(); 255 216 217 lastModified = new File(outputFile).lastModified(); 218 256 219 setChanged(); 257 220 notifyObservers(new FileIOUpdate(IO_TYPE.WRITE, writerID, new File(outputFile).length())); 258 259 } 221 222 } 260 223 } -
/trunk/src/tmcsim/paramicscommunicator/ParamicsCommunicator.java
r26 r6 74 74 75 75 SOCKET_PORT("SocketPort"), 76 WORKING_DIR("WorkingDirectory"), 77 GUI_VISIBLE("GUIvisible"); 76 WORKING_DIR("WorkingDirectory"); 78 77 public String name; 79 78 … … 140 139 readers = new TreeMap<String, ParamicsFileReader>(); 141 140 141 theGUI = new ParamicsCommunicatorGUI(); 142 addObserver(theGUI); 143 theGUI.addWindowListener(new WindowListener() 144 { 145 public void windowActivated(WindowEvent arg0) 146 { 147 } 148 149 ; 150 public void windowClosed(WindowEvent arg0) 151 { 152 } 153 154 ; 155 public void windowClosing(WindowEvent arg0) 156 { 157 System.exit(0); 158 } 159 160 public void windowDeactivated(WindowEvent arg0) 161 { 162 } 163 164 ; 165 public void windowDeiconified(WindowEvent arg0) 166 { 167 } 168 169 ; 170 public void windowIconified(WindowEvent arg0) 171 { 172 } 173 174 ; 175 public void windowOpened(WindowEvent arg0) 176 { 177 } 178 ; 179 }); 180 142 181 try 143 182 { … … 208 247 } 209 248 210 // Should we display the GUI?211 String visibleProp = paramicsCommProp.getProperty(PROPERTIES.GUI_VISIBLE.name);212 // If no property was given, or if it was given and says True213 if (visibleProp == null || (visibleProp.toLowerCase().equals("true")))214 {215 theGUI = new ParamicsCommunicatorGUI(); // it sets itself visible216 addObserver(theGUI);217 theGUI.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);218 }219 249 220 250 try … … 329 359 330 360 /** 331 * Perform the action represented in XML document message received from the332 * CAD Simulator. First determine if the action is from a READER, WRITER,333 * and RESET. If the paramics action is REGISTER, add a new334 * ParamicsFileReader/Writer to the local list of readers/writers and update335 * the GUI with a FileRegUpdate object. If the paramics action is336 * UNREGISTER, remove the ParamicsFileReader/Writer from the local list of337 * readers/writers and update the GUI with a FileRegUpdate object. If RESET338 * is received, clearall readers and writers.361 * Perform the action represented in the received XML document message. 362 * First determine if the action is from a READER, WRITER, and RESET. If the 363 * paramics action is REGISTER, add a new ParamicsFileReader/Writer to the 364 * local list of readers/writers and update the GUI with a FileRegUpdate 365 * object. If the paramics action is UNREGISTER, remove the 366 * ParamicsFileReader/Writer from the local list of readers/writers and 367 * update the GUI with a FileRegUpdate object. If RESET is received, clear 368 * all readers and writers. 339 369 * 340 370 * @param mess Received XML document message. … … 452 482 } catch (SocketTimeoutException ste) 453 483 { 454 System.out.println("...waiting for socket connection from the CAD Simulator...");484 System.out.println("...waiting..."); 455 485 } catch (IOException ioe) 456 486 { -
/trunk/src/tmcsim/paramicscommunicator/ParamicsFileReader.java
r25 r6 80 80 public void run() 81 81 { 82 paramLogger.logp(Level.INFO, 83 "ParamicsFileReader.ReaderTimerTask", "run()", 84 "Waiting for " + inputFile + " to be modified."); 82 85 83 if (lastModified < inputFile.lastModified()) 86 84 { 87 paramLogger.logp(Level.INFO,88 "ParamicsFileReader.ReaderTimerTask", "run()",89 "Cool, " + inputFile + " has been modified, let's read it.");90 85 91 86 try … … 101 96 Element messageElem = readerDoc.createElement(PARAMICS_COMM_TAGS.MESSAGE.tag); 102 97 String fileContents = readFromFile(); 103 paramLogger.logp(Level.INFO,104 "ParamicsFileReader.ReaderTimerTask", "run()",105 "Nice, we read " + fileContents);106 98 messageElem.appendChild(readerDoc.createTextNode(fileContents)); 107 99 readerElem.appendChild(messageElem); -
/trunk/src/tmcsim/paramicscommunicator/gui/ParamicsCommunicatorGUI.java
r29 r6 11 11 import java.util.logging.LogRecord; 12 12 import java.util.logging.Logger; 13 14 13 import javax.swing.BorderFactory; 15 14 import javax.swing.Box; … … 21 20 import javax.swing.JTabbedPane; 22 21 import javax.swing.JTextArea; 23 24 22 import tmcsim.common.RevisionNumber; 25 23 import tmcsim.paramicscommunicator.FileIOUpdate; … … 209 207 this.setJMenuBar(menuBar); 210 208 211 file ReaderTabs = new JTabbedPane();212 file ReaderTabs.setAlignmentX(Box.CENTER_ALIGNMENT);213 file ReaderTabs.setMinimumSize(new Dimension(420, 480));214 file ReaderTabs.setPreferredSize(new Dimension(420, 480));215 file ReaderTabs.setMaximumSize(new Dimension(420, 480));216 file ReaderTabs.setBorder(BorderFactory.createCompoundBorder(209 fileIOTabs = new JTabbedPane(); 210 fileIOTabs.setAlignmentX(Box.CENTER_ALIGNMENT); 211 fileIOTabs.setMinimumSize(new Dimension(420, 480)); 212 fileIOTabs.setPreferredSize(new Dimension(420, 480)); 213 fileIOTabs.setMaximumSize(new Dimension(420, 480)); 214 fileIOTabs.setBorder(BorderFactory.createCompoundBorder( 217 215 BorderFactory.createTitledBorder( 218 BorderFactory.createRaisedBevelBorder(), "Registered Readers "), 219 BorderFactory.createEmptyBorder(5, 5, 5, 5))); 220 221 fileWriterTabs = new JTabbedPane(); 222 fileWriterTabs.setAlignmentX(Box.CENTER_ALIGNMENT); 223 fileWriterTabs.setMinimumSize(new Dimension(420, 480)); 224 fileWriterTabs.setPreferredSize(new Dimension(420, 480)); 225 fileWriterTabs.setMaximumSize(new Dimension(420, 480)); 226 fileWriterTabs.setBorder(BorderFactory.createCompoundBorder( 227 BorderFactory.createTitledBorder( 228 BorderFactory.createRaisedBevelBorder(), "Registered Writers "), 216 BorderFactory.createRaisedBevelBorder(), "Registered I/O"), 229 217 BorderFactory.createEmptyBorder(5, 5, 5, 5))); 230 218 … … 240 228 BorderFactory.createEmptyBorder(5, 5, 5, 5))); 241 229 242 Box tabbedBox = new Box(BoxLayout.X_AXIS); 243 tabbedBox.add(fileReaderTabs); 244 tabbedBox.add(fileWriterTabs); 245 230 246 231 Box guiBox = new Box(BoxLayout.Y_AXIS); 247 guiBox.add( tabbedBox);232 guiBox.add(fileIOTabs); 248 233 guiBox.add(Box.createVerticalStrut(10)); 249 234 guiBox.add(errorPane); … … 252 237 253 238 setMinimumSize(new Dimension(420, 680)); 254 setPreferredSize(new Dimension( 840, 680));239 setPreferredSize(new Dimension(420, 680)); 255 240 setResizable(false); 256 241 pack(); … … 275 260 case READ: 276 261 tabName = "Reader " + update.ioID; 277 fileReaderTabs.add(tabName, new ParamicsIOInfoPanel(update, model));278 262 break; 279 263 case WRITE: 280 264 tabName = "Writer " + update.ioID; 281 fileWriterTabs.add(tabName, new ParamicsIOInfoPanel(update, model));282 265 break; 283 266 } 284 267 285 } 286 287 private JTabbedPane fileReaderTabs; 288 private JTabbedPane fileWriterTabs; 268 fileIOTabs.add(tabName, new ParamicsIOInfoPanel(update, model)); 269 } 270 private JTabbedPane fileIOTabs; 289 271 private JScrollPane errorPane; 290 272 private JTextArea errorTA; -
/trunk/test/tmcsim/cadsimulator/CADSimulatorFixture.java
r26 r19 34 34 + "ATMSProperties = empty.txt\n" 35 35 + "MediaProperties = empty.txt\n"; 36 static final String configpData = "ParamicsCommHost= 192.168.251.45\n"36 static final String paramicsData = "ParamicsCommHost = 192.168.251.45\n" 37 37 + "ParamicsCommPort = 4450\n" 38 38 + "IncidentUpdateInterval = 30\n" … … 42 42 + "CameraStatusInterval = 30\n" 43 43 + "CameraStatusFile = camera_status.xml\n"; 44 static final String paramConfig = "SocketPort=4450\n"45 +"WorkingDirectory=.\nGUIvisible=false";46 44 static final String cardfileURL = "http://pastebin.com/raw/Yr26nfp7"; 47 45 static final String smallXMLURL = "http://pastebin.com/raw/Eqj2N5qD"; … … 60 58 System.setOut(ps); 61 59 writedata("config.txt", configData); 62 writedata("pconfig.txt", configpData); 63 writedata("pmcprops.txt", paramConfig); 60 writedata("pconfig.txt", paramicsData); 64 61 writedata("empty.txt", ""); 65 62 writeScriptfiles(); -
/trunk/IDE_metadata/Eclipse
- Property svn:ignore deleted
-
/trunk/IDE_metadata/Eclipse/build.xml
r30 r18 54 54 55 55 56 <echo message="Packaging TMC into a single JAR at ${deploy.jar}"/> 56 57 57 58 <delete dir="${deploy.dir}"/> 58 59 <mkdir dir="${deploy.dir}"/> 59 60 60 61 <jar destfile="${deploy.dir}/temp_final.jar" filesetmanifest="skip"> 62 <zipgroupfileset dir="${workdir}/lib" includes="xercesImpl.jar"/> 63 64 <manifest> 65 <attribute name="Main-Class" value="${main.class}"/> 66 </manifest> 67 </jar> 68 69 <zip destfile="${deploy.jar}"> 70 <zipfileset src="${deploy.dir}/temp_final.jar" 71 excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/> 72 </zip> 73 74 <delete file="${deploy.dir}/temp_final.jar"/> 75 61 76 <!-- *** Build CAD Server Only Jar *** --> 62 77 <jar destfile="${deploy.dir}/CADserver.jar" -
/trunk/IDE_metadata/NetBeans/TMCSim/build.xml
r23 r20 131 131 </jar> 132 132 </target> 133 134 <target description="Build separate jar files for each component of the TMC system."135 name="ZipForInstall" depends="package-jars">136 <!-- Notes: Create a zip file with jars and all external resources for distributing137 to other machines.138 Zip the Jar files.139 Zip folders for config, images, audio, scripts.140 Write .bat files and .bash files to launch each app. Put these in root folder.141 Zip it all up!142 -->143 </target>144 145 133 <!-- 146 134 -
/trunk/config/paramics_communicator_logging.properties
r21 r14 16 16 17 17 LogFile = paramics_communication_log.xml 18 19 # Set properties for 2016 --jd20 LogFile=C:\\paramics_communicator.log21 # Ethernet cable in operator room22 #CADSimulatorHost=192.168.251.11923 # PC1 in operator room (Service Tag BHLLD42)24 CADSimulatorHost=192.168.251.11625 # Virtual Host: TMCSIM Manager26 #CADSimulatorHost=192.168.251.8827 # For local testing28 18 CADSimulatorHost = 127.0.0.1 29 30 CADSimulatorRMIPort=4445 31 #CADSimulatorRMIPort = 4450 19 CADSimulatorRMIPort = 4450 -
/trunk/config/cad_simulator_paramics_config.properties
r21 r14 1 ParamicsCommHost = 192.168.251.451 #ParamicsCommHost = 192.168.251.45 2 2 # For development testing 3 #ParamicsCommHost = 127.0.0.13 ParamicsCommHost = 127.0.0.1 4 4 ParamicsCommPort = 4450 5 5 IncidentUpdateInterval = 30
Note: See TracChangeset
for help on using the changeset viewer.
