
com.capitalone.dashboard.rest.ServiceController Maven / Gradle / Ivy
package com.capitalone.dashboard.rest;
import com.capitalone.dashboard.editors.CaseInsensitiveServiceStatusEditor;
import com.capitalone.dashboard.model.DataResponse;
import com.capitalone.dashboard.model.Service;
import com.capitalone.dashboard.model.ServiceStatus;
import com.capitalone.dashboard.request.ServiceRequest;
import com.capitalone.dashboard.service.ServiceService;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.web.bind.annotation.RequestMethod.DELETE;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;
import static org.springframework.web.bind.annotation.RequestMethod.PUT;
@RestController
public class ServiceController {
private final ServiceService serviceService;
@Autowired
public ServiceController(ServiceService serviceService) {
this.serviceService = serviceService;
}
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(ServiceStatus.class, new CaseInsensitiveServiceStatusEditor());
}
@RequestMapping(value = "/service", method = GET, produces = APPLICATION_JSON_VALUE)
public Iterable services() {
return serviceService.all();
}
@RequestMapping(value = "/dashboard/{id}/service", method = GET, produces = APPLICATION_JSON_VALUE)
public DataResponse
© 2015 - 2025 Weber Informatics LLC | Privacy Policy