resteasy support javax injection instead of static delegate factory (#5272)

* resteasy support javax injection instead of static delegate factory

* fixed resteasy joda example
This commit is contained in:
Aleksandr Nekrasov 2017-12-11 23:35:51 +07:00 committed by William Cheng
parent d881cb39bf
commit 643ef64f04
61 changed files with 207 additions and 214 deletions

View File

@ -23,7 +23,6 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen im
outputFolder = "generated-code/JavaJaxRS-Resteasy"; outputFolder = "generated-code/JavaJaxRS-Resteasy";
apiTemplateFiles.put("apiService.mustache", ".java"); apiTemplateFiles.put("apiService.mustache", ".java");
apiTemplateFiles.put("apiServiceImpl.mustache", ".java"); apiTemplateFiles.put("apiServiceImpl.mustache", ".java");
apiTemplateFiles.put("apiServiceFactory.mustache", ".java");
apiTestTemplateFiles.clear(); // TODO: add test template apiTestTemplateFiles.clear(); // TODO: add test template
// clear model and api doc template as AbstractJavaJAXRSServerCodegen // clear model and api doc template as AbstractJavaJAXRSServerCodegen

View File

@ -2,7 +2,6 @@ package {{package}};
import {{modelPackage}}.*; import {{modelPackage}}.*;
import {{package}}.{{classname}}Service; import {{package}}.{{classname}}Service;
import {{package}}.factories.{{classname}}ServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -20,6 +19,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
{{#useBeanValidation}} {{#useBeanValidation}}
import javax.validation.constraints.*; import javax.validation.constraints.*;
{{/useBeanValidation}} {{/useBeanValidation}}
@ -32,7 +33,8 @@ import javax.validation.constraints.*;
{{>generatedAnnotation}} {{>generatedAnnotation}}
{{#operations}} {{#operations}}
public class {{classname}} { public class {{classname}} {
private final {{classname}}Service delegate = {{classname}}ServiceFactory.get{{classname}}();
@Inject {{classname}}Service service;
{{#operation}} {{#operation}}
@{{httpMethod}} @{{httpMethod}}
@ -51,7 +53,7 @@ public class {{classname}} {
{{/hasMore}}{{/responses}} }) {{/hasMore}}{{/responses}} })
public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{^isMultipart}}{{>formParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}@Context SecurityContext securityContext) public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{^isMultipart}}{{>formParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.{{nickname}}({{#isMultipart}}input,{{/isMultipart}}{{#allParams}}{{^isMultipart}}{{paramName}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}}{{paramName}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}securityContext); return service.{{nickname}}({{#isMultipart}}input,{{/isMultipart}}{{#allParams}}{{^isMultipart}}{{paramName}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}}{{paramName}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}securityContext);
} }
{{/operation}} {{/operation}}
} }

View File

@ -18,9 +18,9 @@ import javax.ws.rs.core.SecurityContext;
{{>generatedAnnotation}} {{>generatedAnnotation}}
{{#operations}} {{#operations}}
public abstract class {{classname}}Service { public interface {{classname}}Service {
{{#operation}} {{#operation}}
public abstract Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext) Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
{{/operation}} {{/operation}}
} }

View File

@ -1,15 +0,0 @@
package {{package}}.factories;
import {{package}}.{{classname}}Service;
import {{package}}.impl.{{classname}}ServiceImpl;
{{>generatedAnnotation}}
public class {{classname}}ServiceFactory {
private final static {{classname}}Service service = new {{classname}}ServiceImpl();
public static {{classname}}Service get{{classname}}()
{
return service;
}
}

View File

@ -13,14 +13,15 @@ import {{package}}.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
{{>generatedAnnotation}} {{>generatedAnnotation}}
{{#operations}} {{#operations}}
public class {{classname}}ServiceImpl extends {{classname}}Service { public class {{classname}}ServiceImpl implements {{classname}}Service {
{{#operation}} {{#operation}}
@Override
public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext) public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!

View File

@ -13,13 +13,18 @@ dependencies {
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final'
providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final'
providedCompile 'javax.annotation:javax.annotation-api:1.2' providedCompile 'javax.annotation:javax.annotation-api:1.2'
providedCompile 'javax:javaee-api:7.0'
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final' providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
compile 'io.swagger:swagger-annotations:1.5.10' compile 'io.swagger:swagger-annotations:1.5.10'
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final' compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
{{#joda}} {{#useBeanValidation}}
providedCompile 'javax.validation:validation-api:1.1.0.Final'
{{/useBeanValidation}}
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.1' compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.1'
compile 'joda-time:joda-time:2.7' compile 'joda-time:joda-time:2.7'
{{/joda}} //TODO: swaggerFeature
compile 'io.swagger:swagger-jaxrs:1.5.12'
testCompile 'junit:junit:4.12', testCompile 'junit:junit:4.12',
'org.hamcrest:hamcrest-core:1.3' 'org.hamcrest:hamcrest-core:1.3'
} }

View File

@ -58,6 +58,14 @@
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
@ -103,6 +111,7 @@
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId> <artifactId>resteasy-jackson2-provider</artifactId>
<version>${resteasy-version}</version> <version>${resteasy-version}</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.annotation</groupId> <groupId>javax.annotation</groupId>

View File

@ -13,9 +13,16 @@ dependencies {
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11:3.0.11.Final'
providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final' providedCompile 'org.jboss.resteasy:resteasy-multipart-provider:3.0.11.Final'
providedCompile 'javax.annotation:javax.annotation-api:1.2' providedCompile 'javax.annotation:javax.annotation-api:1.2'
providedCompile 'javax:javaee-api:7.0'
providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final' providedCompile 'org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:1.0.0.Final'
compile 'io.swagger:swagger-annotations:1.5.10' compile 'io.swagger:swagger-annotations:1.5.10'
compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final' compile 'org.jboss.resteasy:resteasy-jackson2-provider:3.0.11.Final'
providedCompile 'javax.validation:validation-api:1.1.0.Final'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.4.1'
compile 'joda-time:joda-time:2.7'
//TODO: swaggerFeature
compile 'io.swagger:swagger-jaxrs:1.5.12'
testCompile 'junit:junit:4.12', testCompile 'junit:junit:4.12',
'org.hamcrest:hamcrest-core:1.3' 'org.hamcrest:hamcrest-core:1.3'
} }

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@ -9,6 +9,15 @@
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
@ -49,6 +58,14 @@
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
@ -94,6 +111,7 @@
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId> <artifactId>resteasy-jackson2-provider</artifactId>
<version>${resteasy-version}</version> <version>${resteasy-version}</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.annotation</groupId> <groupId>javax.annotation</groupId>

View File

@ -2,7 +2,6 @@ package io.swagger.api;
import io.swagger.model.*; import io.swagger.model.*;
import io.swagger.api.PetApiService; import io.swagger.api.PetApiService;
import io.swagger.api.factories.PetApiServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -21,6 +20,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
@ -30,7 +31,8 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
@io.swagger.annotations.Api(description = "the pet API") @io.swagger.annotations.Api(description = "the pet API")
public class PetApi { public class PetApi {
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
@Inject PetApiService service;
@POST @POST
@ -46,7 +48,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext) public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.addPet(body,securityContext); return service.addPet(body,securityContext);
} }
@DELETE @DELETE
@Path("/{petId}") @Path("/{petId}")
@ -62,7 +64,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
public Response deletePet( @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) public Response deletePet( @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deletePet(petId,apiKey,securityContext); return service.deletePet(petId,apiKey,securityContext);
} }
@GET @GET
@Path("/findByStatus") @Path("/findByStatus")
@ -80,7 +82,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext) public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.findPetsByStatus(status,securityContext); return service.findPetsByStatus(status,securityContext);
} }
@GET @GET
@Path("/findByTags") @Path("/findByTags")
@ -98,7 +100,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext) public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.findPetsByTags(tags,securityContext); return service.findPetsByTags(tags,securityContext);
} }
@GET @GET
@Path("/{petId}") @Path("/{petId}")
@ -115,7 +117,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) })
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext) public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getPetById(petId,securityContext); return service.getPetById(petId,securityContext);
} }
@PUT @PUT
@ -135,7 +137,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext) public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updatePet(body,securityContext); return service.updatePet(body,securityContext);
} }
@POST @POST
@Path("/{petId}") @Path("/{petId}")
@ -151,7 +153,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext) public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updatePetWithForm(petId,name,status,securityContext); return service.updatePetWithForm(petId,name,status,securityContext);
} }
@POST @POST
@Path("/{petId}/uploadImage") @Path("/{petId}/uploadImage")
@ -167,6 +169,6 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext) public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.uploadFile(input,petId,securityContext); return service.uploadFile(input,petId,securityContext);
} }
} }

