Examples of Ambulance


Examples of com.wordpress.salaboy.model.Ambulance

        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());


        //Give me all the vehicle associated with the procedures that are part of the emergency that was created by this phoneCallId
        Query query = parser.parse("start n=(calls, 'callId:" + call.getId() + "')  match (n)-[r:CREATES]->(x)-[i:INSTANTIATE]-> (w) -[u:USE]->v  return v");

        ExecutionResult result = engine.execute(query);
        Iterator<Node> n_column = result.columnAs("v");


        System.out.println("results: " + result);
        assertEquals(2, result.size());
        while (n_column.hasNext()) {
            Node currentNode = n_column.next();
            for (String key : currentNode.getPropertyKeys()) {
                System.out.println("Property (" + key + "): " + currentNode.getProperty(key));
            }
        }


        query = parser.parse("start v=(vehicles, 'vehicleId:" + vehicle.getId() + "')  match (v) <-[USE]- (w)    return w");
       
        //query = parser.parse("start s=(procedures, 'procedureId:" + procedure.getId() + "')  match (s) <-[SUB]- (p)    return p");

        result = engine.execute(query);
        n_column = result.columnAs("w");
View Full Code Here

Examples of com.wordpress.salaboy.model.Ambulance

        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());


        //Give me all the vehicle associated with the procedures that are part of the emergency that was created by this phoneCallId
        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod("http://localhost:7575/db/data/ext/CypherPlugin/graphdb/execute_query");
        method.setRequestHeader("Content-type", "application/json");
        method.setRequestHeader("Accept", "application/json");
        String content = "{\"query\": \"start n=(calls, 'callId:" + call.getId() + "')  match (n)-[r:CREATES]->(x)-[i:INSTANTIATE]-> (w) -[u:USE]->v  return v\"}";
        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        Gson gson = new Gson();

    QueryResult result = gson.fromJson(method.getResponseBodyAsString(),
        new TypeToken<QueryResult>() {
        }.getType());

    System.out.println("results: " + result);
    Assert.assertEquals(2, result.getData().size());
    for (List<ResponseNode> data : result.getData()) {
      Map<String, String> props = data.get(0).getData();
      for (String key : props.keySet()) {
        System.out.println("Property ("+key+"): "+props.get(key));
      }
    }

        client = new HttpClient();
        method = new PostMethod("http://localhost:7575/db/data/ext/CypherPlugin/graphdb/execute_query");
        method.setRequestHeader("Content-type", "application/json");
        method.setRequestHeader("Accept", "application/json");
        content = "{\"query\": \"start v=(vehicles, 'vehicleId:" + vehicle.getId() + "')  match (v) <-[USE]- (w)    return w\"}";
        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        gson = new Gson();
View Full Code Here

Examples of com.wordpress.salaboy.model.Ambulance

        assertEquals(1, persistenceService.getAllEmergencies().size());
        trackingService.attachEmergency(call.getId(), emergency.getId());
       
        persistenceService.storeHospital(new Hospital("My Hospital", 12, 1));
        assertEquals(0, persistenceService.getAllVehicles().size());
        ambulance1 = new Ambulance("My Ambulance Number 1");
        persistenceService.storeVehicle(ambulance1);
        ambulance2 = new Ambulance("My Ambulance Number 2");
        persistenceService.storeVehicle(ambulance2);
        assertEquals(2, persistenceService.getAllVehicles().size());
        MessageServerSingleton.getInstance().start();

        this.coreServicesMap = new HashMap();
View Full Code Here

Examples of com.wordpress.salaboy.model.Ambulance

        assertNotNull(value, "1,1");


        Map<String, Object> info = new HashMap<String, Object>();
        List<Vehicle> vehicles = new ArrayList<Vehicle>();
        Ambulance ambulance = new Ambulance("My Ambulance", new Date());
        String ambulanceId = trackingService.newVehicleId();
        ambulance.setId(ambulanceId);
        vehicles.add(ambulance);
        //ContextTrackingServiceImpl.getInstance().attachVehicle(, ambulanceId);
        info.put("emergency.vehicles", selectedVehicles);

        humanTaskServiceClient.complete(task.getId(), info);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.