[Developer] #424 support ORDS handler source editing
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
package com.cloudhandson.vpdbackoffice.web;
|
||||
|
||||
import com.cloudhandson.vpdbackoffice.domain.ords.OrdsHandlerUpdateCommand;
|
||||
import com.cloudhandson.vpdbackoffice.service.AppException;
|
||||
import com.cloudhandson.vpdbackoffice.service.OrdsMetadataService;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
@Controller
|
||||
public class OrdsHandlerController {
|
||||
@@ -19,4 +25,22 @@ public class OrdsHandlerController {
|
||||
model.addAttribute("handlers", ordsMetadataService.findHandlers());
|
||||
return "ords-handlers";
|
||||
}
|
||||
|
||||
@PostMapping("/ords-handlers/update")
|
||||
public String update(
|
||||
@RequestParam long handlerId,
|
||||
@RequestParam String source,
|
||||
RedirectAttributes redirectAttributes
|
||||
) {
|
||||
try {
|
||||
ordsMetadataService.updateHandlerSource(new OrdsHandlerUpdateCommand(handlerId, source));
|
||||
redirectAttributes.addFlashAttribute("message", "ORDS Handler Source를 저장했습니다.");
|
||||
} catch (AppException exception) {
|
||||
redirectAttributes.addFlashAttribute("errorMessage", exception.getMessage());
|
||||
} catch (DataAccessException exception) {
|
||||
RuntimeErrorMessage error = RuntimeErrorMessages.dataAccess(exception);
|
||||
redirectAttributes.addFlashAttribute("errorMessage", error.message());
|
||||
}
|
||||
return "redirect:/ords-handlers";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user