View File

@ -18,21 +18,21 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
public abstract class PetApiService { public interface PetApiService {
public abstract Response addPet(Pet body,SecurityContext securityContext) Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext) Response findPetsByStatus(List<String> status,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext) Response findPetsByTags(List<String> tags,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getPetById(Long petId,SecurityContext securityContext) Response getPetById(Long petId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response updatePet(Pet body,SecurityContext securityContext) Response updatePet(Pet body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
} }

View File

@ -2,7 +2,6 @@ package io.swagger.api;
import io.swagger.model.*; import io.swagger.model.*;
import io.swagger.api.StoreApiService; import io.swagger.api.StoreApiService;
import io.swagger.api.factories.StoreApiServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -20,6 +19,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@Path("/store") @Path("/store")
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
@io.swagger.annotations.Api(description = "the store API") @io.swagger.annotations.Api(description = "the store API")
public class StoreApi { public class StoreApi {
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
@Inject StoreApiService service;
@DELETE @DELETE
@Path("/order/{orderId}") @Path("/order/{orderId}")
@ -41,7 +43,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext) public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deleteOrder(orderId,securityContext); return service.deleteOrder(orderId,securityContext);
} }
@GET @GET
@Path("/inventory") @Path("/inventory")
@ -54,7 +56,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
public Response getInventory(@Context SecurityContext securityContext) public Response getInventory(@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getInventory(securityContext); return service.getInventory(securityContext);
} }
@GET @GET
@Path("/order/{orderId}") @Path("/order/{orderId}")
@ -69,7 +71,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext) public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getOrderById(orderId,securityContext); return service.getOrderById(orderId,securityContext);
} }
@POST @POST
@Path("/order") @Path("/order")
@ -82,6 +84,6 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) })
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext) public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.placeOrder(body,securityContext); return service.placeOrder(body,securityContext);
} }
} }

