@DELETE @Path("/del") public void delete(@QueryParam("id") long id) { System.out.println("deleteTemperature"); TemperatureEntity temperature = temperatureEJB.findTemperatureById(id); if (temperature != null) { temperatureEJB.deleteTemperature(temperature); } }
@GET @Path("/get") @Consumes(MediaType.APPLICATION_XML) public Temperature read(@QueryParam("id") long id) { System.out.println("readTemperature"); return temperatureEJB.findTemperatureById(id).toTemperatureData(); }
@GET @Path("/get/sensors") @Consumes(MediaType.APPLICATION_XML) public List<Sensor> findSensorWithTemperature() { System.out.println("findSensorWithTemperature"); List<SensorEntity> sensors = temperatureEJB.findSensorWithTemperature(); List<Sensor> lSensors = new ArrayList<Sensor>(); for (SensorEntity sensor : sensors) { lSensors.add(sensor.toSensorData()); } return lSensors; }
@GET @Path("/get/temperature") @Consumes(MediaType.APPLICATION_XML) public List<Temperature> findTemperature() { System.out.println("findTemperature"); List<TemperatureEntity> temperatures = temperatureEJB.findTemperature(); List<Temperature> lTemperatures = new ArrayList<Temperature>(); for (TemperatureEntity temperature : temperatures) { lTemperatures.add(temperature.toTemperatureData()); } return lTemperatures; }
@PUT @Consumes(MediaType.APPLICATION_XML) public void update(Temperature temperature) { System.out.println("updateTemperature"); temperatureEJB.updateTemperature(temperature.toTemperature()); }