All Downloads are FREE. Search and download functionalities are using the official Maven repository.

v2.JavaJaxRS.resteasy.api.mustache Maven / Gradle / Ivy

The newest version!
package {{package}};

import {{modelPackage}}.*;
import {{package}}.{{classname}}Service;

import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*;

{{#imports}}import {{import}};
{{/imports}}

import java.util.Map;
import java.util.List;
import {{package}}.NotFoundException;

import java.io.InputStream;

import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*;
import javax.inject.Inject;

{{#useBeanValidation}}
import javax.validation.constraints.*;
{{/useBeanValidation}}
{{#operations}}{{#operation}}{{#isMultipart}}import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
{{/isMultipart}}{{/operation}}{{/operations}}
@Path("/{{{baseName}}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@io.swagger.annotations.Api(description = "the {{{baseName}}} API")
{{>generatedAnnotation}}
{{#operations}}
public class {{classname}}  {

    @Inject {{classname}}Service service;

{{#operation}}
    @{{httpMethod}}
    {{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}}
    {{#has this 'consumes'}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/has}}
    {{#has this 'produces'}}@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/has}}
    @io.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
        {{#authMethods}}@io.swagger.annotations.Authorization(value = "{{name}}"{{#is this 'oauth'}}, scopes = {
            {{#scopes}}@io.swagger.annotations.AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
            {{/hasMore}}{{/scopes}}
        }{{/is}}){{#hasMore}},
        {{/hasMore}}{{/authMethods}}
    }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}",{{/vendorExtensions.x-tags}} })
    @io.swagger.annotations.ApiResponses(value = { {{#responses}}
        @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#has this 'more'}},
        {{/has}}{{/responses}} })
    public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{^isMultipart}}{{>formParams}},{{/isMultipart}}{{#isMultipart}}{{#isNot this 'form-param'}},{{/isNot}}{{/isMultipart}}{{/allParams}}@Context SecurityContext securityContext)
    throws NotFoundException {
        return service.{{nickname}}({{#isMultipart}}input,{{/isMultipart}}{{#allParams}}{{^isMultipart}}{{paramName}},{{/isMultipart}}{{#isMultipart}}{{#isNot this 'form-param'}}{{paramName}},{{/isNot}}{{/isMultipart}}{{/allParams}}securityContext);
    }
{{/operation}}
}
{{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy