|
|
@ -1,5 +1,6 @@
|
|
|
|
package ru.ulstu.paper.controller;
|
|
|
|
package ru.ulstu.paper.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.dao.DataIntegrityViolationException;
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
import org.springframework.http.HttpHeaders;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
@ -95,8 +96,15 @@ public class PaperController {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/delete/{paper-id}")
|
|
|
|
@GetMapping("/delete/{paper-id}")
|
|
|
|
public String delete(@PathVariable("paper-id") Integer paperId) throws IOException {
|
|
|
|
public String delete(@Valid PaperFilterDto paperFilterDto,
|
|
|
|
|
|
|
|
@PathVariable("paper-id") Integer paperId,
|
|
|
|
|
|
|
|
Errors errors) throws IOException {
|
|
|
|
|
|
|
|
try {
|
|
|
|
paperService.delete(paperId);
|
|
|
|
paperService.delete(paperId);
|
|
|
|
|
|
|
|
} catch (DataIntegrityViolationException e) {
|
|
|
|
|
|
|
|
errors.reject("relationExist", "Статья прикреплена к конференции");
|
|
|
|
|
|
|
|
return "/papers/papers";
|
|
|
|
|
|
|
|
}
|
|
|
|
return "redirect:/papers/papers";
|
|
|
|
return "redirect:/papers/papers";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|