View File

@ -16,13 +16,13 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
public abstract class StoreApiService { public interface StoreApiService {
public abstract Response deleteOrder(String orderId,SecurityContext securityContext) Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getInventory(SecurityContext securityContext) Response getInventory(SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getOrderById(Long orderId,SecurityContext securityContext) Response getOrderById(Long orderId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response placeOrder(Order body,SecurityContext securityContext) Response placeOrder(Order body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
} }

View File

@ -2,7 +2,6 @@ package io.swagger.api;
import io.swagger.model.*; import io.swagger.model.*;
import io.swagger.api.UserApiService; import io.swagger.api.UserApiService;
import io.swagger.api.factories.UserApiServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -20,6 +19,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@Path("/user") @Path("/user")
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
@io.swagger.annotations.Api(description = "the user API") @io.swagger.annotations.Api(description = "the user API")
public class UserApi { public class UserApi {
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
@Inject UserApiService service;
@POST @POST
@ -39,7 +41,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body,@Context SecurityContext securityContext) public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.createUser(body,securityContext); return service.createUser(body,securityContext);
} }
@POST @POST
@Path("/createWithArray") @Path("/createWithArray")
@ -50,7 +52,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext) public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.createUsersWithArrayInput(body,securityContext); return service.createUsersWithArrayInput(body,securityContext);
} }
@POST @POST
@Path("/createWithList") @Path("/createWithList")
@ -61,7 +63,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext) public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.createUsersWithListInput(body,securityContext); return service.createUsersWithListInput(body,securityContext);
} }
@DELETE @DELETE
@Path("/{username}") @Path("/{username}")
@ -74,7 +76,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext) public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deleteUser(username,securityContext); return service.deleteUser(username,securityContext);
} }
@GET @GET
@Path("/{username}") @Path("/{username}")
@ -89,7 +91,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext) public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getUserByName(username,securityContext); return service.getUserByName(username,securityContext);
} }
@GET @GET
@Path("/login") @Path("/login")
@ -102,7 +104,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) })
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext) public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.loginUser(username,password,securityContext); return service.loginUser(username,password,securityContext);
} }
@GET @GET
@Path("/logout") @Path("/logout")
@ -113,7 +115,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response logoutUser(@Context SecurityContext securityContext) public Response logoutUser(@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.logoutUser(securityContext); return service.logoutUser(securityContext);
} }
@PUT @PUT
@Path("/{username}") @Path("/{username}")
@ -126,6 +128,6 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User body,@Context SecurityContext securityContext) public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updateUser(username,body,securityContext); return service.updateUser(username,body,securityContext);
} }
} }

