<commit_before>package org.wso2.carbon.business.rules.core.api;

import io.swagger.annotations.ApiParam;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.business.rules.core.api.factories.BusinessRulesApiServiceFactory;
import org.wso2.msf4j.Microservice;
import org.wso2.msf4j.formparam.FormDataParam;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
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.Response;

@Component(
        name = "business-rules-api-service",
        service = Microservice.class,
        immediate = true
)

@Path("/business-rule")
@io.swagger.annotations.Api(description = "the business-rules API")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen",
        date = "2017-10-11T05:39:16.839Z")
public class BusinessRulesApi implements Microservice {
    private static final Logger log = LoggerFactory.getLogger(BusinessRulesApi.class);
    private final BusinessRulesApiService delegate = BusinessRulesApiServiceFactory.getBusinessRulesApi();

    @POST
    @Path("/instances")
    @Consumes({ "multipart/form-data" })
    @Produces({ "application/json" })
    @io.swagger.annotations.ApiOperation(value = "Creates a business rule",
            notes = "Creates a business rule instance from template / from scratch from the given form data",
            response = Object.class, responseContainer = "List", tags={ "business-rules", })
    @io.swagger.annotations.ApiResponses(value = {
        @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Object.class,
                responseContainer = "List"),

        @io.swagger.annotations.ApiResponse(code = 405, message = "Business rule creation failed",
                response = Object.class, responseContainer = "List") })
    public Response createBusinessRule(@ApiParam(value = "Required parameter values for creating the business rule" ,
            required=true) String businessRule
,@ApiParam(value = "States whether the created business rule should be deployed or not.", defaultValue="true")
                                           @DefaultValue("true") @QueryParam("deploy") Boolean deploy
)
    throws NotFoundException {<commit_msg>Changed @ApiParam to @FormDataParam, to accept multipart form data<commit_after>package org.wso2.carbon.business.rules.core.api;

import io.swagger.annotations.ApiParam;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wso2.carbon.business.rules.core.api.factories.BusinessRulesApiServiceFactory;
import org.wso2.msf4j.Microservice;
import org.wso2.msf4j.formparam.FormDataParam;

import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
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.Response;

@Component(
        name = "business-rules-api-service",
        service = Microservice.class,
        immediate = true
)

@Path("/business-rule")
@io.swagger.annotations.Api(description = "the business-rules API")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaMSF4JServerCodegen",
        date = "2017-10-11T05:39:16.839Z")
public class BusinessRulesApi implements Microservice {
    private static final Logger log = LoggerFactory.getLogger(BusinessRulesApi.class);
    private final BusinessRulesApiService delegate = BusinessRulesApiServiceFactory.getBusinessRulesApi();

    @POST
    @Path("/instances")
    @Consumes({ "multipart/form-data" })
    @Produces({ "application/json" })
    @io.swagger.annotations.ApiOperation(value = "Creates a business rule",
            notes = "Creates a business rule instance from template / from scratch from the given form data",
            response = Object.class, responseContainer = "List", tags={ "business-rules", })
    @io.swagger.annotations.ApiResponses(value = {
        @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Object.class,
                responseContainer = "List"),

        @io.swagger.annotations.ApiResponse(code = 405, message = "Business rule creation failed",
                response = Object.class, responseContainer = "List") })
    public Response createBusinessRule(@FormDataParam("businessRule") String businessRule
,@ApiParam(value = "States whether the created business rule should be deployed or not.", defaultValue="true")
                                           @DefaultValue("true") @QueryParam("deploy") Boolean deploy
)
    throws NotFoundException {
{'fraction_non_alphanumeric': 0.11401151631477927, 'fraction_numerical': 0.012284069097888676, 'mean_word_length': 4.078947368421052, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2150462', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1488, 'n_words': 319}