<commit_before>/*
 * Created by Wiser Research Group UFBA
 */
package br.dcc.ufba.wiser.smartufba.services.sensor;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

import br.ufba.dcc.wiser.smartufba.tatu.drivers.DriverMQTT;

@Path("/devices/sensor/humidity")
public class HumidityService {

    public HumidityService() {
    }

    @GET
    @Produces("application/json")
    public Response getHumidity(){
        ResponseBuilder rb;
        XmlErrorClass x = new XmlErrorClass();
        Humidity h = new Humidity();
        
        try{
            DriverMQTT humidity = new DriverMQTT("temp-lamp", "device", "boteco@wiser");
            String percent = humidity.getInfo("ar");

            h.setPercent(percent);

            rb = Response.ok(h);
        } catch (Exception e) {
            x.setStatus(true);
            rb = Response.ok(x);
        }

        return rb.header("Access-Control-Allow-Origin", "*")
                .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
                .header("Access-Control-Allow-Headers", "Content-Type")
                .allow("OPTIONS")
                .build();
        
    }
}<commit_msg>humidade mudado<commit_after>/*
 * Created by Wiser Research Group UFBA
 */
package br.dcc.ufba.wiser.smartufba.services.sensor;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;

import br.ufba.dcc.wiser.smartufba.tatu.drivers.DriverMQTT;

@Path("/devices/sensor/humidity")
public class HumidityService {

    public HumidityService() {
    }

    @GET
    @Produces("application/json")
    public Response getHumidity(){
        ResponseBuilder rb;
        XmlErrorClass x = new XmlErrorClass();
        Humidity h = new Humidity();
        
        try{
            DriverMQTT humidity = new DriverMQTT("temp-lamp", "device", "boteco@wiser");
            String percent = humidity.getInfo("humid");

            h.setPercent(percent);

            rb = Response.ok(h);
        } catch (Exception e) {
            x.setStatus(true);
            rb = Response.ok(x);
        }

        return rb.header("Access-Control-Allow-Origin", "*")
                .header("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT")
                .header("Access-Control-Allow-Headers", "Content-Type")
                .allow("OPTIONS")
                .build();
        
    }
}
{'fraction_non_alphanumeric': 0.13432253026161656, 'fraction_numerical': 0.0, 'mean_word_length': 2.2762148337595907, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5634326', 'n_tokens_mistral': 813, 'n_tokens_neox': 777, 'n_words': 145}