View File

@ -16,21 +16,21 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
public abstract class UserApiService { public interface UserApiService {
public abstract Response createUser(User body,SecurityContext securityContext) Response createUser(User body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext) Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext) Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response deleteUser(String username,SecurityContext securityContext) Response deleteUser(String username,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getUserByName(String username,SecurityContext securityContext) Response getUserByName(String username,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response loginUser(String username,String password,SecurityContext securityContext) Response loginUser(String username,String password,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response logoutUser(SecurityContext securityContext) Response logoutUser(SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response updateUser(String username,User body,SecurityContext securityContext) Response updateUser(String username,User body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
} }

View File

@ -1,15 +0,0 @@
package io.swagger.api.factories;
import io.swagger.api.PetApiService;
import io.swagger.api.impl.PetApiServiceImpl;
public class PetApiServiceFactory {
private final static PetApiService service = new PetApiServiceImpl();
public static PetApiService getPetApi()
{
return service;
}
}

View File

@ -1,15 +0,0 @@
package io.swagger.api.factories;
import io.swagger.api.StoreApiService;
import io.swagger.api.impl.StoreApiServiceImpl;
public class StoreApiServiceFactory {
private final static StoreApiService service = new StoreApiServiceImpl();
public static StoreApiService getStoreApi()
{
return service;
}
}

View File

@ -1,15 +0,0 @@
package io.swagger.api.factories;
import io.swagger.api.UserApiService;
import io.swagger.api.impl.UserApiServiceImpl;
public class UserApiServiceFactory {
private final static UserApiService service = new UserApiServiceImpl();
public static UserApiService getUserApi()
{
return service;
}
}

View File

@ -14,54 +14,48 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
public class PetApiServiceImpl extends PetApiService { public class PetApiServiceImpl implements PetApiService {
@Override
public Response addPet(Pet body,SecurityContext securityContext) public Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response deletePet(Long petId,String apiKey,SecurityContext securityContext) public Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response findPetsByStatus(List<String> status,SecurityContext securityContext) public Response findPetsByStatus(List<String> status,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response findPetsByTags(List<String> tags,SecurityContext securityContext) public Response findPetsByTags(List<String> tags,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getPetById(Long petId,SecurityContext securityContext) public Response getPetById(Long petId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response updatePet(Pet body,SecurityContext securityContext) public Response updatePet(Pet body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!

View File

@ -12,30 +12,28 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
public class StoreApiServiceImpl extends StoreApiService { public class StoreApiServiceImpl implements StoreApiService {
@Override
public Response deleteOrder(String orderId,SecurityContext securityContext) public Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getInventory(SecurityContext securityContext) public Response getInventory(SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getOrderById(Long orderId,SecurityContext securityContext) public Response getOrderById(Long orderId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response placeOrder(Order body,SecurityContext securityContext) public Response placeOrder(Order body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!

View File

@ -12,54 +12,48 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
public class UserApiServiceImpl extends UserApiService { public class UserApiServiceImpl implements UserApiService {
@Override
public Response createUser(User body,SecurityContext securityContext) public Response createUser(User body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext) public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response createUsersWithListInput(List<User> body,SecurityContext securityContext) public Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response deleteUser(String username,SecurityContext securityContext) public Response deleteUser(String username,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getUserByName(String username,SecurityContext securityContext) public Response getUserByName(String username,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response loginUser(String username,String password,SecurityContext securityContext) public Response loginUser(String username,String password,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response logoutUser(SecurityContext securityContext) public Response logoutUser(SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response updateUser(String username,User body,SecurityContext securityContext) public Response updateUser(String username,User body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!

View File

@ -9,6 +9,15 @@
<build> <build>
<sourceDirectory>src/main/java</sourceDirectory> <sourceDirectory>src/main/java</sourceDirectory>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
@ -49,6 +58,14 @@
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/javax/javaee-api -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>io.swagger</groupId> <groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId> <artifactId>swagger-annotations</artifactId>
@ -94,6 +111,7 @@
<groupId>org.jboss.resteasy</groupId> <groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId> <artifactId>resteasy-jackson2-provider</artifactId>
<version>${resteasy-version}</version> <version>${resteasy-version}</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.annotation</groupId> <groupId>javax.annotation</groupId>
@ -143,6 +161,14 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
<repository> <repository>

View File

@ -2,7 +2,6 @@ package io.swagger.api;
import io.swagger.model.*; import io.swagger.model.*;
import io.swagger.api.PetApiService; import io.swagger.api.PetApiService;
import io.swagger.api.factories.PetApiServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -21,6 +20,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
import javax.validation.constraints.*; import javax.validation.constraints.*;
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
@ -30,7 +31,8 @@ import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
@io.swagger.annotations.Api(description = "the pet API") @io.swagger.annotations.Api(description = "the pet API")
public class PetApi { public class PetApi {
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
@Inject PetApiService service;
@POST @POST
@ -46,7 +48,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext) public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.addPet(body,securityContext); return service.addPet(body,securityContext);
} }
@DELETE @DELETE
@Path("/{petId}") @Path("/{petId}")
@ -62,7 +64,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) })
public Response deletePet( @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext) public Response deletePet( @PathParam("petId") Long petId,@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deletePet(petId,apiKey,securityContext); return service.deletePet(petId,apiKey,securityContext);
} }
@GET @GET
@Path("/findByStatus") @Path("/findByStatus")
@ -80,7 +82,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) })
public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext) public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> status,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.findPetsByStatus(status,securityContext); return service.findPetsByStatus(status,securityContext);
} }
@GET @GET
@Path("/findByTags") @Path("/findByTags")
@ -98,7 +100,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) })
public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext) public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.findPetsByTags(tags,securityContext); return service.findPetsByTags(tags,securityContext);
} }
@GET @GET
@Path("/{petId}") @Path("/{petId}")
@ -115,7 +117,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) })
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext) public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getPetById(petId,securityContext); return service.getPetById(petId,securityContext);
} }
@PUT @PUT
@ -135,7 +137,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) })
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext) public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updatePet(body,securityContext); return service.updatePet(body,securityContext);
} }
@POST @POST
@Path("/{petId}") @Path("/{petId}")
@ -151,7 +153,7 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) })
public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext) public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updatePetWithForm(petId,name,status,securityContext); return service.updatePetWithForm(petId,name,status,securityContext);
} }
@POST @POST
@Path("/{petId}/uploadImage") @Path("/{petId}/uploadImage")
@ -167,6 +169,6 @@ public class PetApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext) public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.uploadFile(input,petId,securityContext); return service.uploadFile(input,petId,securityContext);
} }
} }

