Commit 22c6117e authored by Spiros Koulouzis's avatar Spiros Koulouzis

removed accept headers

parent a7f2ee92
...@@ -47,7 +47,7 @@ public class CredentialApiController implements CredentialApi { ...@@ -47,7 +47,7 @@ public class CredentialApiController implements CredentialApi {
public ResponseEntity<String> createCredentials(@ApiParam( public ResponseEntity<String> createCredentials(@ApiParam(
value = "Created user object", required = true) value = "Created user object", required = true)
@Valid @RequestBody Credential body) { @Valid @RequestBody Credential body) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("application/json")) { // if (accept != null && accept.contains("application/json")) {
try { try {
String id = credentialService.save(body); String id = credentialService.save(body);
...@@ -63,7 +63,7 @@ public class CredentialApiController implements CredentialApi { ...@@ -63,7 +63,7 @@ public class CredentialApiController implements CredentialApi {
@Override @Override
public ResponseEntity<List<String>> getCredentialIDs() { public ResponseEntity<List<String>> getCredentialIDs() {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("application/json")) { // if (accept != null && accept.contains("application/json")) {
List<String> ids = credentialService.getAllIds(); List<String> ids = credentialService.getAllIds();
return new ResponseEntity<>(ids, HttpStatus.OK); return new ResponseEntity<>(ids, HttpStatus.OK);
......
...@@ -40,8 +40,8 @@ public class DeployerApiController implements DeployerApi { ...@@ -40,8 +40,8 @@ public class DeployerApiController implements DeployerApi {
@ApiParam(value = "ID of topolog template to deploy", required = true) @ApiParam(value = "ID of topolog template to deploy", required = true)
@PathVariable("id") String id) { @PathVariable("id") String id) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
if (accept != null && accept.contains("")) { // if (accept != null && accept.contains("")) {
try { try {
String planedYemplateId = dripService.deploy(id, null); String planedYemplateId = dripService.deploy(id, null);
return new ResponseEntity<>(planedYemplateId, HttpStatus.OK); return new ResponseEntity<>(planedYemplateId, HttpStatus.OK);
...@@ -51,9 +51,9 @@ public class DeployerApiController implements DeployerApi { ...@@ -51,9 +51,9 @@ public class DeployerApiController implements DeployerApi {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
} }
} else { // } else {
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE); // return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
} // }
} }
} }
...@@ -40,8 +40,8 @@ public class PlannerApiController implements PlannerApi { ...@@ -40,8 +40,8 @@ public class PlannerApiController implements PlannerApi {
public ResponseEntity<String> planToscaTemplateByID(@ApiParam( public ResponseEntity<String> planToscaTemplateByID(@ApiParam(
value = "ID of topolog template to plan", required = true) value = "ID of topolog template to plan", required = true)
@PathVariable("id") String id) { @PathVariable("id") String id) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
if (accept != null && accept.contains("text/plain")) { // if (accept != null && accept.contains("text/plain")) {
try { try {
String planedYemplateId = dripService.plan(id); String planedYemplateId = dripService.plan(id);
...@@ -51,9 +51,9 @@ public class PlannerApiController implements PlannerApi { ...@@ -51,9 +51,9 @@ public class PlannerApiController implements PlannerApi {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
} }
} else { // } else {
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE); // return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
} // }
} }
......
...@@ -45,8 +45,8 @@ public class ProvisionerApiController implements ProvisionerApi { ...@@ -45,8 +45,8 @@ public class ProvisionerApiController implements ProvisionerApi {
public ResponseEntity<String> provisionPlanToscaTemplateByID( public ResponseEntity<String> provisionPlanToscaTemplateByID(
@ApiParam(value = "ID of topolog template to provision", required = true) @ApiParam(value = "ID of topolog template to provision", required = true)
@PathVariable("id") String id) { @PathVariable("id") String id) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
if (accept != null && accept.contains("text/plain")) { // if (accept != null && accept.contains("text/plain")) {
try { try {
String planedYemplateId = dripService.provision(id); String planedYemplateId = dripService.provision(id);
return new ResponseEntity<>(planedYemplateId, HttpStatus.OK); return new ResponseEntity<>(planedYemplateId, HttpStatus.OK);
...@@ -57,9 +57,9 @@ public class ProvisionerApiController implements ProvisionerApi { ...@@ -57,9 +57,9 @@ public class ProvisionerApiController implements ProvisionerApi {
java.util.logging.Logger.getLogger(ProvisionerApiController.class.getName()).log(Level.SEVERE, null, ex); java.util.logging.Logger.getLogger(ProvisionerApiController.class.getName()).log(Level.SEVERE, null, ex);
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(ex.getMessage());
} }
} else { // } else {
return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE); // return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE);
} // }
} }
} }
...@@ -52,7 +52,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi { ...@@ -52,7 +52,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@ApiParam(value = "ID of topology template to return", required = true) @ApiParam(value = "ID of topology template to return", required = true)
@PathVariable("id") String id, @ApiParam(value = "The node(s) to delete") @PathVariable("id") String id, @ApiParam(value = "The node(s) to delete")
@Valid @RequestParam(value = "node_names", required = false) List<String> nodeName) { @Valid @RequestParam(value = "node_names", required = false) List<String> nodeName) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("text/plain")) { // if (accept != null && accept.contains("text/plain")) {
try { try {
dripService.delete(id, nodeName); dripService.delete(id, nodeName);
...@@ -70,9 +70,8 @@ public class ToscaTemplateApiController implements ToscaTemplateApi { ...@@ -70,9 +70,8 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@Override @Override
public ResponseEntity<String> getToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id) { public ResponseEntity<String> getToscaTemplateByID(@ApiParam(value = "ID of topolog template to return", required = true) @PathVariable("id") String id) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("text/plain")) { // if (accept != null && accept.contains("text/plain")) {
try { try {
String ymlStr = toscaTemplateService.findByID(id); String ymlStr = toscaTemplateService.findByID(id);
return new ResponseEntity<>(ymlStr, HttpStatus.OK); return new ResponseEntity<>(ymlStr, HttpStatus.OK);
...@@ -92,7 +91,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi { ...@@ -92,7 +91,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
value = "ID of topolog template to return", required = true) value = "ID of topolog template to return", required = true)
@PathVariable("id") String id, @ApiParam(value = "file detail") @PathVariable("id") String id, @ApiParam(value = "file detail")
@Valid @RequestPart("file") MultipartFile file) { @Valid @RequestPart("file") MultipartFile file) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("text/plain")) { // if (accept != null && accept.contains("text/plain")) {
try { try {
id = toscaTemplateService.updateToscaTemplateByID(id, file); id = toscaTemplateService.updateToscaTemplateByID(id, file);
...@@ -109,7 +108,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi { ...@@ -109,7 +108,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@Override @Override
public ResponseEntity<String> uploadToscaTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { public ResponseEntity<String> uploadToscaTemplate(@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("*/*")) { // if (accept != null && accept.contains("*/*")) {
try { try {
String id = toscaTemplateService.saveFile(file); String id = toscaTemplateService.saveFile(file);
...@@ -127,7 +126,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi { ...@@ -127,7 +126,7 @@ public class ToscaTemplateApiController implements ToscaTemplateApi {
@Override @Override
public ResponseEntity<List<String>> getToscaTemplateIDs() { public ResponseEntity<List<String>> getToscaTemplateIDs() {
String accept = request.getHeader("Accept"); // String accept = request.getHeader("Accept");
// if (accept != null && accept.contains("application/json")) { // if (accept != null && accept.contains("application/json")) {
List<String> ids = toscaTemplateService.getAllIds(); List<String> ids = toscaTemplateService.getAllIds();
return new ResponseEntity<>(ids, HttpStatus.NOT_IMPLEMENTED); return new ResponseEntity<>(ids, HttpStatus.NOT_IMPLEMENTED);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment