forked from loafle/openapi-generator-original
update java play petstore sample
This commit is contained in:
@@ -11,6 +11,14 @@ import java.util.HashMap;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private PetApiControllerImp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
@@ -26,18 +34,42 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus(List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByTags(List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", Pet.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Pet.class);
|
||||
}
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@@ -56,6 +88,10 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", ModelApiResponse.class);
|
||||
}
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,14 @@ import java.util.HashMap;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private StoreApiControllerImp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
@@ -19,18 +27,38 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public Map<String, Integer> getInventory() throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Map.class);
|
||||
}
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderById(Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
return new Order();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,14 @@ import java.util.HashMap;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private UserApiControllerImp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUser(User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
@@ -37,12 +45,28 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public User getUserByName(String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", User.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", User.class);
|
||||
}
|
||||
return new User();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loginUser(String username, String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", String.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", String.class);
|
||||
}
|
||||
return new String();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user