Search in sources :

Example 1 with Dtos

use of uk.ac.bbsrc.tgac.miso.dto.Dtos in project miso-lims by miso-lims.

the class QcTypeRestController method updateSubproject.

@PutMapping(value = "/{id}", headers = { "Content-type=application/json" })
@ResponseBody
public QcTypeDto updateSubproject(@PathVariable("id") long id, @RequestBody QcTypeDto qcTypeDto) throws IOException {
    return RestUtils.updateObject("QC Type", id, qcTypeDto, Dtos::to, qcTypeService, qcType -> {
        QcTypeDto dto = Dtos.asDto(qcType);
        constantsController.refreshConstants();
        return dto;
    });
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) QcTypeDto(uk.ac.bbsrc.tgac.miso.dto.QcTypeDto) PutMapping(org.springframework.web.bind.annotation.PutMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with Dtos

use of uk.ac.bbsrc.tgac.miso.dto.Dtos in project miso-lims by miso-lims.

the class QcTypeRestController method createQcType.

@PostMapping(headers = { "Content-type=application/json" })
@ResponseBody
public QcTypeDto createQcType(@RequestBody QcTypeDto qcTypeDto) throws IOException {
    return RestUtils.createObject("QC Type", qcTypeDto, Dtos::to, qcTypeService, qcType -> {
        QcTypeDto dto = Dtos.asDto(qcType);
        constantsController.refreshConstants();
        return dto;
    });
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) QcTypeDto(uk.ac.bbsrc.tgac.miso.dto.QcTypeDto) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with Dtos

use of uk.ac.bbsrc.tgac.miso.dto.Dtos in project miso-lims by miso-lims.

the class SampleClassRestController method updateSampleClass.

@PutMapping(value = "/{id}", headers = { "Content-type=application/json" })
@ResponseStatus(HttpStatus.OK)
@ResponseBody
public SampleClassDto updateSampleClass(@PathVariable("id") long id, @RequestBody SampleClassDto sampleClassDto) throws IOException {
    return RestUtils.updateObject("Sample Class", id, sampleClassDto, Dtos::to, sampleClassService, sampleClass -> {
        SampleClassDto dto = Dtos.asDto(sampleClass);
        constantsController.refreshConstants();
        return dto;
    });
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) SampleClassDto(uk.ac.bbsrc.tgac.miso.dto.SampleClassDto) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) PutMapping(org.springframework.web.bind.annotation.PutMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with Dtos

use of uk.ac.bbsrc.tgac.miso.dto.Dtos in project miso-lims by miso-lims.

the class AsyncOperationManager method startAsyncBulkQcUpdate.

public <T, R extends Identifiable> ObjectNode startAsyncBulkQcUpdate(List<QcDto> dtos) throws IOException {
    final QcTarget qcTarget = getQcTarget(dtos.get(0).getQcTarget());
    List<QC> items = validateBulkUpdate("QC", dtos, Dtos::to, id -> qualityControlService.get(qcTarget, id));
    BulkSaveOperation<QC> operation = qualityControlService.startBulkUpdate(items);
    String uuid = addAsyncOperation(operation);
    return makeRunningProgress(uuid, operation);
}
Also used : QC(uk.ac.bbsrc.tgac.miso.core.data.qc.QC) Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) QcTarget(uk.ac.bbsrc.tgac.miso.core.data.qc.QcTarget)

Example 5 with Dtos

use of uk.ac.bbsrc.tgac.miso.dto.Dtos in project miso-lims by miso-lims.

the class LabRestController method createLab.

@PostMapping(headers = { "Content-type=application/json" })
@ResponseBody
public LabDto createLab(@RequestBody LabDto labDto, UriComponentsBuilder uriBuilder) throws IOException {
    LabDto saved = RestUtils.createObject("Lab", labDto, Dtos::to, labService, Dtos::asDto);
    constantsController.refreshConstants();
    return saved;
}
Also used : Dtos(uk.ac.bbsrc.tgac.miso.dto.Dtos) LabDto(uk.ac.bbsrc.tgac.miso.dto.LabDto) PostMapping(org.springframework.web.bind.annotation.PostMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Dtos (uk.ac.bbsrc.tgac.miso.dto.Dtos)29 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)14 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 ModelAndView (org.springframework.web.servlet.ModelAndView)11 NotFoundException (org.springframework.security.acls.model.NotFoundException)10 GetMapping (org.springframework.web.bind.annotation.GetMapping)10 PostMapping (org.springframework.web.bind.annotation.PostMapping)8 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)8 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)7 PutMapping (org.springframework.web.bind.annotation.PutMapping)7 IOException (java.io.IOException)6 Collectors (java.util.stream.Collectors)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 Controller (org.springframework.stereotype.Controller)6 PathVariable (org.springframework.web.bind.annotation.PathVariable)6 User (com.eaglegenomics.simlims.core.User)5 List (java.util.List)5 ArrayList (java.util.ArrayList)4 Objects (java.util.Objects)4 Stream (java.util.stream.Stream)4