View File

@ -18,21 +18,21 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
public abstract class PetApiService { public interface PetApiService {
public abstract Response addPet(Pet body,SecurityContext securityContext) Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext) Response findPetsByStatus(List<String> status,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext) Response findPetsByTags(List<String> tags,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getPetById(Long petId,SecurityContext securityContext) Response getPetById(Long petId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response updatePet(Pet body,SecurityContext securityContext) Response updatePet(Pet body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
} }

View File

@ -2,7 +2,6 @@ package io.swagger.api;
import io.swagger.model.*; import io.swagger.model.*;
import io.swagger.api.StoreApiService; import io.swagger.api.StoreApiService;
import io.swagger.api.factories.StoreApiServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -20,6 +19,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@Path("/store") @Path("/store")
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
@io.swagger.annotations.Api(description = "the store API") @io.swagger.annotations.Api(description = "the store API")
public class StoreApi { public class StoreApi {
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
@Inject StoreApiService service;
@DELETE @DELETE
@Path("/order/{orderId}") @Path("/order/{orderId}")
@ -41,7 +43,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext) public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deleteOrder(orderId,securityContext); return service.deleteOrder(orderId,securityContext);
} }
@GET @GET
@Path("/inventory") @Path("/inventory")
@ -54,7 +56,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
public Response getInventory(@Context SecurityContext securityContext) public Response getInventory(@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getInventory(securityContext); return service.getInventory(securityContext);
} }
@GET @GET
@Path("/order/{orderId}") @Path("/order/{orderId}")
@ -69,7 +71,7 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext) public Response getOrderById( @Min(1) @Max(5) @PathParam("orderId") Long orderId,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getOrderById(orderId,securityContext); return service.getOrderById(orderId,securityContext);
} }
@POST @POST
@Path("/order") @Path("/order")
@ -82,6 +84,6 @@ public class StoreApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) })
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext) public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.placeOrder(body,securityContext); return service.placeOrder(body,securityContext);
} }
} }

