Package com.wordpress.salaboy.model

Examples of com.wordpress.salaboy.model.Emergency


    public void accumulate(Serializable context, Object value) {
        ContextData contextData = (ContextData)context;
       
        HospitalDistanceCalculationData data = (HospitalDistanceCalculationData)value;
        Hospital currentHospital = data.getHospital();
        Emergency emergency = data.getEmergency();
       
        float difX = currentHospital.getX() - xs[emergency.getLocation().getLocationX()];
        float difY = currentHospital.getY() - ys[emergency.getLocation().getLocationY()];
       
        double difTotal = Math.sqrt(Math.pow(((double)difX),2d) + Math.pow(((double)difY),2d));
       
        if(contextData.selectedHospital == null || difTotal < contextData.minDistance){
            contextData.minDistance = difTotal;
View Full Code Here


    public void accumulate(Serializable context, Object value) {
        ContextData contextData = (ContextData)context;
       
        FirefightersDepartmentDistanceCalculationData data = (FirefightersDepartmentDistanceCalculationData)value;
        FirefightersDepartment currentDepartment = data.getDepartment();
        Emergency emergency = data.getEmergency();
       
        float difX = currentDepartment.getX() - xs[emergency.getLocation().getLocationX()];
        float difY = currentDepartment.getY() - ys[emergency.getLocation().getLocationY()];
       
        double difTotal = Math.sqrt(Math.pow(((double)difX),2d) + Math.pow(((double)difY),2d));
       
        if(contextData.selectedDepartment == null || difTotal < contextData.minDistance){
            contextData.minDistance = difTotal;
View Full Code Here

        assertNotSame("", call.getId());

        call = persistenceService.loadCall(call.getId());
        assertNotNull(call);

        Emergency emergency = new Emergency();
        persistenceService.storeEmergency(emergency);
        assertNotSame("", emergency.getId());

        emergency = persistenceService.loadEmergency(emergency.getId());
        assertNotNull(emergency);
       
        trackingService.attachEmergency(call.getId(), emergency.getId());

        Procedure procedure = new Procedure("MyProcedure");
        persistenceService.storeProcedure(procedure);
        assertNotSame("", procedure.getId());

        procedure = persistenceService.loadProcedure(procedure.getId());
        assertNotNull(procedure);

        trackingService.attachProcedure(emergency.getId(), procedure.getId());


        Vehicle vehicle = new Ambulance();

        persistenceService.storeVehicle(vehicle);
        assertNotSame("", vehicle.getId());

        vehicle = persistenceService.loadVehicle(vehicle.getId());
        assertNotNull(vehicle);


        trackingService.attachVehicle(procedure.getId(), vehicle.getId());

        Vehicle vehicle2 = new FireTruck();
        persistenceService.storeVehicle(vehicle2);
        assertNotSame("", vehicle2.getId());

        vehicle2 = persistenceService.loadVehicle(vehicle2.getId());
        assertNotNull(vehicle2);

        trackingService.attachVehicle(procedure.getId(), vehicle2.getId());

        ServiceChannel channel = new ServiceChannel("MyChannel");
        persistenceService.storeServiceChannel(channel);
        assertNotSame("", channel.getId());
       
        channel = persistenceService.loadServiceChannel(channel.getId());
        assertNotNull(channel);
       
        trackingService.attachServiceChannel(emergency.getId(), channel.getId());


        CypherParser parser = new CypherParser();
        ExecutionEngine engine = new ExecutionEngine(trackingService.getGraphDb());
View Full Code Here

        assertNotSame("", call.getId());

        call = persistenceService.loadCall(call.getId());
        assertNotNull(call);

        Emergency emergency = new Emergency();
        persistenceService.storeEmergency(emergency);
        assertNotSame("", emergency.getId());

        emergency = persistenceService.loadEmergency(emergency.getId());
        assertNotNull(emergency);
       
        trackingService.attachEmergency(call.getId(), emergency.getId());

        Procedure procedure = new Procedure("MyProcedure");
        persistenceService.storeProcedure(procedure);
        assertNotSame("", procedure.getId());

        procedure = persistenceService.loadProcedure(procedure.getId());
        assertNotNull(procedure);

        trackingService.attachProcedure(emergency.getId(), procedure.getId());


        Vehicle vehicle = new Ambulance();

        persistenceService.storeVehicle(vehicle);
        assertNotSame("", vehicle.getId());

        vehicle = persistenceService.loadVehicle(vehicle.getId());
        assertNotNull(vehicle);


        trackingService.attachVehicle(procedure.getId(), vehicle.getId());

        Vehicle vehicle2 = new FireTruck();
        persistenceService.storeVehicle(vehicle2);
        assertNotSame("", vehicle2.getId());

        vehicle2 = persistenceService.loadVehicle(vehicle2.getId());
        assertNotNull(vehicle2);

        trackingService.attachVehicle(procedure.getId(), vehicle2.getId());

        ServiceChannel channel = new ServiceChannel("MyChannel");
        persistenceService.storeServiceChannel(channel);
        assertNotSame("", channel.getId());
       
        channel = persistenceService.loadServiceChannel(channel.getId());
        assertNotNull(channel);
       
        trackingService.attachServiceChannel(emergency.getId(), channel.getId());


        CypherParser parser = new CypherParser();
        ExecutionEngine engine = new ExecutionEngine(trackingService.getGraphDb());
View Full Code Here

        call = new Call(1, 2, new Date());
        assertEquals(0, persistenceService.getAllCalls().size());
        persistenceService.storeCall(call);
        assertEquals(1, persistenceService.getAllCalls().size());
        emergency = new Emergency();
        emergency.setCall(call);
        emergency.setLocation(new Location(1, 2));
        emergency.setType(Emergency.EmergencyType.HEART_ATTACK);
        emergency.setNroOfPeople(1);
        assertEquals(0, persistenceService.getAllEmergencies().size());
View Full Code Here

            @Override
            public void handleMessage(VehicleDispatchedMessage vehicleDispatchedMessage) {
                String vehicleId = vehicleDispatchedMessage.getVehicleId();
                String callId = ContextTrackingProvider.getTrackingService().getCallAttachedToEmergency(vehicleDispatchedMessage.getEmergencyId());
                Emergency emergency = PersistenceServiceProvider.getPersistenceService().loadEmergency(vehicleDispatchedMessage.getEmergencyId());
                System.out.println("Emergency Type = "+emergency.getType());
                if (emergency.getType() == Emergency.EmergencyType.HEART_ATTACK){
                    cboVehicleId.addItem(vehicleId);
                    cboVehicleId.setSelectedItem(vehicleId);
                    cboCallId.setSelectedItem(callId);
                   
                }
View Full Code Here

  protected Map<String, Object> generateOutputForForm(String form,
      Map<String, String> data) {
    // TODO for now, only for phone call form
    Map<String, Object> info = new HashMap<String, Object>();
    Emergency emergency = new Emergency();

    // persists the emergency
    Location location = new Location();
    location.setLocationX(Integer.parseInt(data.get("Location X")));
    location.setLocationY(Integer.parseInt(data.get("Location Y")));
    emergency.setLocation(location);
    if (data.get("Number Of People") != null) {
      emergency.setNroOfPeople(Integer.valueOf(Integer.parseInt(data
          .get("Number Of People"))));
    } else {
      // this patch is because in the process we currently use fire
      // intensity taken from nro of people :S
      emergency.setNroOfPeople(Integer.valueOf(Integer.parseInt(data
          .get("Intensity"))));
    }
    emergency.setType(data.get("Emergency Type"));
    emergency.setCall(callsById.get(data.get("callId")));
    new DistributedService().getDistributedService().storeEmergency(
        emergency);
    info.put("emergency", emergency);
    return info;
  }
View Full Code Here

    public void setUp() throws Exception {
        HumanTaskServerService.getInstance().initTaskServer();

        initializePersistenceAndTracking();

        emergency = new Emergency();


        fireTruck = new FireTruck("FireTruck 1");
        persistenceService.storeVehicle(fireTruck);
View Full Code Here

    @Override
    public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
        //Call Tracking Component for process?? or the ProcedureMGMTService can take care of that?
        Call call = (Call) wi.getParameter("call");
        String procedureName = (String) wi.getParameter("procedureName");
        Emergency emergency = (Emergency) wi.getParameter("emergency");
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("call", call);
        parameters.put("emergency", emergency);
//        ProceduresMGMTService.getInstance().newRequestedProcedure(emergency.getId(), procedureName, parameters);

        System.out.println("LET'S CREATE a new procedure name in a remote location = "+procedureName+" for emergency "+emergency);
       
        try {
            MessageFactory.sendMessage(new AsyncProcedureStartMessage(emergency.getId(), wi.getId(), procedureName, parameters));
        } catch (HornetQException ex) {
            Logger.getLogger(AsyncStartProcedureWorkItemHandler.class.getName()).log(Level.SEVERE, null, ex);
        }
        wim.completeWorkItem(wi.getId(), null);
    }
View Full Code Here

    @Override
    public void executeWorkItem(WorkItem wi, WorkItemManager wim) {
        //Call Tracking Component for process?? or the ProcedureMGMTService can take care of that?
        Call call = (Call) wi.getParameter("call");
        String procedureName = (String) wi.getParameter("procedureName");
        Emergency emergency = (Emergency) wi.getParameter("emergency");
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("call", call);
        parameters.put("emergency", emergency);
        try {
            ProceduresMGMTService.getInstance().newRequestedProcedure(emergency.getId(), procedureName, parameters);
        } catch (IOException ex) {
            Logger.getLogger(StartProcedureWorkItemHandler.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println("I'm going out of here!!!!!!");
        wim.completeWorkItem(wi.getId(), null);
View Full Code Here

TOP

Related Classes of com.wordpress.salaboy.model.Emergency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.