<commit_before>package boundary.Question;

import boundary.Representation;
import com.wordnik.swagger.annotations.Api;
import entity.Hint;
import entity.Question;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import java.util.List;

@Path("/hints")
@Stateless
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Api(value = "/hints", description = "Hints management")
public class HintRepresentation extends Representation{
    @EJB
    private QuestionResource questionResource;

    @EJB
    private HintResource hintResource;

    @GET
    @Path("/{id}")
    public Response get(@PathParam("id") String id) {
        Hint hint = hintResource.findById(id);
        if (hint == null)
            return Response.noContent().build();
        return Response.ok(hint, MediaType.APPLICATION_JSON).build();
    }

    @GET
    @Path("/question/{id}")
    public Response getByQuestion(@PathParam("id") String id) {
        Question question = questionResource.findById(id);
        if (question == null)
            flash(404, "Error : Question does not exist");

        List<Hint> hints = hintResource.findByQuestion(question);

        GenericEntity<List<Hint>> list = new GenericEntity<List<Hint>>(hints){};

        return Response.ok(list, MediaType.APPLICATION_JSON).build();
    }

    @POST<commit_msg>Fixed space<commit_after>package boundary.Question;

import boundary.Representation;
import com.wordnik.swagger.annotations.Api;
import entity.Hint;
import entity.Question;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
import java.util.List;

@Path("/hints")
@Stateless
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Api(value = "/hints", description = "Hints management")
public class HintRepresentation extends Representation {
    @EJB
    private QuestionResource questionResource;

    @EJB
    private HintResource hintResource;

    @GET
    @Path("/{id}")
    public Response get(@PathParam("id") String id) {
        Hint hint = hintResource.findById(id);
        if (hint == null)
            return Response.noContent().build();
        return Response.ok(hint, MediaType.APPLICATION_JSON).build();
    }

    @GET
    @Path("/question/{id}")
    public Response getByQuestion(@PathParam("id") String id) {
        Question question = questionResource.findById(id);
        if (question == null)
            flash(404, "Error : Question does not exist");

        List<Hint> hints = hintResource.findByQuestion(question);

        GenericEntity<List<Hint>> list = new GenericEntity<List<Hint>>(hints){};

        return Response.ok(list, MediaType.APPLICATION_JSON).build();
    }

    @POST
{'fraction_non_alphanumeric': 0.1269383339343671, 'fraction_numerical': 0.002163721601153985, 'mean_word_length': 3.741880341880342, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3833567', 'n_tokens_mistral': 836, 'n_tokens_neox': 805, 'n_words': 180}