View File

@ -16,13 +16,13 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
public abstract class StoreApiService { public interface StoreApiService {
public abstract Response deleteOrder(String orderId,SecurityContext securityContext) Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getInventory(SecurityContext securityContext) Response getInventory(SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getOrderById(Long orderId,SecurityContext securityContext) Response getOrderById(Long orderId,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response placeOrder(Order body,SecurityContext securityContext) Response placeOrder(Order body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
} }

View File

@ -2,7 +2,6 @@ package io.swagger.api;
import io.swagger.model.*; import io.swagger.model.*;
import io.swagger.api.UserApiService; import io.swagger.api.UserApiService;
import io.swagger.api.factories.UserApiServiceFactory;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import io.swagger.jaxrs.*; import io.swagger.jaxrs.*;
@ -20,6 +19,8 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.inject.Inject;
import javax.validation.constraints.*; import javax.validation.constraints.*;
@Path("/user") @Path("/user")
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
@io.swagger.annotations.Api(description = "the user API") @io.swagger.annotations.Api(description = "the user API")
public class UserApi { public class UserApi {
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
@Inject UserApiService service;
@POST @POST
@ -39,7 +41,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body,@Context SecurityContext securityContext) public Response createUser(@ApiParam(value = "Created user object" ,required=true) User body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.createUser(body,securityContext); return service.createUser(body,securityContext);
} }
@POST @POST
@Path("/createWithArray") @Path("/createWithArray")
@ -50,7 +52,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext) public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.createUsersWithArrayInput(body,securityContext); return service.createUsersWithArrayInput(body,securityContext);
} }
@POST @POST
@Path("/createWithList") @Path("/createWithList")
@ -61,7 +63,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext) public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.createUsersWithListInput(body,securityContext); return service.createUsersWithListInput(body,securityContext);
} }
@DELETE @DELETE
@Path("/{username}") @Path("/{username}")
@ -74,7 +76,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext) public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.deleteUser(username,securityContext); return service.deleteUser(username,securityContext);
} }
@GET @GET
@Path("/{username}") @Path("/{username}")
@ -89,7 +91,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext) public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.getUserByName(username,securityContext); return service.getUserByName(username,securityContext);
} }
@GET @GET
@Path("/login") @Path("/login")
@ -102,7 +104,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = Void.class) })
public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext) public Response loginUser( @NotNull @QueryParam("username") String username, @NotNull @QueryParam("password") String password,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.loginUser(username,password,securityContext); return service.loginUser(username,password,securityContext);
} }
@GET @GET
@Path("/logout") @Path("/logout")
@ -113,7 +115,7 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
public Response logoutUser(@Context SecurityContext securityContext) public Response logoutUser(@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.logoutUser(securityContext); return service.logoutUser(securityContext);
} }
@PUT @PUT
@Path("/{username}") @Path("/{username}")
@ -126,6 +128,6 @@ public class UserApi {
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User body,@Context SecurityContext securityContext) public Response updateUser( @PathParam("username") String username,@ApiParam(value = "Updated user object" ,required=true) User body,@Context SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
return delegate.updateUser(username,body,securityContext); return service.updateUser(username,body,securityContext);
} }
} }

