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

JavaJaxRS.cxf-cdi.api.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
package {{package}};

{{#imports}}import {{import}};
{{/imports}}
import {{package}}.{{classname}}Service;

import {{javaxPackage}}.ws.rs.*;
import {{javaxPackage}}.ws.rs.core.Context;
import {{javaxPackage}}.ws.rs.core.Response;
import {{javaxPackage}}.ws.rs.core.SecurityContext;
import {{javaxPackage}}.enterprise.context.RequestScoped;
import {{javaxPackage}}.inject.Inject;

import io.swagger.annotations.*;
import java.io.InputStream;

import org.apache.cxf.jaxrs.ext.PATCH;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;

import java.util.Map;
import java.util.List;
{{#useBeanValidation}}
import {{javaxPackage}}.validation.constraints.*;
import {{javaxPackage}}.validation.Valid;
{{/useBeanValidation}}
@Path("{{commonPath}}")
@RequestScoped

@Api(description = "the {{{baseName}}} API")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
{{>generatedAnnotation}}

public class {{classname}}  {

  @Context SecurityContext securityContext;

  @Inject {{classname}}Service delegate;

{{#operations}}
{{#operation}}

    @{{httpMethod}}
    {{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}}
    {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}} }){{/hasConsumes}}
    {{#hasProduces}}@Produces({ {{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}} }){{/hasProduces}}
    {{#isDeprecated}}@SuppressWarnings("deprecation")
    {{/isDeprecated}}@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnBaseType}}}.class{{#returnContainer}}, responseContainer = "{{{.}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = {
        {{#authMethods}}{{#isOAuth}}@Authorization(value = "{{name}}", scopes = {
            {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{^-last}},
            {{/-last}}{{/scopes}} }){{^-last}},{{/-last}}{{/isOAuth}}
        {{^isOAuth}}@Authorization(value = "{{name}}"){{^-last}},{{/-last}}
        {{/isOAuth}}{{/authMethods}} }{{/hasAuthMethods}}, tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{^-last}}, {{/-last}}{{/vendorExtensions.x-tags}} })
    {{#implicitHeadersParams.0}}
    @io.swagger.annotations.ApiImplicitParams({
        {{#implicitHeadersParams}}
        @io.swagger.annotations.ApiImplicitParam(name = "{{{baseName}}}", value = "{{{description}}}", {{#required}}required = true,{{/required}} dataType = "{{{dataType}}}", paramType = "header"){{^-last}},{{/-last}}
        {{/implicitHeadersParams}}
    })
    {{/implicitHeadersParams.0}}
    @ApiResponses(value = { {{#responses}}
        @ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{baseType}}}.class{{#containerType}}, responseContainer = "{{{.}}}"{{/containerType}}){{^-last}},{{/-last}}{{/responses}} })
    public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{^-last}}, {{/-last}}{{/allParams}}) {
        return delegate.{{nickname}}({{#allParams}}{{#isFile}}{{#isMultipart}}{{paramName}}InputStream, {{paramName}}Detail{{/isMultipart}}{{^isMultipart}}{{paramName}}{{/isMultipart}}{{/isFile}}{{^isFile}}{{paramName}}{{/isFile}}, {{/allParams}}securityContext);
    }
{{/operation}}
}
{{/operations}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy