forked from loafle/openapi-generator-original
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:
parent
d881cb39bf
commit
643ef64f04
@ -23,7 +23,6 @@ public class JavaResteasyServerCodegen extends AbstractJavaJAXRSServerCodegen im
|
||||
outputFolder = "generated-code/JavaJaxRS-Resteasy";
|
||||
apiTemplateFiles.put("apiService.mustache", ".java");
|
||||
apiTemplateFiles.put("apiServiceImpl.mustache", ".java");
|
||||
apiTemplateFiles.put("apiServiceFactory.mustache", ".java");
|
||||
apiTestTemplateFiles.clear(); // TODO: add test template
|
||||
|
||||
// clear model and api doc template as AbstractJavaJAXRSServerCodegen
|
||||
|
@ -2,7 +2,6 @@ package {{package}};
|
||||
|
||||
import {{modelPackage}}.*;
|
||||
import {{package}}.{{classname}}Service;
|
||||
import {{package}}.factories.{{classname}}ServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
{{#useBeanValidation}}
|
||||
import javax.validation.constraints.*;
|
||||
{{/useBeanValidation}}
|
||||
@ -32,7 +33,8 @@ import javax.validation.constraints.*;
|
||||
{{>generatedAnnotation}}
|
||||
{{#operations}}
|
||||
public class {{classname}} {
|
||||
private final {{classname}}Service delegate = {{classname}}ServiceFactory.get{{classname}}();
|
||||
|
||||
@Inject {{classname}}Service service;
|
||||
|
||||
{{#operation}}
|
||||
@{{httpMethod}}
|
||||
@ -51,7 +53,7 @@ public class {{classname}} {
|
||||
{{/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)
|
||||
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}}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
{{#operations}}
|
||||
public abstract class {{classname}}Service {
|
||||
public interface {{classname}}Service {
|
||||
{{#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;
|
||||
{{/operation}}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -13,14 +13,15 @@ import {{package}}.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
{{>generatedAnnotation}}
|
||||
{{#operations}}
|
||||
public class {{classname}}ServiceImpl extends {{classname}}Service {
|
||||
public class {{classname}}ServiceImpl implements {{classname}}Service {
|
||||
{{#operation}}
|
||||
@Override
|
||||
public Response {{nickname}}({{#isMultipart}}MultipartFormDataInput input,{{/isMultipart}}{{#allParams}}{{>serviceQueryParams}}{{>servicePathParams}}{{>serviceHeaderParams}}{{>serviceBodyParams}}{{^isMultipart}}{{>serviceFormParams}},{{/isMultipart}}{{#isMultipart}}{{^isFormParam}},{{/isFormParam}}{{/isMultipart}}{{/allParams}}SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
@ -13,13 +13,18 @@ dependencies {
|
||||
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11: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:javaee-api:7.0'
|
||||
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 '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 'joda-time:joda-time:2.7'
|
||||
{{/joda}}
|
||||
//TODO: swaggerFeature
|
||||
compile 'io.swagger:swagger-jaxrs:1.5.12'
|
||||
|
||||
testCompile 'junit:junit:4.12',
|
||||
'org.hamcrest:hamcrest-core:1.3'
|
||||
}
|
||||
|
@ -58,6 +58,14 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<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>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
@ -103,6 +111,7 @@
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||
<version>${resteasy-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
|
@ -13,9 +13,16 @@ dependencies {
|
||||
providedCompile 'org.jboss.resteasy:resteasy-validator-provider-11: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:javaee-api:7.0'
|
||||
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 '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',
|
||||
'org.hamcrest:hamcrest-core:1.3'
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
|
@ -9,6 +9,15 @@
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
@ -49,6 +58,14 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<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>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
@ -94,6 +111,7 @@
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||
<version>${resteasy-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
|
@ -2,7 +2,6 @@ package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.PetApiService;
|
||||
import io.swagger.api.factories.PetApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
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")
|
||||
|
||||
public class PetApi {
|
||||
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||
|
||||
@Inject PetApiService service;
|
||||
|
||||
@POST
|
||||
|
||||
@ -46,7 +48,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.addPet(body,securityContext);
|
||||
return service.addPet(body,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/{petId}")
|
||||
@ -62,7 +64,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.deletePet(petId,apiKey,securityContext);
|
||||
return service.deletePet(petId,apiKey,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
@ -80,7 +82,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByStatus(status,securityContext);
|
||||
return service.findPetsByStatus(status,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
@ -98,7 +100,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByTags(tags,securityContext);
|
||||
return service.findPetsByTags(tags,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
@ -115,7 +117,7 @@ public class PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) })
|
||||
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetById(petId,securityContext);
|
||||
return service.getPetById(petId,securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@ -135,7 +137,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePet(body,securityContext);
|
||||
return service.updatePet(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}")
|
||||
@ -151,7 +153,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||
return service.updatePetWithForm(petId,name,status,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImage")
|
||||
@ -167,6 +169,6 @@ public class PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(input,petId,securityContext);
|
||||
return service.uploadFile(input,petId,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -18,21 +18,21 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class PetApiService {
|
||||
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
||||
public interface PetApiService {
|
||||
Response addPet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
||||
Response getPetById(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||
Response updatePet(Pet body,SecurityContext securityContext)
|
||||
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;
|
||||
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.StoreApiService;
|
||||
import io.swagger.api.factories.StoreApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/store")
|
||||
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
|
||||
@io.swagger.annotations.Api(description = "the store API")
|
||||
|
||||
public class StoreApi {
|
||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||
|
||||
@Inject StoreApiService service;
|
||||
|
||||
@DELETE
|
||||
@Path("/order/{orderId}")
|
||||
@ -41,7 +43,7 @@ public class StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteOrder(orderId,securityContext);
|
||||
return service.deleteOrder(orderId,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/inventory")
|
||||
@ -54,7 +56,7 @@ public class StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
|
||||
public Response getInventory(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getInventory(securityContext);
|
||||
return service.getInventory(securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/order/{orderId}")
|
||||
@ -69,7 +71,7 @@ public class StoreApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.getOrderById(orderId,securityContext);
|
||||
return service.getOrderById(orderId,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/order")
|
||||
@ -82,6 +84,6 @@ public class StoreApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.placeOrder(body,securityContext);
|
||||
return service.placeOrder(body,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class StoreApiService {
|
||||
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
public interface StoreApiService {
|
||||
Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getInventory(SecurityContext securityContext)
|
||||
Response getInventory(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
||||
Response placeOrder(Order body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.UserApiService;
|
||||
import io.swagger.api.factories.UserApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/user")
|
||||
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
|
||||
@io.swagger.annotations.Api(description = "the user API")
|
||||
|
||||
public class UserApi {
|
||||
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||
|
||||
@Inject UserApiService service;
|
||||
|
||||
@POST
|
||||
|
||||
@ -39,7 +41,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.createUser(body,securityContext);
|
||||
return service.createUser(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/createWithArray")
|
||||
@ -50,7 +52,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithArrayInput(body,securityContext);
|
||||
return service.createUsersWithArrayInput(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/createWithList")
|
||||
@ -61,7 +63,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithListInput(body,securityContext);
|
||||
return service.createUsersWithListInput(body,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/{username}")
|
||||
@ -74,7 +76,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteUser(username,securityContext);
|
||||
return service.deleteUser(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{username}")
|
||||
@ -89,7 +91,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getUserByName(username,securityContext);
|
||||
return service.getUserByName(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/login")
|
||||
@ -102,7 +104,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.loginUser(username,password,securityContext);
|
||||
return service.loginUser(username,password,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/logout")
|
||||
@ -113,7 +115,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
public Response logoutUser(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.logoutUser(securityContext);
|
||||
return service.logoutUser(securityContext);
|
||||
}
|
||||
@PUT
|
||||
@Path("/{username}")
|
||||
@ -126,6 +128,6 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updateUser(username,body,securityContext);
|
||||
return service.updateUser(username,body,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -16,21 +16,21 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class UserApiService {
|
||||
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||
public interface UserApiService {
|
||||
Response createUser(User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
||||
Response deleteUser(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
||||
Response getUserByName(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response logoutUser(SecurityContext securityContext)
|
||||
Response logoutUser(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -14,54 +14,48 @@ import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
|
||||
public class PetApiServiceImpl extends PetApiService {
|
||||
@Override
|
||||
public class PetApiServiceImpl implements PetApiService {
|
||||
public Response addPet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getPetById(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response updatePet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
@ -12,30 +12,28 @@ import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
|
||||
public class StoreApiServiceImpl extends StoreApiService {
|
||||
@Override
|
||||
public class StoreApiServiceImpl implements StoreApiService {
|
||||
public Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getInventory(SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response placeOrder(Order body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
@ -12,54 +12,48 @@ import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
|
||||
public class UserApiServiceImpl extends UserApiService {
|
||||
@Override
|
||||
public class UserApiServiceImpl implements UserApiService {
|
||||
public Response createUser(User body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response deleteUser(String username,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getUserByName(String username,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response logoutUser(SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
@ -9,6 +9,15 @@
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<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>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
@ -49,6 +58,14 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<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>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
@ -94,6 +111,7 @@
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||
<version>${resteasy-version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
@ -143,6 +161,14 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</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>
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -2,7 +2,6 @@ package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.PetApiService;
|
||||
import io.swagger.api.factories.PetApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
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")
|
||||
|
||||
public class PetApi {
|
||||
private final PetApiService delegate = PetApiServiceFactory.getPetApi();
|
||||
|
||||
@Inject PetApiService service;
|
||||
|
||||
@POST
|
||||
|
||||
@ -46,7 +48,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.addPet(body,securityContext);
|
||||
return service.addPet(body,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/{petId}")
|
||||
@ -62,7 +64,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.deletePet(petId,apiKey,securityContext);
|
||||
return service.deletePet(petId,apiKey,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByStatus")
|
||||
@ -80,7 +82,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByStatus(status,securityContext);
|
||||
return service.findPetsByStatus(status,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/findByTags")
|
||||
@ -98,7 +100,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.findPetsByTags(tags,securityContext);
|
||||
return service.findPetsByTags(tags,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{petId}")
|
||||
@ -115,7 +117,7 @@ public class PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class) })
|
||||
public Response getPetById( @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getPetById(petId,securityContext);
|
||||
return service.getPetById(petId,securityContext);
|
||||
}
|
||||
@PUT
|
||||
|
||||
@ -135,7 +137,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePet(body,securityContext);
|
||||
return service.updatePet(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}")
|
||||
@ -151,7 +153,7 @@ public class PetApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updatePetWithForm(petId,name,status,securityContext);
|
||||
return service.updatePetWithForm(petId,name,status,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/{petId}/uploadImage")
|
||||
@ -167,6 +169,6 @@ public class PetApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Long petId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.uploadFile(input,petId,securityContext);
|
||||
return service.uploadFile(input,petId,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -18,21 +18,21 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class PetApiService {
|
||||
public abstract Response addPet(Pet body,SecurityContext securityContext)
|
||||
public interface PetApiService {
|
||||
Response addPet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getPetById(Long petId,SecurityContext securityContext)
|
||||
Response getPetById(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response updatePet(Pet body,SecurityContext securityContext)
|
||||
Response updatePet(Pet body,SecurityContext securityContext)
|
||||
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;
|
||||
public abstract Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.StoreApiService;
|
||||
import io.swagger.api.factories.StoreApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/store")
|
||||
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
|
||||
@io.swagger.annotations.Api(description = "the store API")
|
||||
|
||||
public class StoreApi {
|
||||
private final StoreApiService delegate = StoreApiServiceFactory.getStoreApi();
|
||||
|
||||
@Inject StoreApiService service;
|
||||
|
||||
@DELETE
|
||||
@Path("/order/{orderId}")
|
||||
@ -41,7 +43,7 @@ public class StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) })
|
||||
public Response deleteOrder( @PathParam("orderId") String orderId,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteOrder(orderId,securityContext);
|
||||
return service.deleteOrder(orderId,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/inventory")
|
||||
@ -54,7 +56,7 @@ public class StoreApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") })
|
||||
public Response getInventory(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getInventory(securityContext);
|
||||
return service.getInventory(securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/order/{orderId}")
|
||||
@ -69,7 +71,7 @@ public class StoreApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.getOrderById(orderId,securityContext);
|
||||
return service.getOrderById(orderId,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/order")
|
||||
@ -82,6 +84,6 @@ public class StoreApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.placeOrder(body,securityContext);
|
||||
return service.placeOrder(body,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -16,13 +16,13 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class StoreApiService {
|
||||
public abstract Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
public interface StoreApiService {
|
||||
Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getInventory(SecurityContext securityContext)
|
||||
Response getInventory(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response placeOrder(Order body,SecurityContext securityContext)
|
||||
Response placeOrder(Order body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package io.swagger.api;
|
||||
|
||||
import io.swagger.model.*;
|
||||
import io.swagger.api.UserApiService;
|
||||
import io.swagger.api.factories.UserApiServiceFactory;
|
||||
|
||||
import io.swagger.annotations.ApiParam;
|
||||
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.SecurityContext;
|
||||
import javax.ws.rs.*;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Path("/user")
|
||||
@ -28,7 +29,8 @@ import javax.validation.constraints.*;
|
||||
@io.swagger.annotations.Api(description = "the user API")
|
||||
|
||||
public class UserApi {
|
||||
private final UserApiService delegate = UserApiServiceFactory.getUserApi();
|
||||
|
||||
@Inject UserApiService service;
|
||||
|
||||
@POST
|
||||
|
||||
@ -39,7 +41,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.createUser(body,securityContext);
|
||||
return service.createUser(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/createWithArray")
|
||||
@ -50,7 +52,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithArrayInput(body,securityContext);
|
||||
return service.createUsersWithArrayInput(body,securityContext);
|
||||
}
|
||||
@POST
|
||||
@Path("/createWithList")
|
||||
@ -61,7 +63,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.createUsersWithListInput(body,securityContext);
|
||||
return service.createUsersWithListInput(body,securityContext);
|
||||
}
|
||||
@DELETE
|
||||
@Path("/{username}")
|
||||
@ -74,7 +76,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
public Response deleteUser( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.deleteUser(username,securityContext);
|
||||
return service.deleteUser(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/{username}")
|
||||
@ -89,7 +91,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) })
|
||||
public Response getUserByName( @PathParam("username") String username,@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.getUserByName(username,securityContext);
|
||||
return service.getUserByName(username,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/login")
|
||||
@ -102,7 +104,7 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.loginUser(username,password,securityContext);
|
||||
return service.loginUser(username,password,securityContext);
|
||||
}
|
||||
@GET
|
||||
@Path("/logout")
|
||||
@ -113,7 +115,7 @@ public class UserApi {
|
||||
@io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) })
|
||||
public Response logoutUser(@Context SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
return delegate.logoutUser(securityContext);
|
||||
return service.logoutUser(securityContext);
|
||||
}
|
||||
@PUT
|
||||
@Path("/{username}")
|
||||
@ -126,6 +128,6 @@ public class UserApi {
|
||||
@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)
|
||||
throws NotFoundException {
|
||||
return delegate.updateUser(username,body,securityContext);
|
||||
return service.updateUser(username,body,securityContext);
|
||||
}
|
||||
}
|
||||
|
@ -16,21 +16,21 @@ import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
|
||||
public abstract class UserApiService {
|
||||
public abstract Response createUser(User body,SecurityContext securityContext)
|
||||
public interface UserApiService {
|
||||
Response createUser(User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response deleteUser(String username,SecurityContext securityContext)
|
||||
Response deleteUser(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response getUserByName(String username,SecurityContext securityContext)
|
||||
Response getUserByName(String username,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response logoutUser(SecurityContext securityContext)
|
||||
Response logoutUser(SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
public abstract Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
throws NotFoundException;
|
||||
}
|
||||
|
@ -14,54 +14,48 @@ import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
|
||||
public class PetApiServiceImpl extends PetApiService {
|
||||
@Override
|
||||
public class PetApiServiceImpl implements PetApiService {
|
||||
public Response addPet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response deletePet(Long petId,String apiKey,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response findPetsByStatus(List<String> status,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response findPetsByTags(List<String> tags,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getPetById(Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response updatePet(Pet body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response updatePetWithForm(Long petId,String name,String status,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response uploadFile(MultipartFormDataInput input,Long petId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
@ -12,30 +12,28 @@ import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
|
||||
public class StoreApiServiceImpl extends StoreApiService {
|
||||
@Override
|
||||
public class StoreApiServiceImpl implements StoreApiService {
|
||||
public Response deleteOrder(String orderId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getInventory(SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getOrderById(Long orderId,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response placeOrder(Order body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
@ -12,54 +12,48 @@ import io.swagger.api.NotFoundException;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.SecurityContext;
|
||||
|
||||
@RequestScoped
|
||||
|
||||
public class UserApiServiceImpl extends UserApiService {
|
||||
@Override
|
||||
public class UserApiServiceImpl implements UserApiService {
|
||||
public Response createUser(User body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response deleteUser(String username,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response getUserByName(String username,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response loginUser(String username,String password,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response logoutUser(SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
|
||||
}
|
||||
@Override
|
||||
public Response updateUser(String username,User body,SecurityContext securityContext)
|
||||
throws NotFoundException {
|
||||
// do some magic!
|
||||
|
Loading…
x
Reference in New Issue
Block a user