Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reformat under Shibboleth conventions
iay committed May 11, 2018
1 parent 07933e9 commit 2f18867
Showing 1 changed file with 25 additions and 17 deletions.
@@ -1,27 +1,28 @@

package uk.org.iay.incommon.validator.api;

import uk.org.iay.incommon.validator.models.Status;
import uk.org.iay.incommon.validator.models.Validator;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.*;
import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.*;
import javax.validation.Valid;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2018-05-11T08:14:22.184+01:00")
import com.fasterxml.jackson.databind.ObjectMapper;

import io.swagger.annotations.ApiParam;
import uk.org.iay.incommon.validator.models.Status;
import uk.org.iay.incommon.validator.models.Validator;

@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen",
date = "2018-05-11T08:14:22.184+01:00")

@Controller
public class ValidatorsApiController implements ValidatorsApi {
@@ -42,7 +43,9 @@ public ResponseEntity<List<Validator>> getValidators() {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<List<Validator>>(objectMapper.readValue("[ { \"validator_id\" : \"eduGAIN\", \"description\" : \"validation ruleset for entities from eduGAIN\"}, { \"validator_id\" : \"eduGAIN\", \"description\" : \"validation ruleset for entities from eduGAIN\"} ]", List.class), HttpStatus.NOT_IMPLEMENTED);
return new ResponseEntity<List<Validator>>(objectMapper.readValue(
"[ { \"validator_id\" : \"eduGAIN\", \"description\" : \"validation ruleset for entities from eduGAIN\"}, { \"validator_id\" : \"eduGAIN\", \"description\" : \"validation ruleset for entities from eduGAIN\"} ]",
List.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<List<Validator>>(HttpStatus.INTERNAL_SERVER_ERROR);
@@ -52,11 +55,16 @@ public ResponseEntity<List<Validator>> getValidators() {
return new ResponseEntity<List<Validator>>(HttpStatus.NOT_IMPLEMENTED);
}

public ResponseEntity<List<Status>> validate(@ApiParam(value = "An identifier for the validation to be performed. ",required=true) @PathVariable("validator_id") String validatorId,@ApiParam(value = "The metadata to be validated." ,required=true ) @Valid @RequestBody String metadata) {
public ResponseEntity<List<Status>> validate(
@ApiParam(value = "An identifier for the validation to be performed. ",
required = true) @PathVariable("validator_id") String validatorId,
@ApiParam(value = "The metadata to be validated.", required = true) @Valid @RequestBody String metadata) {
String accept = request.getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
try {
return new ResponseEntity<List<Status>>(objectMapper.readValue("[ { \"status\" : \"error\", \"componentId\" : \"checkSchemas\", \"message\" : \"the entityID doesn't have the correct format\"}, { \"status\" : \"error\", \"componentId\" : \"checkSchemas\", \"message\" : \"the entityID doesn't have the correct format\"} ]", List.class), HttpStatus.NOT_IMPLEMENTED);
return new ResponseEntity<List<Status>>(objectMapper.readValue(
"[ { \"status\" : \"error\", \"componentId\" : \"checkSchemas\", \"message\" : \"the entityID doesn't have the correct format\"}, { \"status\" : \"error\", \"componentId\" : \"checkSchemas\", \"message\" : \"the entityID doesn't have the correct format\"} ]",
List.class), HttpStatus.NOT_IMPLEMENTED);
} catch (IOException e) {
log.error("Couldn't serialize response for content type application/json", e);
return new ResponseEntity<List<Status>>(HttpStatus.INTERNAL_SERVER_ERROR);

0 comments on commit 2f18867

Please sign in to comment.