fix #493: add effective access matrix
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.cloudhandson.vpdbackoffice.web;
|
||||
|
||||
import com.cloudhandson.vpdbackoffice.domain.effective.EffectiveMatrixView;
|
||||
import com.cloudhandson.vpdbackoffice.service.EffectiveMatrixService;
|
||||
import java.util.List;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class EffectiveMatrixController {
|
||||
|
||||
private final EffectiveMatrixService matrixService;
|
||||
|
||||
public EffectiveMatrixController(EffectiveMatrixService matrixService) {
|
||||
this.matrixService = matrixService;
|
||||
}
|
||||
|
||||
@GetMapping("/effective-matrix")
|
||||
public String matrix(Model model) {
|
||||
try {
|
||||
model.addAttribute("matrix", matrixService.matrix());
|
||||
} catch (DataAccessException e) {
|
||||
RuntimeErrorMessage message = RuntimeErrorMessages.dataAccess(e);
|
||||
model.addAttribute("matrix", new EffectiveMatrixView(List.of(), List.of(), List.of(), 0));
|
||||
model.addAttribute("runtimeError", message);
|
||||
}
|
||||
return "effective-matrix";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user