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";
}
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;
}
}
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));
}
Aggregations