Search in sources :

Example 1 with Agent

use of io.github.asw.i3a.operatorsWebClient.entitites.Agent in project InciDashboard_i3a by Arquisoft.

the class AgentController method getDetail.

@RequestMapping("/agent/sensorDetails/{id}")
public String getDetail(Model model, @PathVariable String id, @Nullable @CookieValue("operatorId") String opId) {
    if (opId == null)
        return "redirect:/login";
    Agent sen = AgentService.getAgent(id);
    log.info("Deatils of sensor: " + id);
    model.addAttribute("sensor", sen);
    if (sen.getLocation() != "") {
        model.addAttribute("lat", Double.parseDouble(sen.getLocation().split(", ")[0]));
        model.addAttribute("lng", Double.parseDouble(sen.getLocation().split(", ")[1]));
    }
    log.info("Location: " + sen.getLocation());
    return "agent/detailsSensor";
}
Also used : Agent(io.github.asw.i3a.operatorsWebClient.entitites.Agent) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Agent

use of io.github.asw.i3a.operatorsWebClient.entitites.Agent in project InciDashboard_i3a by Arquisoft.

the class AgentService method getAllSensors.

public static Agent[] getAllSensors() {
    try {
        HttpResponse<JsonNode> response = Unirest.post(API_GATEWAY + "/agents?kindCode=3").asJson();
        ObjectMapper mapper = new ObjectMapper();
        Agent[] items = mapper.readValue(response.getBody().toString(), Agent[].class);
        return items;
    } catch (IOException | UnirestException e) {
        e.printStackTrace();
        return null;
    }
}
Also used : Agent(io.github.asw.i3a.operatorsWebClient.entitites.Agent) UnirestException(com.mashape.unirest.http.exceptions.UnirestException) JsonNode(com.mashape.unirest.http.JsonNode) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 3 with Agent

use of io.github.asw.i3a.operatorsWebClient.entitites.Agent in project InciDashboard_i3a by Arquisoft.

the class AgentTest method extraTest.

@Test
public void extraTest() {
    Agent a = new Agent();
    Agent a2 = new Agent();
    assertTrue(a.canEquals(a2));
}
Also used : Agent(io.github.asw.i3a.operatorsWebClient.entitites.Agent) UnitTest(TestKit.UnitTest) Test(org.junit.Test)

Aggregations

Agent (io.github.asw.i3a.operatorsWebClient.entitites.Agent)3 UnitTest (TestKit.UnitTest)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonNode (com.mashape.unirest.http.JsonNode)1 UnirestException (com.mashape.unirest.http.exceptions.UnirestException)1 IOException (java.io.IOException)1 Test (org.junit.Test)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1