Changeset 27 in tmcsimulator
- Timestamp:
- 04/26/2016 08:07:52 PM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/tmcsim/cadsimulator/Coordinator.java (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/cadsimulator/Coordinator.java
r2 r27 1 2 1 package tmcsim.cadsimulator; 3 2 4 import java.awt.List;5 3 import java.io.File; 6 4 import java.rmi.RemoteException; … … 16 14 import java.util.logging.Level; 17 15 import java.util.logging.Logger; 18 19 import javax.swing.JList;20 import javax.swing.Timer;21 16 import javax.swing.table.DefaultTableModel; 22 17 import javax.xml.parsers.SAXParserFactory; 23 24 18 import tmcsim.cadmodels.CADRoutedMessage; 25 19 import tmcsim.cadmodels.CMSInfo; … … 43 37 import tmcsim.client.cadclientgui.data.Incident; 44 38 import tmcsim.client.cadclientgui.data.IncidentEvent; 45 import tmcsim.client.cadclientgui.enums.CADDataEnums.*; 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; 46 55 import tmcsim.client.cadclientgui.enums.CADScriptTags.UNIT_TAGS; 47 56 import tmcsim.client.cadclientgui.enums.IncidentEnums; 48 57 import tmcsim.client.cadclientgui.enums.UnitStatusEnums; 49 import tmcsim.c lient.cadclientgui.screens.ScreenManager;50 import tmcsim.common.C CTVInfo;58 import tmcsim.common.CADEnums.PARAMICS_STATUS; 59 import tmcsim.common.CADEnums.SCRIPT_STATUS; 51 60 import tmcsim.common.ObserverMessage; 52 61 import tmcsim.common.ScriptException; 53 62 import tmcsim.common.SimulationException; 54 63 import tmcsim.common.XMLIncident; 55 import tmcsim.common.CADEnums.PARAMICS_STATUS;56 import tmcsim.common.CADEnums.SCRIPT_STATUS;57 64 import tmcsim.interfaces.CADClientInterface; 58 65 import tmcsim.interfaces.CoordinatorInterface; … … 60 67 61 68 /** 62 * Coordinator is used to control and manage interactions between all CAD 63 * Simulator Managers. The Coordinator is also registered as an RMI Object64 * to allow remote control and access to simulation data. A69 * Coordinator is used to control and manage interactions between all CAD 70 * Simulator Managers. The Coordinator is also registered as an RMI Object to 71 * allow remote control and access to simulation data. A 65 72 * SimulationManagerInterface Object is used to provide communication to a 66 * remotely connected SimulationManager. Observers may register with the73 * remotely connected SimulationManager. Observers may register with the 67 74 * Coordinator to listen for simulation data updates. 68 75 * … … 73 80 * @see SimulationControlManager 74 81 * @author Matthew Cechini 75 * @version 82 * @version 76 83 */ 77 84 @SuppressWarnings("serial") 78 85 public class Coordinator extends UnicastRemoteObject 79 implements CoordinatorInterface { 80 81 /** Error logger. */ 86 implements CoordinatorInterface 87 { 88 89 /** 90 * Error logger. 91 */ 82 92 private Logger coorLogger = Logger.getLogger("tmcsim.cadsimulator"); 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. 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. 87 96 * Therefore, the list is managed manually. 88 97 */ 89 98 private Vector<Observer> observerList = null; 90 91 /**92 * Interface object for RMI communication with the Simulation Manager. Only one Simulation Manager93 * may be connected at a time. When there is noconnected Manager, this object is set to null.99 /** 100 * Interface object for RMI communication with the Simulation Manager. Only 101 * one Simulation Manager may be connected at a time. When there is no 102 * connected Manager, this object is set to null. 94 103 */ 95 104 private static SimulationManagerInterface managerInt = null; 96 97 105 private static LinkedList<CADClientInterface> clientList; 98 99 106 private static CADData cadData; 100 101 107 private static CardfileData cardfileData; 102 103 /** 104 * Constructor. Call UnicastRemoteObject constructor and call108 109 /** 110 * Constructor. Call UnicastRemoteObject constructor and call 105 111 * initializeSimulation. 106 112 * 107 113 * @throws RemoteException 108 114 */ 109 public Coordinator() throws RemoteException { 115 public Coordinator() throws RemoteException 116 { 110 117 super(); 111 118 clientList = new LinkedList<CADClientInterface>(); 112 119 cadData = new CADData(); 113 cardfileData = new CardfileData(); 114 try { 120 cardfileData = new CardfileData(); 121 try 122 { 115 123 CardfileReader cfr = new CardfileReader("scripts/Cardfile.xml", cardfileData); 116 } catch (Exception e) { 124 } catch (Exception e) 125 { 117 126 System.out.println("Could not load cardfile script"); 118 127 } 119 128 120 129 observerList = new Vector<Observer>(); 121 130 } 122 123 public void registerForCallback(CADClientInterface client) throws RemoteException{ 131 132 public void registerForCallback(CADClientInterface client) throws RemoteException 133 { 124 134 clientList.add(client); 125 135 CADSimulator.theViewer.connectClient(); 126 } 127 128 public void unregisterForCallback(CADClientInterface client) throws RemoteException{ 136 } 137 138 public void unregisterForCallback(CADClientInterface client) throws RemoteException 139 { 129 140 clientList.remove(client); 130 141 CADSimulator.theViewer.disconnectClient(); 131 142 } 132 133 public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException{ 143 144 public void registerForCallback(SimulationManagerInterface simManInt) throws RemoteException 145 { 134 146 managerInt = simManInt; 135 147 CADSimulator.theViewer.setSimManagerStatus(true); 136 } 137 138 public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException { 148 } 149 150 public void unregisterForCallback(SimulationManagerInterface simManInt) throws RemoteException 151 { 139 152 managerInt = null; 140 153 CADSimulator.theViewer.setSimManagerStatus(false); 141 } 142 143 public void startSimulation() throws RemoteException, ScriptException { 144 145 if(!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 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 { 146 163 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 147 else if(CADSimulator.theParamicsSimMgr.isConnected()) { 148 Runnable startRun = new Runnable() { 149 public void run() { 150 try { 164 } else if (CADSimulator.theParamicsSimMgr.isConnected()) 165 { 166 Runnable startRun = new Runnable() 167 { 168 public void run() 169 { 170 try 171 { 151 172 setScriptStatus(SCRIPT_STATUS.ATMS_SYNCHRONIZATION); 152 173 153 174 long currentATMSTime = CADSimulator.theATMSMgr.getCurrentTime(); 154 long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000);155 156 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 157 "Sleeping for " + sleepTime /1000 + " seconds.");175 long sleepTime = ((60 * 1000) - (currentATMSTime % (60 * 1000))) % (30 * 1000); 176 177 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation", 178 "Sleeping for " + sleepTime / 1000 + " seconds."); 158 179 Thread.sleep(sleepTime); 159 160 //currentATMSTime += sleepTime; 161 //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 162 } 163 catch (Exception e){180 181 //currentATMSTime += sleepTime; 182 //ParamicsCommunicator.getInstance().serverTime.setTimeInMillis(currentATMSTime); 183 } catch (Exception e) 184 { 164 185 setScriptStatus(SCRIPT_STATUS.SCRIPT_RUNNING); 165 166 coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 186 187 coorLogger.logp(Level.SEVERE, "Coordinator", "StartSimulation:run", 167 188 "Unable to connect to ATMS server.", e); 168 } 169 finally{189 } finally 190 { 170 191 CADSimulator.theSimulationCntrlMgr.startSimulation(); 171 192 CADSimulator.theParamicsSimMgr.startSimulation(); 172 CADSimulator.theSoundPlayer.setAudioEnabled(true); 193 CADSimulator.theSoundPlayer.setAudioEnabled(true); 194 coorLogger.logp(Level.INFO, "Coordinator", "StartSimulation:run", 195 "Simulation has started."); 173 196 } 174 197 } 175 198 }; 176 199 177 200 Thread startThread = new Thread(startRun); 178 201 startThread.start(); 179 } 180 else{202 } else 203 { 181 204 CADSimulator.theSimulationCntrlMgr.startSimulation(); 182 205 CADSimulator.theSoundPlayer.setAudioEnabled(true); 183 206 } 184 207 } 185 186 187 public void pauseSimulation() throws RemoteException {208 209 public void pauseSimulation() throws RemoteException 210 { 188 211 CADSimulator.theSimulationCntrlMgr.pauseSimulation(); 189 212 CADSimulator.theSoundPlayer.setAudioEnabled(false); 190 213 } 191 192 193 public void resetSimulation() throws RemoteException {194 214 215 public void resetSimulation() throws RemoteException 216 { 217 195 218 CADSimulator.theIncidentMgr.resetIncidents(); 196 219 cadData.resetSimulation(); 197 220 198 221 CADSimulator.theSoundPlayer.setAudioEnabled(false); 199 222 CADSimulator.theSoundPlayer.deQueueAll(); 200 223 201 224 CADSimulator.theViewer.setTime(0); 202 225 203 226 setScriptStatus(SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED); 204 227 205 228 CMSDiversionDB.getInstance().resetDiversions(); 206 229 207 230 CADSimulator.theSimulationCntrlMgr.resetSimulation(); 208 231 CADSimulator.theParamicsSimMgr.resetSimulation(); 209 210 notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null)); 211 212 } 213 214 215 public void gotoSimulationTime(final long newSimTime) throws RemoteException{216 232 233 notifyObservers(new ObserverMessage(ObserverMessage.messageType.RESET_SIMULATION, null)); 234 235 } 236 237 public void gotoSimulationTime(final long newSimTime) throws RemoteException 238 { 239 217 240 boolean audioWasEnabled = CADSimulator.theSoundPlayer.getAudioEnabled(); 218 241 219 242 CADSimulator.theSoundPlayer.setAudioEnabled(false); 220 221 long tempTime = 0; 222 while(tempTime < newSimTime) { 243 244 long tempTime = 0; 245 while (tempTime < newSimTime) 246 { 223 247 tempTime++; 224 248 225 249 CADSimulator.theIncidentMgr.tick(tempTime); 226 } 250 } 227 251 CADSimulator.theSoundPlayer.setAudioEnabled(audioWasEnabled); 228 252 229 253 230 254 CADSimulator.theSimulationCntrlMgr.gotoSimulationTime(newSimTime); 231 232 Runnable gotoRun = new Runnable() { 233 234 public void run() { 255 256 Runnable gotoRun = new Runnable() 257 { 258 public void run() 259 { 235 260 CADSimulator.theViewer.setTime(newSimTime); 236 237 if(managerInt != null) { 238 try { 261 262 if (managerInt != null) 263 { 264 try 265 { 239 266 managerInt.tick(newSimTime); 240 } 241 catch (RemoteException re){267 } catch (RemoteException re) 268 { 242 269 //Simulation Manager has disappeared 243 270 managerInt = null; 244 271 CADSimulator.theViewer.setSimManagerStatus(false); 245 246 coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", 272 273 coorLogger.logp(Level.SEVERE, "Coordinator", "gotoSimulationTime:run", 247 274 "Connection to Simulation Manager has been dropped.", re); 248 275 } 249 276 } 250 } 277 } 251 278 }; 252 279 253 280 Thread gotoThread = new Thread(gotoRun); 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() { 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 { 268 296 269 297 CADSimulator.theViewer.setScriptStatus(status); 270 271 if(managerInt != null) { 272 try { 298 299 if (managerInt != null) 300 { 301 try 302 { 273 303 managerInt.setScriptStatus(status); 274 } 275 catch (RemoteException re){304 } catch (RemoteException re) 305 { 276 306 //Simulation Manager has disappeared 277 307 managerInt = null; 278 308 CADSimulator.theViewer.setSimManagerStatus(false); 279 309 280 coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", 310 coorLogger.logp(Level.SEVERE, "Coordinator", "setScriptStatus:run", 281 311 "Connection to Simulation Manager has been dropped.", re); 282 } 312 } 283 313 } 284 314 } 285 315 }; 286 316 287 317 Thread updateThread = new Thread(updateRun); 288 318 updateThread.start(); 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() { 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 { 300 332 CADSimulator.theViewer.setParamicsStatus(status); 301 302 if(managerInt != null) { 303 try { 333 334 if (managerInt != null) 335 { 336 try 337 { 304 338 managerInt.setParamicsStatus(status); 305 } 306 catch (RemoteException re){339 } catch (RemoteException re) 340 { 307 341 //Simulation Manager has disappeared 308 342 managerInt = null; 309 343 CADSimulator.theViewer.setSimManagerStatus(false); 310 344 311 coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 345 coorLogger.logp(Level.SEVERE, "Coordinator", "setParamicsStatus:run", 312 346 "Connection to Simulation Manager has been dropped.", re); 313 } 314 } 315 } 347 } 348 } 349 } 316 350 }; 317 351 318 352 Thread updateThread = new Thread(updateRun); 319 updateThread.start(); 320 321 } 322 323 public void connectToParamics() throws RemoteException { 353 updateThread.start(); 354 355 } 356 357 public void connectToParamics() throws RemoteException 358 { 324 359 CADSimulator.theParamicsSimMgr.connectToParamics(); 325 360 } 326 public void disconnectFromParamics() throws RemoteException { 361 362 public void disconnectFromParamics() throws RemoteException 363 { 327 364 CADSimulator.theParamicsSimMgr.disconnectFromParamics(); 328 365 } 329 330 public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException { 366 367 public void loadParamicsNetwork(int networkID) throws RemoteException, SimulationException 368 { 331 369 CADSimulator.theParamicsSimMgr.loadParamicsNetwork(networkID); 332 } 333 334 public PARAMICS_STATUS getParamicsStatus() throws RemoteException { 370 } 371 372 public PARAMICS_STATUS getParamicsStatus() throws RemoteException 373 { 335 374 return CADSimulator.theParamicsSimMgr.getParamicsStatus(); 336 375 } 337 338 public int getParamicsNetworkLoaded() throws RemoteException { 376 377 public int getParamicsNetworkLoaded() throws RemoteException 378 { 339 379 return CADSimulator.theParamicsSimMgr.getParamicsNetworkLoaded(); 340 380 } 341 381 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()) 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 { 349 392 throw new ScriptException(ScriptException.SIM_NOT_STARTED); 350 else if(!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 393 } else if (!CADSimulator.theIncidentMgr.areIncidentsLoaded()) 394 { 351 395 throw new ScriptException(ScriptException.NO_SCRIPT_LOADED); 352 353 CADSimulator.theIncidentMgr.triggerIncident(incidentNumber, 396 } 397 398 CADSimulator.theIncidentMgr.triggerIncident(incidentNumber, 354 399 CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()); 355 400 } 356 357 public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException { 401 402 public void deleteIncident(Integer incidentNumber) throws RemoteException, ScriptException 403 { 358 404 CADSimulator.theIncidentMgr.deleteIncident(incidentNumber); 359 360 if(CADSimulator.theIncidentMgr.getIncidentList().size() == 0) { 405 406 if (CADSimulator.theIncidentMgr.getIncidentList().size() == 0) 407 { 361 408 setScriptStatus(SCRIPT_STATUS.NO_SCRIPT); 362 409 } 363 364 if(managerInt != null) { 365 try { 410 411 if (managerInt != null) 412 { 413 try 414 { 366 415 managerInt.incidentRemoved(incidentNumber); 367 } 368 catch (RemoteException re){416 } catch (RemoteException re) 417 { 369 418 //Simulation Manager has disappeared 370 419 managerInt = null; 371 420 CADSimulator.theViewer.setSimManagerStatus(false); 372 421 373 coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", 422 coorLogger.logp(Level.SEVERE, "Coordinator", "deleteIncident", 374 423 "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()) { 424 } 425 } 426 } 427 428 public void rescheduleIncident(Integer incidentNumber, long newTime) 429 throws RemoteException, ScriptException 430 { 431 432 if (newTime < CADSimulator.theSimulationCntrlMgr.getCurrentSimTime()) 433 { 383 434 throw new ScriptException(ScriptException.TIME_PASSED); 384 435 } 385 436 386 437 CADSimulator.theIncidentMgr.rescheduleIncident(incidentNumber, newTime); 387 438 } 388 389 public void addIncident(Incident newIncident) throws RemoteException { 439 440 public void addIncident(Incident newIncident) throws RemoteException 441 { 390 442 391 443 CADSimulator.theIncidentMgr.addIncident(newIncident); 392 393 if(managerInt != null) { 394 try { 444 445 if (managerInt != null) 446 { 447 try 448 { 395 449 managerInt.incidentAdded(newIncident); 396 } 397 catch (RemoteException re){450 } catch (RemoteException re) 451 { 398 452 //Simulation Manager has disappeared 399 453 managerInt = null; 400 454 CADSimulator.theViewer.setSimManagerStatus(false); 401 455 402 coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", 456 coorLogger.logp(Level.SEVERE, "Coordinator", "addIncident", 403 457 "Connection to Simulation Manager has been dropped.", re); 404 } 405 } 406 } 407 408 409 public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException { 410 411 412 try { 458 } 459 } 460 } 461 462 public void loadScriptFile(File scriptFile) throws RemoteException, ScriptException 463 { 464 465 466 try 467 { 413 468 CADSimulator.theIncidentMgr.clearIncidents(); 414 469 cadData.clearData(); 415 470 416 471 ScriptHandler sh = new ScriptHandler(); 417 472 418 473 SAXParserFactory.newInstance().newSAXParser().parse(scriptFile, sh); 419 474 420 475 cadData.setIncidentsFromXML(sh.getIncidents()); 421 476 cadData.setUnitsFromXML(sh.getUnits()); 422 477 refreshClients(); 423 478 CADSimulator.theIncidentMgr.addIncidents(sh.getIncidents()); 424 425 resetSimulation(); 426 } 427 catch (Exception e) {e.printStackTrace();} 428 429 } 430 431 public Vector<Incident> getIncidentList() throws RemoteException { 479 480 resetSimulation(); 481 } catch (Exception e) 482 { 483 e.printStackTrace(); 484 } 485 486 } 487 488 public Vector<Incident> getIncidentList() throws RemoteException 489 { 432 490 return CADSimulator.theIncidentMgr.getIncidentList(); 433 491 } 434 435 public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException { 492 493 public TreeMap<Integer, Vector<IncidentEvent>> getTriggeredEvents() throws RemoteException 494 { 436 495 return CADSimulator.theIncidentMgr.getTriggeredEvents(); 437 496 } 438 497 439 public SCRIPT_STATUS getScriptStatus() throws RemoteException { 440 if(CADSimulator.theIncidentMgr.areIncidentsLoaded()) { 441 if(CADSimulator.theSimulationCntrlMgr.simulationStarted()) 498 public SCRIPT_STATUS getScriptStatus() throws RemoteException 499 { 500 if (CADSimulator.theIncidentMgr.areIncidentsLoaded()) 501 { 502 if (CADSimulator.theSimulationCntrlMgr.simulationStarted()) 503 { 442 504 return SCRIPT_STATUS.SCRIPT_RUNNING; 443 else { 444 for(Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) { 445 if(inc.hasOccured() == true) 505 } else 506 { 507 for (Incident inc : CADSimulator.theIncidentMgr.getIncidentList()) 508 { 509 if (inc.hasOccured() == true) 510 { 446 511 return SCRIPT_STATUS.SCRIPT_PAUSED_STARTED; 512 } 447 513 } 448 514 return SCRIPT_STATUS.SCRIPT_STOPPED_NOT_STARTED; … … 451 517 return SCRIPT_STATUS.NO_SCRIPT; 452 518 } 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. 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. 460 525 * 461 526 * @param newMessage Routed message received from CAD Client. 462 527 */ 463 public void routeMessage(CADRoutedMessage newMessage) { 464 528 public void routeMessage(CADRoutedMessage newMessage) 529 { 530 465 531 //if this is an incidentUpdate 466 532 /* 467 533 * TODO Is this a priority?? 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 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 485 551 notifyObservers(new ObserverMessage(ObserverMessage.messageType.ROUTED_MESSAGE, 486 552 newMessage)); 487 553 488 } 489 490 491 public TreeSet<String> getCMSIDs() throws RemoteException {554 } 555 556 public TreeSet<String> getCMSIDs() throws RemoteException 557 { 492 558 return new TreeSet<String>(CMSDiversionDB.getInstance().getAllDiversions().keySet()); 493 559 } 494 495 public CMSInfo getCMSDiversionInfo(String theCMSID) throws RemoteException { 560 561 public CMSInfo getCMSDiversionInfo(String theCMSID) throws RemoteException 562 { 496 563 return CMSDiversionDB.getInstance().getDiversion(theCMSID); 497 } 498 499 public void applyDiversions(CMSInfo theDiversion) throws RemoteException { 564 } 565 566 public void applyDiversions(CMSInfo theDiversion) throws RemoteException 567 { 500 568 CMSDiversionDB.getInstance().updateDiversions(theDiversion); 501 569 CADSimulator.theParamicsSimMgr.updateDiversion(theDiversion); 502 } 503 504 /** 505 * Method updates the simulation with the new Incident information. 506 * The parameter IncidentInquiryModel_obj Object is used to create507 * a new IncidentEvent Object which is finalized and sent to the508 * IncidentManager for simulation updating.509 * 570 } 571 572 /** 573 * Method updates the simulation with the new Incident information. The 574 * parameter IncidentInquiryModel_obj Object is used to create a new 575 * IncidentEvent Object which is finalized and sent to the IncidentManager 576 * for simulation updating. 577 * 510 578 * @param update IncidentInquiryModel_obj containing CAD line update 511 579 * @see IncidentManager 512 580 */ 513 public void commandLineUpdate(IncidentInquiryModel_obj modelInfo) { 514 581 public void commandLineUpdate(IncidentInquiryModel_obj modelInfo) 582 { 583 515 584 long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 516 585 517 586 IncidentEvent triggeredEvent = new IncidentEvent(currentSimTime); 518 triggeredEvent.eventInfo = modelInfo;519 587 triggeredEvent.eventInfo = modelInfo; 588 520 589 triggeredEvent.finalizeEvent(currentSimTime, CADSimulator.getCADTime()); 521 590 522 CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent); 523 591 CADSimulator.theIncidentMgr.updateIncident(modelInfo.getLogNumber(), triggeredEvent); 592 524 593 updateIncidentInGUI(modelInfo.getLogNumber(), triggeredEvent); 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 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 533 601 * ParamicsControlManager to send an IncidentUpdate. 534 * 602 * 535 603 * @see SimulationControlManager 536 604 * @see ParamicsControlManager 537 605 * @see IncidentManager 538 606 */ 539 public void tick() { 540 if(CADSimulator.theSimulationCntrlMgr.simulationStarted()) { 541 607 public void tick() 608 { 609 if (CADSimulator.theSimulationCntrlMgr.simulationStarted()) 610 { 611 542 612 final long currentSimTime = CADSimulator.theSimulationCntrlMgr.getCurrentSimTime(); 543 544 Runnable timeRun = new Runnable() { 545 546 public void run() { 613 614 Runnable timeRun = new Runnable() 615 { 616 public void run() 617 { 547 618 CADSimulator.theViewer.setTime(currentSimTime); 548 619 549 620 //send an update every 30 seconds 550 if(currentSimTime % 30 == 0) 621 if (currentSimTime % 30 == 0) 622 { 551 623 CADSimulator.theParamicsSimMgr.sendIncidentUpdate(currentSimTime); 552 553 if(managerInt != null) { 554 try { 624 } 625 626 if (managerInt != null) 627 { 628 try 629 { 555 630 managerInt.tick(currentSimTime); 556 } 557 catch (RemoteException re){631 } catch (RemoteException re) 632 { 558 633 //Simulation Manager has disappeared 559 634 managerInt = null; 560 635 CADSimulator.theViewer.setSimManagerStatus(false); 561 636 562 coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 637 coorLogger.logp(Level.SEVERE, "Coordinator", "tick:run", 563 638 "Connection to Simulation Manager has been dropped.", re); 564 639 } 565 640 } 566 641 567 642 CADSimulator.theIncidentMgr.tick(currentSimTime); 568 } 643 } 569 644 }; 570 645 571 646 Thread timeThread = new Thread(timeRun); 572 timeThread.start(); 573 } 574 } 575 647 timeThread.start(); 648 } 649 } 576 650 577 651 /** 578 652 * Method notifies observers with an IncidentSummaryModel_obj to signify 579 * that a new Incident has started. Then spawn a thread to notify the653 * that a new Incident has started. Then spawn a thread to notify the 580 654 * SimulationManager with the Incident's log number has started. 581 * 655 * 582 656 * @param completedEvent Completed IncidentEvent. 583 657 */ 584 public void incidentStarted(final IncidentEvent completedEvent) { 658 public void incidentStarted(final IncidentEvent completedEvent) 659 { 585 660 notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_SUMMARY, 586 new IncidentSummaryModel_obj(completedEvent.eventInfo.getHeader()))); 587 661 new IncidentSummaryModel_obj(completedEvent.eventInfo.getHeader()))); 662 588 663 incidentStartedInGUI(completedEvent.eventInfo.getLogNumber()); 589 590 Runnable startRun = new Runnable() { 591 public void run() { 592 if(managerInt != null) { 593 try { 664 665 Runnable startRun = new Runnable() 666 { 667 public void run() 668 { 669 if (managerInt != null) 670 { 671 try 672 { 594 673 managerInt.incidentStarted(completedEvent.eventInfo.getLogNumber()); 595 } 596 catch (RemoteException re){674 } catch (RemoteException re) 675 { 597 676 //Simulation Manager has disappeared 598 677 managerInt = null; 599 678 CADSimulator.theViewer.setSimManagerStatus(false); 600 679 601 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", 680 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents", 602 681 "Connection to Simulation Manager has been dropped.", re); 603 } 604 } 605 } 606 }; 607 682 } 683 } 684 } 685 }; 686 608 687 Thread startThread = new Thread(startRun); 609 688 startThread.start(); 610 } 611 612 /** 613 * Method notifies observers with the IncidentEvent Object to signify 614 * that a new IncidentEvent has completed. All XMLIncident Objects615 * in the completed IncidentEvent is sent to the ParamicsControlManager616 * for transmission to Paramics. All CCTVInfo Objects are sent to the617 * MediaManager for media control. A thread is then spawned to notify the618 * SimulationManager withthe completed IncidentEvent.619 * 689 } 690 691 /** 692 * Method notifies observers with the IncidentEvent Object to signify that a 693 * new IncidentEvent has completed. All XMLIncident Objects in the completed 694 * IncidentEvent is sent to the ParamicsControlManager for transmission to 695 * Paramics. All CCTVInfo Objects are sent to the MediaManager for media 696 * control. A thread is then spawned to notify the SimulationManager with 697 * the completed IncidentEvent. 698 * 620 699 * @param completedEvent Completed IncidentEvent. 621 700 * @see ParamicsControlManager 622 701 * @see MediaManager 623 702 */ 624 public void incidentUpdated(final IncidentEvent completedEvent) { 703 public void incidentUpdated(final IncidentEvent completedEvent) 704 { 625 705 notifyObservers(new ObserverMessage(ObserverMessage.messageType.INCIDENT_INQUIRY, 626 completedEvent.eventInfo)); 627 628 for(XMLIncident xmlInc : completedEvent.XMLIncidents) 706 completedEvent.eventInfo)); 707 708 for (XMLIncident xmlInc : completedEvent.XMLIncidents) 709 { 629 710 CADSimulator.theParamicsSimMgr.updateIncident(xmlInc); 630 631 711 } 712 713 632 714 /*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 { 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 try 726 { 641 727 managerInt.eventOccured( 642 completedEvent.eventInfo.getLogNumber(), 728 completedEvent.eventInfo.getLogNumber(), 643 729 completedEvent); 644 } 645 catch (RemoteException re){730 } catch (RemoteException re) 731 { 646 732 //Simulation Manager has disappeared 647 733 managerInt = null; 648 734 CADSimulator.theViewer.setSimManagerStatus(false); 649 735 650 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run", 736 coorLogger.logp(Level.SEVERE, "Coordinator", "updateIncidents:run", 651 737 "Connection to Simulation Manager has been dropped.", re); 652 } 738 } 653 739 } 654 740 } … … 656 742 657 743 Thread displayThread = new Thread(displayRun); 658 displayThread.start(); 659 } 660 744 displayThread.start(); 745 } 746 661 747 /** 662 748 * @see IncidentManager 663 749 */ 664 public boolean incidentExists(Integer logNumber) { 750 public boolean incidentExists(Integer logNumber) 751 { 665 752 return CADSimulator.theIncidentMgr.incidentExists(logNumber); 666 753 } … … 669 756 * @see IncidentManager 670 757 */ 671 public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects() { 758 public Vector<IncidentBoardModel_obj> getIncidentBoardModelObjects() 759 { 672 760 return CADSimulator.theIncidentMgr.getIncidentBoardModelObjects(); 673 } 761 } 674 762 675 763 /** 676 764 * @see IncidentManager 677 765 */ 678 public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber) { 766 public Vector<IncidentInquiryModel_obj> getIncidentInquiryModelObjects(Integer logNumber) 767 { 679 768 return CADSimulator.theIncidentMgr.getIncidentInquiryModelObjects(logNumber); 680 } 769 } 681 770 682 771 /** 683 772 * @see IncidentManager 684 773 */ 685 public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects() { 774 public Vector<IncidentSummaryModel_obj> getIncidentSummaryModelObjects() 775 { 686 776 return CADSimulator.theIncidentMgr.getIncidentSummaryModelObjects(); 687 } 688 689 777 } 778 690 779 /** 691 780 * Adds an observer to the list of observers. … … 693 782 * @param o New observer object. 694 783 */ 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. 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. 703 793 * 704 794 * @param o Observer to be removed. 705 795 * @returns True if remove was successful, false if not. 706 */ 707 public boolean removeObserver(Observer o) { 796 */ 797 public boolean removeObserver(Observer o) 798 { 708 799 return observerList.remove(o); 709 800 } 710 711 /** 712 * Notify all registered observers with the parameter ObserverMessage object. 801 802 /** 803 * Notify all registered observers with the parameter ObserverMessage 804 * object. 713 805 * 714 806 * @param newMsg The ObserverMessage to be sent. 715 807 */ 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++){ 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 { 723 820 clientList.get(i).refresh(); 724 821 } 725 822 } 726 823 727 824 /** 728 825 * Checks the CADData for an existing incident with id 826 * 729 827 * @param id the incident id 730 828 * @return true if CADData contains such an incident, otherwise false. 731 829 * @throws RemoteException 732 830 */ 733 public boolean checkForValidIncidentID(int id) throws RemoteException{ 831 public boolean checkForValidIncidentID(int id) throws RemoteException 832 { 734 833 return cadData.checkForValidId(id); 735 } 736 737 738 /** 834 } 835 836 /** 739 837 * Uses an Incident's masterInc to lookup its ID. 838 * 740 839 * @param masterInc the Incident to look up 741 840 * @return the same Incident's ID, -1 if invalid masterInc 742 841 * @throws RemoteException 743 842 */ 744 public int getIncidentId(String masterInc) throws RemoteException{ 745 return cadData.getIncidentId(masterInc); 746 } 747 843 public int getIncidentId(String masterInc) throws RemoteException 844 { 845 return cadData.getIncidentId(masterInc); 846 } 847 748 848 /** 749 849 * Returns a table model out of CADData based on tag. 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)){ 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 { 755 858 return cadData.tableForAssignedIncidents(); 756 } 757 else if(tag.equals(TABLE.UNIT_STATUS)){859 } else if (tag.equals(TABLE.UNIT_STATUS)) 860 { 758 861 return cadData.tableForUnitStatus(); 759 } 760 else if(tag.equals(TABLE.PENDING_INCIDENTS)){862 } else if (tag.equals(TABLE.PENDING_INCIDENTS)) 863 { 761 864 return cadData.tableForPendingIncidents(); 762 } 763 else if(tag.equals(TABLE.INCIDENT_EDITOR)){865 } else if (tag.equals(TABLE.INCIDENT_EDITOR)) 866 { 764 867 return cadData.tableForIncidentEditor(); 765 } 766 else{868 } else 869 { 767 870 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataTable"); 768 871 } 769 872 } 770 873 771 874 /** 772 875 * Returns the specified incident's table based on the tag. 876 * 773 877 * @param tag a CADDataEnums tag 774 878 * @param incidentId the incident's ID to look up … … 776 880 * @throws RemoteException 777 881 */ 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 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 785 891 /** 786 892 * Adds a row of data to a specified incident's table based on the tag. 893 * 787 894 * @param tag a CADDataEnums tag 788 895 * @param incidentId the incident's ID to look up … … 790 897 * @throws RemoteException 791 898 */ 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 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 798 907 /** 799 908 * Adds a row to the specified data table based on the incoming fields. 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 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 810 918 /** 811 919 * Returns an object out of Incident based on tag. 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)){ 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 { 818 929 return cadData.getIncident(incidentId).getLogNum(); 819 } 820 else if(tag.equals(INC_VAL.MASTER_INC)){930 } else if (tag.equals(INC_VAL.MASTER_INC)) 931 { 821 932 return cadData.getIncident(incidentId).getMasterInc(); 822 } 823 else if(tag.equals(INC_VAL.OAU)){933 } else if (tag.equals(INC_VAL.OAU)) 934 { 824 935 return cadData.getIncident(incidentId).getOau(); 825 } 826 else if(tag.equals(INC_VAL.P)){936 } else if (tag.equals(INC_VAL.P)) 937 { 827 938 return cadData.getIncident(incidentId).getP(); 828 } 829 else if(tag.equals(INC_VAL.DESCRIPTION)){939 } else if (tag.equals(INC_VAL.DESCRIPTION)) 940 { 830 941 return cadData.getIncident(incidentId).getDescription(); 831 } 832 else if(tag.equals(INC_VAL.RP)){942 } else if (tag.equals(INC_VAL.RP)) 943 { 833 944 return cadData.getIncident(incidentId).getRp(); 834 } 835 else if(tag.equals(INC_VAL.RP_TYPE)){945 } else if (tag.equals(INC_VAL.RP_TYPE)) 946 { 836 947 return cadData.getIncident(incidentId).getRpType(); 837 } 838 else if(tag.equals(INC_VAL.ALI)){948 } else if (tag.equals(INC_VAL.ALI)) 949 { 839 950 return cadData.getIncident(incidentId).getAli(); 840 } 841 else if(tag.equals(INC_VAL.MEDIA)){951 } else if (tag.equals(INC_VAL.MEDIA)) 952 { 842 953 return cadData.getIncident(incidentId).getMedia(); 843 } 844 else{954 } else 955 { 845 956 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncVal"); 846 957 } 847 958 } 848 959 849 960 /** 850 961 * Set incidentId's field based on tag to value. 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)){ 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 { 857 971 cadData.getIncident(incidentId).setOau(value); 858 } 859 else if(tag.equals(INC_VAL.P)){972 } else if (tag.equals(INC_VAL.P)) 973 { 860 974 cadData.getIncident(incidentId).setP(value); 861 } 862 else if(tag.equals(INC_VAL.DESCRIPTION)){975 } else if (tag.equals(INC_VAL.DESCRIPTION)) 976 { 863 977 cadData.getIncident(incidentId).setDescription(value); 864 } 865 else if(tag.equals(INC_VAL.RP)){978 } else if (tag.equals(INC_VAL.RP)) 979 { 866 980 cadData.getIncident(incidentId).setRp(value); 867 } 868 else if(tag.equals(INC_VAL.RP_TYPE)){981 } else if (tag.equals(INC_VAL.RP_TYPE)) 982 { 869 983 cadData.getIncident(incidentId).setRpType(value); 870 } 871 else if(tag.equals(INC_VAL.ALI)){984 } else if (tag.equals(INC_VAL.ALI)) 985 { 872 986 cadData.getIncident(incidentId).setAli(value); 873 } 874 else if(tag.equals(INC_VAL.MEDIA)){987 } else if (tag.equals(INC_VAL.MEDIA)) 988 { 875 989 cadData.getIncident(incidentId).setMedia(value); 876 } 877 else{990 } else 991 { 878 992 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncVal"); 879 993 } 880 994 } 881 882 995 883 996 /** 884 997 * Returns a string out of IncidentLocation based on tag. 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)){ 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 { 891 1007 return cadData.getIncident(incidentId).getIncidentLocation().getAddress(); 892 } 893 else if(tag.equals(INC_LOC.LOC)){1008 } else if (tag.equals(INC_LOC.LOC)) 1009 { 894 1010 return cadData.getIncident(incidentId).getIncidentLocation().getLoc(); 895 } 896 else if(tag.equals(INC_LOC.CITY)){1011 } else if (tag.equals(INC_LOC.CITY)) 1012 { 897 1013 return cadData.getIncident(incidentId).getIncidentLocation().getCity(); 898 } 899 else if(tag.equals(INC_LOC.COUNTY)){1014 } else if (tag.equals(INC_LOC.COUNTY)) 1015 { 900 1016 return cadData.getIncident(incidentId).getIncidentLocation().getCounty(); 901 } 902 else if(tag.equals(INC_LOC.STATE)){1017 } else if (tag.equals(INC_LOC.STATE)) 1018 { 903 1019 return cadData.getIncident(incidentId).getIncidentLocation().getState(); 904 } 905 else if(tag.equals(INC_LOC.ZIP)){1020 } else if (tag.equals(INC_LOC.ZIP)) 1021 { 906 1022 return cadData.getIncident(incidentId).getIncidentLocation().getZip(); 907 } 908 else if(tag.equals(INC_LOC.BEAT)){1023 } else if (tag.equals(INC_LOC.BEAT)) 1024 { 909 1025 return cadData.getIncident(incidentId).getIncidentLocation().getBeat(); 910 } 911 else if(tag.equals(INC_LOC.AREA)){1026 } else if (tag.equals(INC_LOC.AREA)) 1027 { 912 1028 return cadData.getIncident(incidentId).getIncidentLocation().getArea(); 913 } 914 else if(tag.equals(INC_LOC.SECTOR)){1029 } else if (tag.equals(INC_LOC.SECTOR)) 1030 { 915 1031 return cadData.getIncident(incidentId).getIncidentLocation().getSector(); 916 } 917 else if(tag.equals(INC_LOC.SECTOR_CODE)){1032 } else if (tag.equals(INC_LOC.SECTOR_CODE)) 1033 { 918 1034 return cadData.getIncident(incidentId).getIncidentLocation().getSectorCode(); 919 } 920 else if(tag.equals(INC_LOC.DIVISION)){1035 } else if (tag.equals(INC_LOC.DIVISION)) 1036 { 921 1037 return cadData.getIncident(incidentId).getIncidentLocation().getDivision(); 922 } 923 else if(tag.equals(INC_LOC.APT)){1038 } else if (tag.equals(INC_LOC.APT)) 1039 { 924 1040 return cadData.getIncident(incidentId).getIncidentLocation().getApt(); 925 } 926 else if(tag.equals(INC_LOC.BUILDING)){1041 } else if (tag.equals(INC_LOC.BUILDING)) 1042 { 927 1043 return cadData.getIncident(incidentId).getIncidentLocation().getBuilding(); 928 } 929 else if(tag.equals(INC_LOC.CROSS_ST)){1044 } else if (tag.equals(INC_LOC.CROSS_ST)) 1045 { 930 1046 return cadData.getIncident(incidentId).getIncidentLocation().getCrossSt(); 931 } 932 else if(tag.equals(INC_LOC.LAW)){1047 } else if (tag.equals(INC_LOC.LAW)) 1048 { 933 1049 return cadData.getIncident(incidentId).getIncidentLocation().getLaw(); 934 } 935 else if(tag.equals(INC_LOC.FIRE)){1050 } else if (tag.equals(INC_LOC.FIRE)) 1051 { 936 1052 return cadData.getIncident(incidentId).getIncidentLocation().getFire(); 937 } 938 else if(tag.equals(INC_LOC.EMS)){1053 } else if (tag.equals(INC_LOC.EMS)) 1054 { 939 1055 return cadData.getIncident(incidentId).getIncidentLocation().getEms(); 940 } 941 else{1056 } else 1057 { 942 1058 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncLoc"); 943 1059 } … … 946 1062 /** 947 1063 * Set incidentId's field based on tag to value. 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)){ 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 { 954 1073 cadData.getIncident(incidentId).getIncidentLocation().setAddress(value); 955 } 956 else if(tag.equals(INC_LOC.LOC)){1074 } else if (tag.equals(INC_LOC.LOC)) 1075 { 957 1076 cadData.getIncident(incidentId).getIncidentLocation().setLoc(value); 958 } 959 else if(tag.equals(INC_LOC.CITY)){1077 } else if (tag.equals(INC_LOC.CITY)) 1078 { 960 1079 cadData.getIncident(incidentId).getIncidentLocation().setCity(value); 961 } 962 else if(tag.equals(INC_LOC.COUNTY)){1080 } else if (tag.equals(INC_LOC.COUNTY)) 1081 { 963 1082 cadData.getIncident(incidentId).getIncidentLocation().setCounty(value); 964 } 965 else if(tag.equals(INC_LOC.STATE)){1083 } else if (tag.equals(INC_LOC.STATE)) 1084 { 966 1085 cadData.getIncident(incidentId).getIncidentLocation().setState(value); 967 } 968 else if(tag.equals(INC_LOC.ZIP)){1086 } else if (tag.equals(INC_LOC.ZIP)) 1087 { 969 1088 cadData.getIncident(incidentId).getIncidentLocation().setZip(value); 970 } 971 else if(tag.equals(INC_LOC.BEAT)){1089 } else if (tag.equals(INC_LOC.BEAT)) 1090 { 972 1091 cadData.getIncident(incidentId).getIncidentLocation().setBeat(value); 973 } 974 else if(tag.equals(INC_LOC.AREA)){1092 } else if (tag.equals(INC_LOC.AREA)) 1093 { 975 1094 cadData.getIncident(incidentId).getIncidentLocation().setArea(value); 976 } 977 else if(tag.equals(INC_LOC.SECTOR)){1095 } else if (tag.equals(INC_LOC.SECTOR)) 1096 { 978 1097 cadData.getIncident(incidentId).getIncidentLocation().setSector(value); 979 } 980 else if(tag.equals(INC_LOC.SECTOR_CODE)){1098 } else if (tag.equals(INC_LOC.SECTOR_CODE)) 1099 { 981 1100 cadData.getIncident(incidentId).getIncidentLocation().setSectorCode(value); 982 } 983 else if(tag.equals(INC_LOC.DIVISION)){1101 } else if (tag.equals(INC_LOC.DIVISION)) 1102 { 984 1103 cadData.getIncident(incidentId).getIncidentLocation().setDivision(value); 985 } 986 else if(tag.equals(INC_LOC.APT)){1104 } else if (tag.equals(INC_LOC.APT)) 1105 { 987 1106 cadData.getIncident(incidentId).getIncidentLocation().setApt(value); 988 } 989 else if(tag.equals(INC_LOC.BUILDING)){1107 } else if (tag.equals(INC_LOC.BUILDING)) 1108 { 990 1109 cadData.getIncident(incidentId).getIncidentLocation().setBuilding(value); 991 } 992 else if(tag.equals(INC_LOC.CROSS_ST)){1110 } else if (tag.equals(INC_LOC.CROSS_ST)) 1111 { 993 1112 cadData.getIncident(incidentId).getIncidentLocation().setCrossSt(value); 994 } 995 else if(tag.equals(INC_LOC.LAW)){1113 } else if (tag.equals(INC_LOC.LAW)) 1114 { 996 1115 cadData.getIncident(incidentId).getIncidentLocation().setLaw(value); 997 } 998 else if(tag.equals(INC_LOC.FIRE)){1116 } else if (tag.equals(INC_LOC.FIRE)) 1117 { 999 1118 cadData.getIncident(incidentId).getIncidentLocation().setFire(value); 1000 } 1001 else if(tag.equals(INC_LOC.EMS)){1119 } else if (tag.equals(INC_LOC.EMS)) 1120 { 1002 1121 cadData.getIncident(incidentId).getIncidentLocation().setEms(value); 1003 } 1004 else{1122 } else 1123 { 1005 1124 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncLoc"); 1006 1125 } 1007 1126 } 1008 1127 1009 1128 /** 1010 1129 * Returns a string out of IncidentCaller based on tag. 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)){ 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 { 1017 1139 return cadData.getIncident(incidentId).getIncidentCaller().getCallerType(); 1018 } 1019 else if(tag.equals(INC_CALLER.NAME)){1140 } else if (tag.equals(INC_CALLER.NAME)) 1141 { 1020 1142 return cadData.getIncident(incidentId).getIncidentCaller().getCallerName(); 1021 } 1022 else if(tag.equals(INC_CALLER.PHONE)){1143 } else if (tag.equals(INC_CALLER.PHONE)) 1144 { 1023 1145 return cadData.getIncident(incidentId).getIncidentCaller().getPhone(); 1024 } 1025 else if(tag.equals(INC_CALLER.EXT)){1146 } else if (tag.equals(INC_CALLER.EXT)) 1147 { 1026 1148 return cadData.getIncident(incidentId).getIncidentCaller().getExt(); 1027 } 1028 else{1149 } else 1150 { 1029 1151 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCaller"); 1030 1152 } … … 1033 1155 /** 1034 1156 * Set incidentId's field based on tag to value. 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)){ 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 { 1041 1166 cadData.getIncident(incidentId).getIncidentCaller().setCallerType(value); 1042 } 1043 else if(tag.equals(INC_CALLER.NAME)){1167 } else if (tag.equals(INC_CALLER.NAME)) 1168 { 1044 1169 cadData.getIncident(incidentId).getIncidentCaller().setCallerName(value); 1045 } 1046 else if(tag.equals(INC_CALLER.PHONE)){1170 } else if (tag.equals(INC_CALLER.PHONE)) 1171 { 1047 1172 cadData.getIncident(incidentId).getIncidentCaller().setPhone(value); 1048 } 1049 else if(tag.equals(INC_CALLER.EXT)){1173 } else if (tag.equals(INC_CALLER.EXT)) 1174 { 1050 1175 cadData.getIncident(incidentId).getIncidentCaller().setExt(value); 1051 } 1052 else{1176 } else 1177 { 1053 1178 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncCaller"); 1054 1179 } 1055 1180 } 1056 1181 1057 1182 /** 1058 1183 * Returns a string out of IncidentProblem based on tag. 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)){ 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 { 1065 1193 return cadData.getIncident(incidentId).getProblem().getProblem(); 1066 } 1067 else if(tag.equals(INC_PROBLEM.CODE)){1194 } else if (tag.equals(INC_PROBLEM.CODE)) 1195 { 1068 1196 return cadData.getIncident(incidentId).getProblem().getProblemCode(); 1069 } 1070 else if(tag.equals(INC_PROBLEM.PRIORITY)){1197 } else if (tag.equals(INC_PROBLEM.PRIORITY)) 1198 { 1071 1199 return cadData.getIncident(incidentId).getProblem().getPriority(); 1072 } 1073 else{1200 } else 1201 { 1074 1202 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncProblem"); 1075 1203 } 1076 1204 } 1077 1205 1078 1206 /** 1079 1207 * Set incidentId's field based on tag to value. 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)){ 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 { 1086 1217 cadData.getIncident(incidentId).getProblem().setProblem(value); 1087 } 1088 else if(tag.equals(INC_PROBLEM.CODE)){1218 } else if (tag.equals(INC_PROBLEM.CODE)) 1219 { 1089 1220 cadData.getIncident(incidentId).getProblem().setProblemCode(value); 1090 } 1091 else if(tag.equals(INC_PROBLEM.PRIORITY)){1221 } else if (tag.equals(INC_PROBLEM.PRIORITY)) 1222 { 1092 1223 cadData.getIncident(incidentId).getProblem().setPriority(value); 1093 } 1094 else{1224 } else 1225 { 1095 1226 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncProblem"); 1096 1227 } … … 1099 1230 /** 1100 1231 * Returns a string out of IncidentGeneralInfo based on tag. 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)){ 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 { 1107 1241 return cadData.getIncident(incidentId).getGenInfo().getJurisdiction(); 1108 } 1109 else if(tag.equals(INC_GEN_INFO.ALARM)){1242 } else if (tag.equals(INC_GEN_INFO.ALARM)) 1243 { 1110 1244 return cadData.getIncident(incidentId).getGenInfo().getAlarm(); 1111 } 1112 else if(tag.equals(INC_GEN_INFO.AGY)){1245 } else if (tag.equals(INC_GEN_INFO.AGY)) 1246 { 1113 1247 return cadData.getIncident(incidentId).getGenInfo().getAgy(); 1114 } 1115 else{1248 } else 1249 { 1116 1250 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncGenInfo"); 1117 1251 } … … 1120 1254 /** 1121 1255 * Set incidentId's field based on tag to value. 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)){ 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 { 1128 1265 cadData.getIncident(incidentId).getGenInfo().setJurisdiction(value); 1129 } 1130 else if(tag.equals(INC_GEN_INFO.ALARM)){1266 } else if (tag.equals(INC_GEN_INFO.ALARM)) 1267 { 1131 1268 cadData.getIncident(incidentId).getGenInfo().setAlarm(value); 1132 } 1133 else if(tag.equals(INC_GEN_INFO.AGY)){1269 } else if (tag.equals(INC_GEN_INFO.AGY)) 1270 { 1134 1271 cadData.getIncident(incidentId).getGenInfo().setAgy(value); 1135 } 1136 else{1272 } else 1273 { 1137 1274 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncGenInfo"); 1138 1275 } 1139 1276 } 1140 1277 1141 1278 /** 1142 1279 * Returns a string out of IncidentResponse based on tag. 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)){ 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 { 1149 1289 return cadData.getIncident(incidentId).getResponse().getPlan(); 1150 } 1151 else if(tag.equals(INC_RESP.AREA)){1290 } else if (tag.equals(INC_RESP.AREA)) 1291 { 1152 1292 return cadData.getIncident(incidentId).getResponse().getArea(); 1153 } 1154 else{1293 } else 1294 { 1155 1295 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncResp"); 1156 1296 } 1157 1297 } 1158 1298 1159 1299 /** 1160 1300 * Set incidentId's field based on tag to value. 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)){ 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 { 1167 1310 cadData.getIncident(incidentId).getResponse().setPlan(value); 1168 } 1169 else if(tag.equals(INC_RESP.AREA)){1311 } else if (tag.equals(INC_RESP.AREA)) 1312 { 1170 1313 cadData.getIncident(incidentId).getResponse().setArea(value); 1171 } 1172 else{1314 } else 1315 { 1173 1316 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncResp"); 1174 1317 } … … 1177 1320 /** 1178 1321 * Returns a string out of IncidentAdditionalInfo based on tag. 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)){ 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 { 1185 1331 return cadData.getIncident(incidentId).getAdditionalInfo().getType(); 1186 } 1187 else if(tag.equals(INC_ADD_INFO.TYPE_CODE)){1332 } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 1333 { 1188 1334 return cadData.getIncident(incidentId).getAdditionalInfo().getTypeCode(); 1189 } 1190 else if(tag.equals(INC_ADD_INFO.MACHINE)){1335 } else if (tag.equals(INC_ADD_INFO.MACHINE)) 1336 { 1191 1337 return cadData.getIncident(incidentId).getAdditionalInfo().getMachine(); 1192 } 1193 else if(tag.equals(INC_ADD_INFO.CALL_STATUS)){1338 } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 1339 { 1194 1340 return cadData.getIncident(incidentId).getAdditionalInfo().getCallStatus(); 1195 } 1196 else if(tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)){1341 } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 1342 { 1197 1343 return cadData.getIncident(incidentId).getAdditionalInfo().getCallTakerExt(); 1198 } 1199 else if(tag.equals(INC_ADD_INFO.ALARM_LEVEL)){1344 } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 1345 { 1200 1346 return cadData.getIncident(incidentId).getAdditionalInfo().getAlarmLevel(); 1201 } 1202 else if(tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)){1347 } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 1348 { 1203 1349 return cadData.getIncident(incidentId).getAdditionalInfo().getRotationProviderArea(); 1204 } 1205 else if(tag.equals(INC_ADD_INFO.COMMENT)){1350 } else if (tag.equals(INC_ADD_INFO.COMMENT)) 1351 { 1206 1352 return cadData.getIncident(incidentId).getAdditionalInfo().getComment(); 1207 } 1208 else{1353 } else 1354 { 1209 1355 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncAddInfo"); 1210 1356 } … … 1213 1359 /** 1214 1360 * Set incidentId's field based on tag to value. 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)){ 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 { 1221 1370 cadData.getIncident(incidentId).getAdditionalInfo().setType(value); 1222 } 1223 else if(tag.equals(INC_ADD_INFO.TYPE_CODE)){1371 } else if (tag.equals(INC_ADD_INFO.TYPE_CODE)) 1372 { 1224 1373 cadData.getIncident(incidentId).getAdditionalInfo().setTypeCode(value); 1225 } 1226 else if(tag.equals(INC_ADD_INFO.MACHINE)){1374 } else if (tag.equals(INC_ADD_INFO.MACHINE)) 1375 { 1227 1376 cadData.getIncident(incidentId).getAdditionalInfo().setMachine(value); 1228 } 1229 else if(tag.equals(INC_ADD_INFO.CALL_STATUS)){1377 } else if (tag.equals(INC_ADD_INFO.CALL_STATUS)) 1378 { 1230 1379 cadData.getIncident(incidentId).getAdditionalInfo().setCallStatus(value); 1231 } 1232 else if(tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)){1380 } else if (tag.equals(INC_ADD_INFO.CALL_TAKER_EXT)) 1381 { 1233 1382 cadData.getIncident(incidentId).getAdditionalInfo().setCallTakerExt(value); 1234 } 1235 else if(tag.equals(INC_ADD_INFO.ALARM_LEVEL)){1383 } else if (tag.equals(INC_ADD_INFO.ALARM_LEVEL)) 1384 { 1236 1385 cadData.getIncident(incidentId).getAdditionalInfo().setAlarmLevel(value); 1237 } 1238 else if(tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)){1386 } else if (tag.equals(INC_ADD_INFO.ROTATION_PROVIDER_AREA)) 1387 { 1239 1388 cadData.getIncident(incidentId).getAdditionalInfo().setRotationProviderArea(value); 1240 } 1241 else if(tag.equals(INC_ADD_INFO.COMMENT)){1389 } else if (tag.equals(INC_ADD_INFO.COMMENT)) 1390 { 1242 1391 cadData.getIncident(incidentId).getAdditionalInfo().setComment(value); 1243 } 1244 else{1392 } else 1393 { 1245 1394 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncAddInfo"); 1246 1395 } 1247 1396 } 1248 1397 1249 1398 /** 1250 1399 * Returns a string out of IncidentActivities based on tag. 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)){ 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 { 1257 1409 return cadData.getIncident(incidentId).getActivities().getVehicle(); 1258 } 1259 else if(tag.equals(INC_ACTIVITIES.ACTIVITY)){1410 } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 1411 { 1260 1412 return cadData.getIncident(incidentId).getActivities().getActivity(); 1261 } 1262 else if(tag.equals(INC_ACTIVITIES.LOCATION)){1413 } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 1414 { 1263 1415 return cadData.getIncident(incidentId).getActivities().getLocation(); 1264 } 1265 else if(tag.equals(INC_ACTIVITIES.COMMENT)){1416 } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 1417 { 1266 1418 return cadData.getIncident(incidentId).getActivities().getComment(); 1267 } 1268 else if(tag.equals(INC_ACTIVITIES.DISP)){1419 } else if (tag.equals(INC_ACTIVITIES.DISP)) 1420 { 1269 1421 return cadData.getIncident(incidentId).getActivities().getDisp(); 1270 } 1271 else{1422 } else 1423 { 1272 1424 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncActivities"); 1273 1425 } … … 1276 1428 /** 1277 1429 * Set incidentId's field based on tag to value. 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)){ 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 { 1284 1439 cadData.getIncident(incidentId).getActivities().setVehicle(value); 1285 } 1286 else if(tag.equals(INC_ACTIVITIES.ACTIVITY)){1440 } else if (tag.equals(INC_ACTIVITIES.ACTIVITY)) 1441 { 1287 1442 cadData.getIncident(incidentId).getActivities().setActivity(value); 1288 } 1289 else if(tag.equals(INC_ACTIVITIES.LOCATION)){1443 } else if (tag.equals(INC_ACTIVITIES.LOCATION)) 1444 { 1290 1445 cadData.getIncident(incidentId).getActivities().setLocation(value); 1291 } 1292 else if(tag.equals(INC_ACTIVITIES.COMMENT)){1446 } else if (tag.equals(INC_ACTIVITIES.COMMENT)) 1447 { 1293 1448 cadData.getIncident(incidentId).getActivities().setComment(value); 1294 } 1295 else if(tag.equals(INC_ACTIVITIES.DISP)){1449 } else if (tag.equals(INC_ACTIVITIES.DISP)) 1450 { 1296 1451 cadData.getIncident(incidentId).getActivities().setDisp(value); 1297 } 1298 else{1452 } else 1453 { 1299 1454 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataIncActivities"); 1300 1455 } 1301 1456 } 1302 1457 1303 1458 /** 1304 1459 * Returns a string out of IncidentCallback based on tag. 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)){ 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 { 1311 1469 return cadData.getIncident(incidentId).getCallBacks().getInitial(); 1312 } 1313 else if(tag.equals(INC_CALLBACK.COMMENT)){1470 } else if (tag.equals(INC_CALLBACK.COMMENT)) 1471 { 1314 1472 return cadData.getIncident(incidentId).getCallBacks().getComment(); 1315 } 1316 else{1473 } else 1474 { 1317 1475 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncCallBack"); 1318 1476 } … … 1321 1479 /** 1322 1480 * Returns a string out of IncidentEditLog based on tag. 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)){ 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 { 1329 1490 return cadData.getIncident(incidentId).getEditLog().getEdit(); 1330 } 1331 else if(tag.equals(INC_EDIT_LOG.REASON)){1491 } else if (tag.equals(INC_EDIT_LOG.REASON)) 1492 { 1332 1493 return cadData.getIncident(incidentId).getEditLog().getReason(); 1333 } 1334 else if(tag.equals(INC_EDIT_LOG.CHANGE_BY)){1494 } else if (tag.equals(INC_EDIT_LOG.CHANGE_BY)) 1495 { 1335 1496 return cadData.getIncident(incidentId).getEditLog().getChangeBy(); 1336 } 1337 else if(tag.equals(INC_EDIT_LOG.TERMINAL)){1497 } else if (tag.equals(INC_EDIT_LOG.TERMINAL)) 1498 { 1338 1499 return cadData.getIncident(incidentId).getEditLog().getTerminal(); 1339 } 1340 else{1500 } else 1501 { 1341 1502 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncEditLog"); 1342 1503 } … … 1345 1506 /** 1346 1507 * Returns a string out of IncidentInfo based on tag. 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)){ 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 { 1353 1517 return cadData.getIncident(incidentId).getInfo().getCallInit(); 1354 } 1355 else if(tag.equals(INC_INFO.CALL_TAKEN)){1518 } else if (tag.equals(INC_INFO.CALL_TAKEN)) 1519 { 1356 1520 return cadData.getIncident(incidentId).getInfo().getCallTaken(); 1357 } 1358 else if(tag.equals(INC_INFO.TIME_IN_Q)){1521 } else if (tag.equals(INC_INFO.TIME_IN_Q)) 1522 { 1359 1523 return cadData.getIncident(incidentId).getInfo().getTimeInQ(); 1360 } 1361 else if(tag.equals(INC_INFO.LAST_UPDATED)){1524 } else if (tag.equals(INC_INFO.LAST_UPDATED)) 1525 { 1362 1526 return cadData.getIncident(incidentId).getInfo().getLastUpdated(); 1363 } 1364 else{1527 } else 1528 { 1365 1529 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataIncInfo"); 1366 1530 } … … 1369 1533 /** 1370 1534 * Returns a string out of IncidentTimes based on tag. 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 { 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 { 1376 1542 // TODO Auto-generated method stub 1377 1543 return null; 1378 1544 } 1379 1545 1380 1546 /** 1381 1547 * Returns a CardfileList matching the tag. 1382 1548 */ 1383 public CardfileList getCardfileList(CARDFILE tag) throws RemoteException{ 1384 if(tag.equals(CARDFILE.COASTAL_DIVISION_UNITS)){ 1549 public CardfileList getCardfileList(CARDFILE tag) throws RemoteException 1550 { 1551 if (tag.equals(CARDFILE.COASTAL_DIVISION_UNITS)) 1552 { 1385 1553 return cardfileData.getCoastalDivisionUnitList(); 1386 } 1387 else if(tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)){1554 } else if (tag.equals(CARDFILE.POLICE_SHERIFF_CORONER)) 1555 { 1388 1556 return cardfileData.getPoliceSheriffCoronerList(); 1389 } 1390 else if(tag.equals(CARDFILE.COURTS)){1557 } else if (tag.equals(CARDFILE.COURTS)) 1558 { 1391 1559 return cardfileData.getCourtsList(); 1392 } 1393 else if(tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)){1560 } else if (tag.equals(CARDFILE.PUBLIC_TRANSPORTATION)) 1561 { 1394 1562 return cardfileData.getPublicTransportationList(); 1395 } 1396 else if(tag.equals(CARDFILE.GG_OTHER)){1563 } else if (tag.equals(CARDFILE.GG_OTHER)) 1564 { 1397 1565 return cardfileData.getGgOtherList(); 1398 } 1399 else if(tag.equals(CARDFILE.MY_MISC)){1566 } else if (tag.equals(CARDFILE.MY_MISC)) 1567 { 1400 1568 return cardfileData.getMyMiscList(); 1401 } 1402 else if(tag.equals(CARDFILE.SL_MISC)){1569 } else if (tag.equals(CARDFILE.SL_MISC)) 1570 { 1403 1571 return cardfileData.getSlMiscList(); 1404 } 1405 else if(tag.equals(CARDFILE.VT_MISC)){1572 } else if (tag.equals(CARDFILE.VT_MISC)) 1573 { 1406 1574 return cardfileData.getVlMiscList(); 1407 } 1408 else if(tag.equals(CARDFILE.CHP_OFFICES)){1575 } else if (tag.equals(CARDFILE.CHP_OFFICES)) 1576 { 1409 1577 return cardfileData.getChpOfficesList(); 1410 } 1411 else if(tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)){1578 } else if (tag.equals(CARDFILE.STATE_AGENCIES_FACILITIES)) 1579 { 1412 1580 return cardfileData.getStateAgenciesFacilitiesList(); 1413 } 1414 else if(tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)){1581 } else if (tag.equals(CARDFILE.GOVERNMENT_OFFICIALS)) 1582 { 1415 1583 return cardfileData.getGovernmentOfficialsList(); 1416 } 1417 else if(tag.equals(CARDFILE.FEDERAL_AGENCIES)){1584 } else if (tag.equals(CARDFILE.FEDERAL_AGENCIES)) 1585 { 1418 1586 return cardfileData.getFederalAgenciesList(); 1419 } 1420 else if(tag.equals(CARDFILE.RANCHES_LIVESTOCK)){1587 } else if (tag.equals(CARDFILE.RANCHES_LIVESTOCK)) 1588 { 1421 1589 return cardfileData.getRanchesLivestockList(); 1422 } 1423 else if(tag.equals(CARDFILE.FIRE_EMS)){1590 } else if (tag.equals(CARDFILE.FIRE_EMS)) 1591 { 1424 1592 return cardfileData.getFireEmsList(); 1425 } 1426 else if(tag.equals(CARDFILE.JAILS)){1593 } else if (tag.equals(CARDFILE.JAILS)) 1594 { 1427 1595 return cardfileData.getJailsList(); 1428 } 1429 else if(tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)){1596 } else if (tag.equals(CARDFILE.HOSPITALS_MED_CENTERS)) 1597 { 1430 1598 return cardfileData.getHospitalsMedCentersList(); 1431 } 1432 else if(tag.equals(CARDFILE.TOW_COMPANIES)){1599 } else if (tag.equals(CARDFILE.TOW_COMPANIES)) 1600 { 1433 1601 return cardfileData.getTowCompaniesList(); 1434 } 1435 else if(tag.equals(CARDFILE.CALTRANS)){1602 } else if (tag.equals(CARDFILE.CALTRANS)) 1603 { 1436 1604 return cardfileData.getCalTransList(); 1437 } 1438 else if(tag.equals(CARDFILE.COUNTY_ROADS)){1605 } else if (tag.equals(CARDFILE.COUNTY_ROADS)) 1606 { 1439 1607 return cardfileData.getCountyRoadsList(); 1440 } 1441 else if(tag.equals(CARDFILE.UTILITIES)){1608 } else if (tag.equals(CARDFILE.UTILITIES)) 1609 { 1442 1610 return cardfileData.getUtilitiesList(); 1443 } 1444 else if(tag.equals(CARDFILE.ANIMAL_CONTROL)){1611 } else if (tag.equals(CARDFILE.ANIMAL_CONTROL)) 1612 { 1445 1613 return cardfileData.getAnimalControlList(); 1446 } 1447 else if(tag.equals(CARDFILE.AIRPORTS)){1614 } else if (tag.equals(CARDFILE.AIRPORTS)) 1615 { 1448 1616 return cardfileData.getAirportsList(); 1449 } 1450 else if(tag.equals(CARDFILE.CREDIT_CARDS)){1617 } else if (tag.equals(CARDFILE.CREDIT_CARDS)) 1618 { 1451 1619 return cardfileData.getCreditCardsList(); 1452 } 1453 else if(tag.equals(CARDFILE.GG_CRISIS_SHELTERS)){1620 } else if (tag.equals(CARDFILE.GG_CRISIS_SHELTERS)) 1621 { 1454 1622 return cardfileData.getGgCrisisSheltersList(); 1455 } 1456 else if(tag.equals(CARDFILE.RANGES)){1623 } else if (tag.equals(CARDFILE.RANGES)) 1624 { 1457 1625 return cardfileData.getRangesList(); 1458 } 1459 else if(tag.equals(CARDFILE.HOTLINES)){1626 } else if (tag.equals(CARDFILE.HOTLINES)) 1627 { 1460 1628 return cardfileData.getHotlinesList(); 1461 } 1462 else if(tag.equals(CARDFILE.HWY_PATROLS_OOS)){1629 } else if (tag.equals(CARDFILE.HWY_PATROLS_OOS)) 1630 { 1463 1631 return cardfileData.getHwyPatrolsOosList(); 1464 } 1465 else if(tag.equals(CARDFILE.PARKS_RECREATION)){1632 } else if (tag.equals(CARDFILE.PARKS_RECREATION)) 1633 { 1466 1634 return cardfileData.getParksRecreationList(); 1467 } 1468 else if(tag.equals(CARDFILE.SHELTERS)){1635 } else if (tag.equals(CARDFILE.SHELTERS)) 1636 { 1469 1637 return cardfileData.getSheltersList(); 1470 } 1471 else if(tag.equals(CARDFILE.SL_COUNTY_SERVICES)){1638 } else if (tag.equals(CARDFILE.SL_COUNTY_SERVICES)) 1639 { 1472 1640 return cardfileData.getSlCountyServicesList(); 1473 } 1474 else if(tag.equals(CARDFILE.SL_RESOURCES)){1641 } else if (tag.equals(CARDFILE.SL_RESOURCES)) 1642 { 1475 1643 return cardfileData.getSlResourcesList(); 1476 } 1477 else if(tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)){1644 } else if (tag.equals(CARDFILE.TRUCK_TIRE_REPAIR)) 1645 { 1478 1646 return cardfileData.getTruckTireRepairList(); 1479 } 1480 else if(tag.equals(CARDFILE.MCC_EMPLOYEES)){1647 } else if (tag.equals(CARDFILE.MCC_EMPLOYEES)) 1648 { 1481 1649 return cardfileData.getMccEmployeesList(); 1482 } 1483 else if(tag.equals(CARDFILE.GATE_ACCESS_CODES)){1650 } else if (tag.equals(CARDFILE.GATE_ACCESS_CODES)) 1651 { 1484 1652 return cardfileData.getGateAccessCodesList(); 1485 } 1486 else if(tag.equals(CARDFILE.VT_CALL_SIGNS)){1653 } else if (tag.equals(CARDFILE.VT_CALL_SIGNS)) 1654 { 1487 1655 return cardfileData.getVtCallSignsList(); 1488 } 1489 else if(tag.equals(CARDFILE.SLCC_EMPLOYEES)){1656 } else if (tag.equals(CARDFILE.SLCC_EMPLOYEES)) 1657 { 1490 1658 return cardfileData.getSlccEmployeesList(); 1491 } 1492 else{1659 } else 1660 { 1493 1661 throw new RemoteException("Wrong Enum sent into Coordinator.getCardfileList"); 1494 1662 } 1495 1663 } 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 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 1503 1672 CardfileList selectedList; 1504 1505 if(log.listTitle.equals(CARDFILE.COASTAL_DIVISION_UNITS.tag)){ 1673 1674 if (log.listTitle.equals(CARDFILE.COASTAL_DIVISION_UNITS.tag)) 1675 { 1506 1676 selectedList = cardfileData.getCoastalDivisionUnitList(); 1507 } 1508 else if(log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)){1677 } else if (log.listTitle.equals(CARDFILE.POLICE_SHERIFF_CORONER.tag)) 1678 { 1509 1679 selectedList = cardfileData.getPoliceSheriffCoronerList(); 1510 } 1511 else if(log.listTitle.equals(CARDFILE.COURTS.tag)){1680 } else if (log.listTitle.equals(CARDFILE.COURTS.tag)) 1681 { 1512 1682 selectedList = cardfileData.getCourtsList(); 1513 } 1514 else if(log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)){1683 } else if (log.listTitle.equals(CARDFILE.PUBLIC_TRANSPORTATION.tag)) 1684 { 1515 1685 selectedList = cardfileData.getPublicTransportationList(); 1516 } 1517 else if(log.listTitle.equals(CARDFILE.GG_OTHER.tag)){1686 } else if (log.listTitle.equals(CARDFILE.GG_OTHER.tag)) 1687 { 1518 1688 selectedList = cardfileData.getGgOtherList(); 1519 } 1520 else if(log.listTitle.equals(CARDFILE.MY_MISC.tag)){1689 } else if (log.listTitle.equals(CARDFILE.MY_MISC.tag)) 1690 { 1521 1691 selectedList = cardfileData.getMyMiscList(); 1522 } 1523 else if(log.listTitle.equals(CARDFILE.SL_MISC.tag)){1692 } else if (log.listTitle.equals(CARDFILE.SL_MISC.tag)) 1693 { 1524 1694 selectedList = cardfileData.getSlMiscList(); 1525 } 1526 else if(log.listTitle.equals(CARDFILE.VT_MISC.tag)){1695 } else if (log.listTitle.equals(CARDFILE.VT_MISC.tag)) 1696 { 1527 1697 selectedList = cardfileData.getVlMiscList(); 1528 } 1529 else if(log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)){1698 } else if (log.listTitle.equals(CARDFILE.CHP_OFFICES.tag)) 1699 { 1530 1700 selectedList = cardfileData.getChpOfficesList(); 1531 } 1532 else if(log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)){1701 } else if (log.listTitle.equals(CARDFILE.STATE_AGENCIES_FACILITIES.tag)) 1702 { 1533 1703 selectedList = cardfileData.getStateAgenciesFacilitiesList(); 1534 } 1535 else if(log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)){1704 } else if (log.listTitle.equals(CARDFILE.GOVERNMENT_OFFICIALS.tag)) 1705 { 1536 1706 selectedList = cardfileData.getGovernmentOfficialsList(); 1537 } 1538 else if(log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)){1707 } else if (log.listTitle.equals(CARDFILE.FEDERAL_AGENCIES.tag)) 1708 { 1539 1709 selectedList = cardfileData.getFederalAgenciesList(); 1540 } 1541 else if(log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)){1710 } else if (log.listTitle.equals(CARDFILE.RANCHES_LIVESTOCK.tag)) 1711 { 1542 1712 selectedList = cardfileData.getRanchesLivestockList(); 1543 } 1544 else if(log.listTitle.equals(CARDFILE.FIRE_EMS.tag)){1713 } else if (log.listTitle.equals(CARDFILE.FIRE_EMS.tag)) 1714 { 1545 1715 selectedList = cardfileData.getFireEmsList(); 1546 } 1547 else if(log.listTitle.equals(CARDFILE.JAILS.tag)){1716 } else if (log.listTitle.equals(CARDFILE.JAILS.tag)) 1717 { 1548 1718 selectedList = cardfileData.getJailsList(); 1549 } 1550 else if(log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)){1719 } else if (log.listTitle.equals(CARDFILE.HOSPITALS_MED_CENTERS.tag)) 1720 { 1551 1721 selectedList = cardfileData.getHospitalsMedCentersList(); 1552 } 1553 else if(log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)){1722 } else if (log.listTitle.equals(CARDFILE.TOW_COMPANIES.tag)) 1723 { 1554 1724 selectedList = cardfileData.getTowCompaniesList(); 1555 } 1556 else if(log.listTitle.equals(CARDFILE.CALTRANS.tag)){1725 } else if (log.listTitle.equals(CARDFILE.CALTRANS.tag)) 1726 { 1557 1727 selectedList = cardfileData.getCalTransList(); 1558 } 1559 else if(log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)){1728 } else if (log.listTitle.equals(CARDFILE.COUNTY_ROADS.tag)) 1729 { 1560 1730 selectedList = cardfileData.getCountyRoadsList(); 1561 } 1562 else if(log.listTitle.equals(CARDFILE.UTILITIES.tag)){1731 } else if (log.listTitle.equals(CARDFILE.UTILITIES.tag)) 1732 { 1563 1733 selectedList = cardfileData.getUtilitiesList(); 1564 } 1565 else if(log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)){1734 } else if (log.listTitle.equals(CARDFILE.ANIMAL_CONTROL.tag)) 1735 { 1566 1736 selectedList = cardfileData.getAnimalControlList(); 1567 } 1568 else if(log.listTitle.equals(CARDFILE.AIRPORTS.tag)){1737 } else if (log.listTitle.equals(CARDFILE.AIRPORTS.tag)) 1738 { 1569 1739 selectedList = cardfileData.getAirportsList(); 1570 } 1571 else if(log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)){1740 } else if (log.listTitle.equals(CARDFILE.CREDIT_CARDS.tag)) 1741 { 1572 1742 selectedList = cardfileData.getCreditCardsList(); 1573 } 1574 else if(log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)){1743 } else if (log.listTitle.equals(CARDFILE.GG_CRISIS_SHELTERS.tag)) 1744 { 1575 1745 selectedList = cardfileData.getGgCrisisSheltersList(); 1576 } 1577 else if(log.listTitle.equals(CARDFILE.RANGES.tag)){1746 } else if (log.listTitle.equals(CARDFILE.RANGES.tag)) 1747 { 1578 1748 selectedList = cardfileData.getRangesList(); 1579 } 1580 else if(log.listTitle.equals(CARDFILE.HOTLINES.tag)){1749 } else if (log.listTitle.equals(CARDFILE.HOTLINES.tag)) 1750 { 1581 1751 selectedList = cardfileData.getHotlinesList(); 1582 } 1583 else if(log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)){1752 } else if (log.listTitle.equals(CARDFILE.HWY_PATROLS_OOS.tag)) 1753 { 1584 1754 selectedList = cardfileData.getHwyPatrolsOosList(); 1585 } 1586 else if(log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)){1755 } else if (log.listTitle.equals(CARDFILE.PARKS_RECREATION.tag)) 1756 { 1587 1757 selectedList = cardfileData.getParksRecreationList(); 1588 } 1589 else if(log.listTitle.equals(CARDFILE.SHELTERS.tag)){1758 } else if (log.listTitle.equals(CARDFILE.SHELTERS.tag)) 1759 { 1590 1760 selectedList = cardfileData.getSheltersList(); 1591 } 1592 else if(log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)){1761 } else if (log.listTitle.equals(CARDFILE.SL_COUNTY_SERVICES.tag)) 1762 { 1593 1763 selectedList = cardfileData.getSlCountyServicesList(); 1594 } 1595 else if(log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)){1764 } else if (log.listTitle.equals(CARDFILE.SL_RESOURCES.tag)) 1765 { 1596 1766 selectedList = cardfileData.getSlResourcesList(); 1597 } 1598 else if(log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)){1767 } else if (log.listTitle.equals(CARDFILE.TRUCK_TIRE_REPAIR.tag)) 1768 { 1599 1769 selectedList = cardfileData.getTruckTireRepairList(); 1600 } 1601 else if(log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)){1770 } else if (log.listTitle.equals(CARDFILE.MCC_EMPLOYEES.tag)) 1771 { 1602 1772 selectedList = cardfileData.getMccEmployeesList(); 1603 } 1604 else if(log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)){1773 } else if (log.listTitle.equals(CARDFILE.GATE_ACCESS_CODES.tag)) 1774 { 1605 1775 selectedList = cardfileData.getGateAccessCodesList(); 1606 } 1607 else if(log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)){1776 } else if (log.listTitle.equals(CARDFILE.VT_CALL_SIGNS.tag)) 1777 { 1608 1778 selectedList = cardfileData.getVtCallSignsList(); 1609 } 1610 else if(log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)){1779 } else if (log.listTitle.equals(CARDFILE.SLCC_EMPLOYEES.tag)) 1780 { 1611 1781 selectedList = cardfileData.getSlccEmployeesList(); 1612 } 1613 else{1782 } else 1783 { 1614 1784 throw new RemoteException("Wrong Enum sent into Coordinator.editCardfileDataObject"); 1615 1785 } 1616 1786 1617 1787 CardfileDataObject cfdo = cardfileData.getCardfileDataObject(selectedList, log.id); 1618 if(cfdo != null && log.command.equals(EditCommand.NAME)){ 1788 if (cfdo != null && log.command.equals(EditCommand.NAME)) 1789 { 1619 1790 cfdo.setName(log.newValue); 1620 selectedList.resort(cardfileData.getCardfileDataIndex(selectedList, log.id));1621 } 1622 else if(cfdo != null && log.command.equals(EditCommand.ADDRESS)){1791 selectedList.resort(cardfileData.getCardfileDataIndex(selectedList, log.id)); 1792 } else if (cfdo != null && log.command.equals(EditCommand.ADDRESS)) 1793 { 1623 1794 cfdo.setAddress(log.newValue); 1624 } 1625 else if(cfdo != null && log.command.equals(EditCommand.CITY)){1795 } else if (cfdo != null && log.command.equals(EditCommand.CITY)) 1796 { 1626 1797 cfdo.setCity(log.newValue); 1627 } 1628 else if(cfdo != null && log.command.equals(EditCommand.STATE)){1798 } else if (cfdo != null && log.command.equals(EditCommand.STATE)) 1799 { 1629 1800 cfdo.setState(log.newValue); 1630 } 1631 else if(cfdo != null && log.command.equals(EditCommand.ZIP)){1801 } else if (cfdo != null && log.command.equals(EditCommand.ZIP)) 1802 { 1632 1803 cfdo.setZip(log.newValue); 1633 } 1634 else if(cfdo != null && log.command.equals(EditCommand.PHONE1)){1804 } else if (cfdo != null && log.command.equals(EditCommand.PHONE1)) 1805 { 1635 1806 cfdo.setPhone1(log.newValue); 1636 } 1637 else if(cfdo != null && log.command.equals(EditCommand.PHONE2)){1807 } else if (cfdo != null && log.command.equals(EditCommand.PHONE2)) 1808 { 1638 1809 cfdo.setPhone2(log.newValue); 1639 } 1640 else if(cfdo != null && log.command.equals(EditCommand.FAX)){1810 } else if (cfdo != null && log.command.equals(EditCommand.FAX)) 1811 { 1641 1812 cfdo.setFax(log.newValue); 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)){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 { 1647 1818 selectedList.addDataObject(log.newCardfileObject); 1648 } 1649 else if(log.command.equals(EditCommand.TABLE_ADD)){ 1650 if(cfdo != null){ 1651 cfdo.addComment(log.tableFields); 1819 } else if (log.command.equals(EditCommand.TABLE_ADD)) 1820 { 1821 if (cfdo != null) 1822 { 1823 cfdo.addComment(log.tableFields); 1652 1824 } 1653 } 1654 else if(log.command.equals(EditCommand.TABLE_DELETE)){ 1655 if(cfdo != null){ 1825 } else if (log.command.equals(EditCommand.TABLE_DELETE)) 1826 { 1827 if (cfdo != null) 1828 { 1656 1829 cfdo.removeComment(log.timeStamp); 1657 1830 } 1658 } 1659 else{ 1660 1661 } 1662 1663 1664 } 1665 1831 } else 1832 { 1833 } 1834 1835 1836 } 1837 1666 1838 /** 1667 1839 * Obtain a new unique ID for a cardfileDataObject. 1668 1840 */ 1669 public int obtainNewUniqueId() throws RemoteException{ 1841 public int obtainNewUniqueId() throws RemoteException 1842 { 1670 1843 return cardfileData.obtainNewUniqueId(); 1671 1844 } 1672 1845 1673 1846 /** 1674 1847 * Returns a value from Unit based on tag. 1848 * 1675 1849 * @param unitNum the unitNum to look up 1676 * @throws RemoteException 1677 */ 1678 public UnitStatusEnums getCadDataUnitStatus(String unitNum) throws RemoteException{ 1850 * @throws RemoteException 1851 */ 1852 public UnitStatusEnums getCadDataUnitStatus(String unitNum) throws RemoteException 1853 { 1679 1854 return cadData.getUnit(unitNum).getUnitStatus(); 1680 1855 } 1681 1856 1682 1857 /** 1683 1858 * Returns a string field from Unit based on tag. 1859 * 1684 1860 * @param tag a CADScriptTags tag 1685 1861 * @param unitNum the unitNum to look up … … 1687 1863 * @throws RemoteException 1688 1864 */ 1689 public String getCadDataUnitValue(String unitNum, UNIT_TAGS tag) throws RemoteException{ 1690 if(tag.equals(UNIT_TAGS.MASTER_INC_NUM)){ 1865 public String getCadDataUnitValue(String unitNum, UNIT_TAGS tag) throws RemoteException 1866 { 1867 if (tag.equals(UNIT_TAGS.MASTER_INC_NUM)) 1868 { 1691 1869 return cadData.getUnit(unitNum).getMasterInc(); 1692 } 1693 else if(tag.equals(UNIT_TAGS.STATUS)){1870 } else if (tag.equals(UNIT_TAGS.STATUS)) 1871 { 1694 1872 return cadData.getUnit(unitNum).getStatus(); 1695 } 1696 else if(tag.equals(UNIT_TAGS.OOS)){1873 } else if (tag.equals(UNIT_TAGS.OOS)) 1874 { 1697 1875 return cadData.getUnit(unitNum).getOos(); 1698 } 1699 else if(tag.equals(UNIT_TAGS.TYPE)){1876 } else if (tag.equals(UNIT_TAGS.TYPE)) 1877 { 1700 1878 return cadData.getUnit(unitNum).getType(); 1701 } 1702 else if(tag.equals(UNIT_TAGS.CURR_LOC)){1879 } else if (tag.equals(UNIT_TAGS.CURR_LOC)) 1880 { 1703 1881 return cadData.getUnit(unitNum).getCurrentLocation(); 1704 } 1705 else if(tag.equals(UNIT_TAGS.DESTINATION)){1882 } else if (tag.equals(UNIT_TAGS.DESTINATION)) 1883 { 1706 1884 return cadData.getUnit(unitNum).getDestination(); 1707 } 1708 else if(tag.equals(UNIT_TAGS.MISC_INFO)){1885 } else if (tag.equals(UNIT_TAGS.MISC_INFO)) 1886 { 1709 1887 return cadData.getUnit(unitNum).getMisc(); 1710 } 1711 else if(tag.equals(UNIT_TAGS.STACK)){1888 } else if (tag.equals(UNIT_TAGS.STACK)) 1889 { 1712 1890 return cadData.getUnit(unitNum).getStack(); 1713 } 1714 else if(tag.equals(UNIT_TAGS.AREA)){1891 } else if (tag.equals(UNIT_TAGS.AREA)) 1892 { 1715 1893 return cadData.getUnit(unitNum).getArea(); 1716 } 1717 else if(tag.equals(UNIT_TAGS.OFFICER)){1894 } else if (tag.equals(UNIT_TAGS.OFFICER)) 1895 { 1718 1896 return cadData.getUnit(unitNum).getOfficer(); 1719 } 1720 else if(tag.equals(UNIT_TAGS.BADGE_NUM)){1897 } else if (tag.equals(UNIT_TAGS.BADGE_NUM)) 1898 { 1721 1899 return cadData.getUnit(unitNum).getBadge(); 1722 } 1723 else if(tag.equals(UNIT_TAGS.TIMER)){1900 } else if (tag.equals(UNIT_TAGS.TIMER)) 1901 { 1724 1902 return cadData.getUnit(unitNum).getTimerInString(); 1725 } 1726 else if(tag.equals(UNIT_TAGS.OFFICE)){1903 } else if (tag.equals(UNIT_TAGS.OFFICE)) 1904 { 1727 1905 return cadData.getUnit(unitNum).getOffice(); 1728 } 1729 else if(tag.equals(UNIT_TAGS.P)){1906 } else if (tag.equals(UNIT_TAGS.P)) 1907 { 1730 1908 return cadData.getUnit(unitNum).getP(); 1731 } 1732 else if(tag.equals(UNIT_TAGS.AGY)){1909 } else if (tag.equals(UNIT_TAGS.AGY)) 1910 { 1733 1911 return cadData.getUnit(unitNum).getAgy(); 1734 } 1735 else if(tag.equals(UNIT_TAGS.ALIAS)){1912 } else if (tag.equals(UNIT_TAGS.ALIAS)) 1913 { 1736 1914 return cadData.getUnit(unitNum).getAlias(); 1737 } 1738 else{1915 } else 1916 { 1739 1917 throw new RemoteException("Wrong Enum sent into Coordinator.getCadDataUnitValue"); 1740 1918 } … … 1743 1921 /** 1744 1922 * Sets a field from Unit based on tag. 1923 * 1745 1924 * @param tag a CADScriptTags tag 1746 1925 * @param unitNum the unitNum to look up … … 1748 1927 * @throws RemoteException 1749 1928 */ 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{ 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 { 1800 1981 throw new RemoteException("Wrong Enum sent into Coordinator.setCadDataUnitValue"); 1801 1982 } 1802 1983 } 1803 1984 1804 1985 /** 1805 1986 * Assigns a unit to the specified incident. 1987 * 1806 1988 * @param unitNum the unitNum to look up 1807 1989 * @param id the incident id that this unit is assigned to. 1808 1990 * @throws RemoteException 1809 1991 */ 1810 public void setCadDataUnitAssignedId(String unitNum, int id) throws RemoteException{ 1992 public void setCadDataUnitAssignedId(String unitNum, int id) throws RemoteException 1993 { 1811 1994 cadData.getUnit(unitNum).setAssignedIncidentId(id); 1812 1995 } 1813 1996 1814 1997 /** 1815 1998 * Adds a unit to the incident's list of assigned units. 1999 * 1816 2000 * @param incidentId the incident 1817 2001 * @param assignedUnitNum the unit that's been assigned to the incident 1818 2002 * @throws RemoteException 1819 2003 */ 1820 public void addCadDataIncidentAssignedUnitNum(int incidentId, String assignedUnitNum) throws RemoteException{ 2004 public void addCadDataIncidentAssignedUnitNum(int incidentId, String assignedUnitNum) throws RemoteException 2005 { 1821 2006 cadData.getIncident(incidentId).addAssignedUnitNum(assignedUnitNum); 1822 2007 } 1823 2008 1824 2009 /** 1825 2010 * Sets the specified incident to the specified status. 2011 * 1826 2012 * @param incidentId the incident 1827 2013 * @param status the status of the incident 1828 2014 * @throws RemoteException 1829 2015 */ 1830 public void setCadDataIncidentStatus(int incidentId, IncidentEnums status) throws RemoteException{ 2016 public void setCadDataIncidentStatus(int incidentId, IncidentEnums status) throws RemoteException 2017 { 1831 2018 cadData.getIncident(incidentId).setIncidentStatus(status); 1832 2019 } 1833 1834 /** 2020 2021 /** 1835 2022 * Returns a LinkedList containing entries that match the search string. 2023 * 1836 2024 * @param search the string entry to be searched 1837 2025 * @return linked list of CardfileDataObjects matching search 1838 2026 */ 1839 public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException{ 2027 public LinkedList<CardfileDataObject> getSearchList(String search) throws RemoteException 2028 { 1840 2029 return cardfileData.getSearchList(search); 1841 2030 } 1842 1843 /** 1844 * Updates the server database so clients can view additional informations as events complete 2031 2032 /** 2033 * Updates the server database so clients can view additional informations 2034 * as events complete 2035 * 1845 2036 * @param incidentNumber the incident in which the event occurred 1846 * @return completedEvent IncidentEvent with information to be added to server database 1847 */ 1848 public void updateIncidentInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 2037 * @return completedEvent IncidentEvent with information to be added to 2038 * server database 2039 */ 2040 public void updateIncidentInGUI(Integer incidentNumber, IncidentEvent completedEvent) 2041 { 1849 2042 updateDetailsInGUI(incidentNumber, completedEvent); 1850 2043 updateUnitsInGUI(incidentNumber, completedEvent); 1851 2044 } 1852 1853 /** 1854 * Updates the server database so clients can view details as events complete 2045 2046 /** 2047 * Updates the server database so clients can view details as events 2048 * complete 2049 * 1855 2050 * @param incidentNumber the incident in which the event occurred 1856 * @return completedEvent IncidentEvent with details to be added to server database 1857 */ 1858 public void updateDetailsInGUI(Integer incidentNumber, IncidentEvent completedEvent) { 2051 * @return completedEvent IncidentEvent with details to be added to server 2052 * database 2053 */ 2054 public void updateDetailsInGUI(Integer incidentNumber, IncidentEvent completedEvent) 2055 { 1859 2056 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 1860 2057 DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 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{ 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 { 1867 2069 addCadDataIncidentTable(INC_TABLE.COMMENTS_NOTES, incidentNumber, fields); 1868 }catch(RemoteException e){ 2070 } catch (RemoteException e) 2071 { 1869 2072 e.printStackTrace(); 1870 } 1871 } 1872 } 1873 1874 /** 1875 * Updates the server database so clients can view unit updates as events complete 2073 } 2074 } 2075 } 2076 2077 /** 2078 * Updates the server database so clients can view unit updates as events 2079 * complete 2080 * 1876 2081 * @param incidentNumber the incident in which the event occurred 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++){ 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 { 1881 2089 IncidentInquiryUnitsAssigned unit = completedEvent.eventInfo.getUnits().get(i); 1882 if(unit.statusType.equals("ENRT")){ 2090 if (unit.statusType.equals("ENRT")) 2091 { 1883 2092 cadData.unitAssignedToIncident(unit.beat, incidentNumber, unit.isPrimary); 1884 }else if(unit.statusType.equals("1097")){ 2093 } else if (unit.statusType.equals("1097")) 2094 { 1885 2095 cadData.unitArrivedAtIncidentScene(unit.beat, incidentNumber, unit.isPrimary); 1886 }else if(unit.statusType.equals("1098")){ 2096 } else if (unit.statusType.equals("1098")) 2097 { 1887 2098 cadData.unitAvailable(unit.beat); 1888 2099 } 1889 2100 } 1890 2101 } 1891 2102 1892 2103 /** 1893 2104 * Sets the specified incidentNumber to viewable in the GUI. 2105 * 1894 2106 * @param incidentNumber the number of the Incident started 1895 2107 */ 1896 public void incidentStartedInGUI(Integer incidentNumber){ 2108 public void incidentStartedInGUI(Integer incidentNumber) 2109 { 1897 2110 Date date = new Date(); 1898 2111 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
Note: See TracChangeset
for help on using the changeset viewer.