View File

@ -16,21 +16,21 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
public abstract class UserApiService { public interface UserApiService {
public abstract Response createUser(User body,SecurityContext securityContext) Response createUser(User body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext) Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext) Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response deleteUser(String username,SecurityContext securityContext) Response deleteUser(String username,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response getUserByName(String username,SecurityContext securityContext) Response getUserByName(String username,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response loginUser(String username,String password,SecurityContext securityContext) Response loginUser(String username,String password,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response logoutUser(SecurityContext securityContext) Response logoutUser(SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
public abstract Response updateUser(String username,User body,SecurityContext securityContext) Response updateUser(String username,User body,SecurityContext securityContext)
throws NotFoundException; throws NotFoundException;
} }

View File

@ -14,54 +14,48 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
public class PetApiServiceImpl extends PetApiService { public class PetApiServiceImpl implements PetApiService {
@Override
public Response addPet(Pet body,SecurityContext securityContext) public Response addPet(Pet body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response deletePet(Long petId,String apiKey,SecurityContext securityContext) public Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response findPetsByStatus(List<String> status,SecurityContext securityContext) public Response findPetsByStatus(List<String> status,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response findPetsByTags(List<String> tags,SecurityContext securityContext) public Response findPetsByTags(List<String> tags,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getPetById(Long petId,SecurityContext securityContext) public Response getPetById(Long petId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response updatePet(Pet body,SecurityContext securityContext) public Response updatePet(Pet body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext) public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext) public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!

View File

@ -12,30 +12,28 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
public class StoreApiServiceImpl extends StoreApiService { public class StoreApiServiceImpl implements StoreApiService {
@Override
public Response deleteOrder(String orderId,SecurityContext securityContext) public Response deleteOrder(String orderId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getInventory(SecurityContext securityContext) public Response getInventory(SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getOrderById(Long orderId,SecurityContext securityContext) public Response getOrderById(Long orderId,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response placeOrder(Order body,SecurityContext securityContext) public Response placeOrder(Order body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!

View File

@ -12,54 +12,48 @@ import io.swagger.api.NotFoundException;
import java.io.InputStream; import java.io.InputStream;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext; import javax.ws.rs.core.SecurityContext;
@RequestScoped
public class UserApiServiceImpl extends UserApiService { public class UserApiServiceImpl implements UserApiService {
@Override
public Response createUser(User body,SecurityContext securityContext) public Response createUser(User body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext) public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response createUsersWithListInput(List<User> body,SecurityContext securityContext) public Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response deleteUser(String username,SecurityContext securityContext) public Response deleteUser(String username,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response getUserByName(String username,SecurityContext securityContext) public Response getUserByName(String username,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response loginUser(String username,String password,SecurityContext securityContext) public Response loginUser(String username,String password,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response logoutUser(SecurityContext securityContext) public Response logoutUser(SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
} }
@Override
public Response updateUser(String username,User body,SecurityContext securityContext) public Response updateUser(String username,User body,SecurityContext securityContext)
throws NotFoundException { throws NotFoundException {
// do some magic! // do some magic!