<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.sodep.notificationserver.rest;

import java.sql.SQLException;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.log4j.Logger;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;
import py.com.sodep.notificationserver.db.entities.*;
import py.com.sodep.notificationserver.business.AplicacionBusiness;

/**
 *
 * @author Vanessa
 */
@Path("/aplicacion")
@RequestScoped
public class AplicacionService {

    @Inject
    Logger logger;

    @Inject
    AplicacionBusiness appBussines;

    @POST
    @Path("")
    @Produces(MediaType.APPLICATION_JSON)
    public Response newApplication(Aplicacion a) throws SQLException, Exception {
        logger.info("Application/id " + a);
        appBussines.createAplicacionJson(a, null);
        return Response.ok(a).build();

    }

    @POST
    @Path("/upload")
    @Consumes("multipart/form-data")
    @Produces(MediaType.APPLICATION_JSON)
    public Response uploadFile(@MultipartForm AplicacionFile form) throws SQLException, Exception {
        logger.info("Recibido: " + form);
        Aplicacion a = appBussines.newAplicacionFileUpload(form, null);
        return Response.ok(a).build();
    }

    @PUT
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response updateApplication(Aplicacion b, @PathParam(value = "id") String id) throws SQLException, Exception {
        logger.info("Application/id " + b);
        Aplicacion a = appBussines.createAplicacionJson(b, Long.valueOf(id));
        return Response.ok(a).build();

    }

    @PUT
    @Path("/upload/{id}")
    @Consumes("multipart/form-data")
    @Produces(MediaType.APPLICATION_JSON)
    public Response uploadFileUpdate(@MultipartForm AplicacionFile form, @PathParam(value = "id") String id) throws SQLException, Exception {
        Aplicacion a = appBussines.newAplicacionFileUpload(form, Long.valueOf(id));
        return Response.ok(a).build();
    }

    @DELETE
    @Path("/{id}")
    @Consumes("multipart/form-data")
    @Produces(MediaType.APPLICATION_JSON)
    public Response deleteAplicacion(@PathParam(value="id") Long id) throws SQLException, Exception {
        Aplicacion a = appBussines.eliminarAplicacion(id);
        return Response.ok(a).build();
    }

    @GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getApplicationById(@PathParam("id") Long id) throws SQLException, Exception {
        logger.info("Application/id " + id);
        Aplicacion a = appBussines.getApplication(id);
        return Response.ok(a).build();

    }

    @GET
    @Path("")
    @Produces(MediaType.APPLICATION_JSON)
    public Response findAplicacion(@QueryParam(value = "nombre") String nombre) throws SQLException, Exception {
        logger.info("Application/nombre " + nombre);
        Aplicacion a = appBussines.findAplicacion(nombre);
        return Response.ok(a).build();

    }
    
    @POST
    @Path("/{id}/android/habilitar")
    @Produces(MediaType.APPLICATION_JSON)
    public Response habilitarAplicacion(@PathParam(value = "id") Long id) throws SQLException, Exception {
        Aplicacion a = appBussines.habilitarAplicacionAndroid(id);
        return Response.ok(a).build();
    }
    
    @POST
    @Path("/{id}/ios/habilitar")
    @Produces(MediaType.APPLICATION_JSON)
    public Response habilitarAplicacion(@PathParam(value = "id") Long id) throws SQLException, Exception {
        Aplicacion a = appBussines.habilitarAplicacionIos(id);
        return Response.ok(a).build();
    }
}<commit_msg>Se agrega servicio para habilitacion de aplicaciones IOS<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.sodep.notificationserver.rest;

import java.sql.SQLException;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.log4j.Logger;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;
import py.com.sodep.notificationserver.db.entities.*;
import py.com.sodep.notificationserver.business.AplicacionBusiness;

/**
 *
 * @author Vanessa
 */
@Path("/aplicacion")
@RequestScoped
public class AplicacionService {

    @Inject
    Logger logger;

    @Inject
    AplicacionBusiness appBussines;

    @POST
    @Path("")
    @Produces(MediaType.APPLICATION_JSON)
    public Response newApplication(Aplicacion a) throws SQLException, Exception {
        logger.info("Application/id " + a);
        appBussines.createAplicacionJson(a, null);
        return Response.ok(a).build();

    }

    @POST
    @Path("/upload")
    @Consumes("multipart/form-data")
    @Produces(MediaType.APPLICATION_JSON)
    public Response uploadFile(@MultipartForm AplicacionFile form) throws SQLException, Exception {
        logger.info("Recibido: " + form);
        Aplicacion a = appBussines.newAplicacionFileUpload(form, null);
        return Response.ok(a).build();
    }

    @PUT
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response updateApplication(Aplicacion b, @PathParam(value = "id") String id) throws SQLException, Exception {
        logger.info("Application/id " + b);
        Aplicacion a = appBussines.createAplicacionJson(b, Long.valueOf(id));
        return Response.ok(a).build();

    }

    @PUT
    @Path("/upload/{id}")
    @Consumes("multipart/form-data")
    @Produces(MediaType.APPLICATION_JSON)
    public Response uploadFileUpdate(@MultipartForm AplicacionFile form, @PathParam(value = "id") String id) throws SQLException, Exception {
        Aplicacion a = appBussines.newAplicacionFileUpload(form, Long.valueOf(id));
        return Response.ok(a).build();
    }

    @DELETE
    @Path("/{id}")
    @Consumes("multipart/form-data")
    @Produces(MediaType.APPLICATION_JSON)
    public Response deleteAplicacion(@PathParam(value="id") Long id) throws SQLException, Exception {
        Aplicacion a = appBussines.eliminarAplicacion(id);
        return Response.ok(a).build();
    }

    @GET
    @Path("/{id}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getApplicationById(@PathParam("id") Long id) throws SQLException, Exception {
        logger.info("Application/id " + id);
        Aplicacion a = appBussines.getApplication(id);
        return Response.ok(a).build();

    }

    @GET
    @Path("")
    @Produces(MediaType.APPLICATION_JSON)
    public Response findAplicacion(@QueryParam(value = "nombre") String nombre) throws SQLException, Exception {
        logger.info("Application/nombre " + nombre);
        Aplicacion a = appBussines.findAplicacion(nombre);
        return Response.ok(a).build();

    }
    
    @POST
    @Path("/{id}/android/habilitar")
    @Produces(MediaType.APPLICATION_JSON)
    public Response habilitarAplicacionAndroid(@PathParam(value = "id") Long id) throws SQLException, Exception {
        Aplicacion a = appBussines.habilitarAplicacionAndroid(id);
        return Response.ok(a).build();
    }
    
    @POST
    @Path("/{id}/ios/habilitar")
    @Produces(MediaType.APPLICATION_JSON)
    public Response habilitarAplicacionIos(@PathParam(value = "id") Long id) throws SQLException, Exception {
        Aplicacion a = appBussines.habilitarAplicacionIos(id);
        return Response.ok(a).build();
    }
}
{'fraction_non_alphanumeric': 0.12276214833759591, 'fraction_numerical': 0.00024357569114602363, 'mean_word_length': 3.757821552723059, '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': '3438416', 'n_tokens_mistral': 2574, 'n_tokens_neox': 2560, 'n_words': 499}