<commit_before>package org.ajabshahar.platform.resources;

import com.google.gson.Gson;
import io.dropwizard.hibernate.UnitOfWork;
import org.ajabshahar.platform.daos.CategoryDAO;
import org.ajabshahar.platform.models.Category;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Set;

@Path("/category")
@Produces(MediaType.APPLICATION_JSON)
public class CategoryResource {
    private final CategoryDAO categoryDAO;

    public CategoryResource(CategoryDAO categoryDAO) {
        this.categoryDAO = categoryDAO;
    }

    @GET
    @UnitOfWork
    public Set<Category> listAllCategories() {
        return categoryDAO.findAll();
    }

    @POST
    @UnitOfWork
    @Consumes(MediaType.APPLICATION_JSON)
    public Response createSplashScreen(String jsonSplashScreenOptions) {
        Category category = new Gson().fromJson(jsonSplashScreenOptions, Category.class);
        categoryDAO.create(category);
        return Response.status(200).entity(category.toString()).build();
    }


    @GET
    @UnitOfWork
    @Path("/song")
    public Set<Category> listAllSongCategories() {
        return categoryDAO.findAllSongCategories();
    }

    @GET
    @UnitOfWork
    @Path("/media")<commit_msg>Correcting the method names. <Jaideep><commit_after>package org.ajabshahar.platform.resources;

import com.google.gson.Gson;
import io.dropwizard.hibernate.UnitOfWork;
import org.ajabshahar.platform.daos.CategoryDAO;
import org.ajabshahar.platform.models.Category;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Set;

@Path("/category")
@Produces(MediaType.APPLICATION_JSON)
public class CategoryResource {
    private final CategoryDAO categoryDAO;

    public CategoryResource(CategoryDAO categoryDAO) {
        this.categoryDAO = categoryDAO;
    }

    @GET
    @UnitOfWork
    public Set<Category> listAllCategories() {
        return categoryDAO.findAll();
    }

    @POST
    @UnitOfWork
    @Consumes(MediaType.APPLICATION_JSON)
    public Response createCategory(String jsonCategory) {
        Category category = new Gson().fromJson(jsonCategory, Category.class);
        categoryDAO.create(category);
        return Response.status(200).entity(category.toString()).build();
    }

    @GET
    @UnitOfWork
    @Path("/song")
    public Set<Category> listAllSongCategories() {
        return categoryDAO.findAllSongCategories();
    }

    @GET
    @UnitOfWork
    @Path("/media")
{'fraction_non_alphanumeric': 0.10964912280701754, 'fraction_numerical': 0.0023923444976076554, 'mean_word_length': 3.8342967244701347, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '679841', 'n_tokens_mistral': 804, 'n_tokens_neox': 765, 'n_words': 133}