Package com.easydesk.web.controller
Class AttributeAdminController
java.lang.Object
com.easydesk.web.controller.AttributeAdminController
Global Attribute 관리 화면 ("Attribute" / "UserAttribute" 두 tab).
ModuleAdminController 의 admin-module-attributes(Attribute 추가) 화면은 특정 Module/ItemType/
AttributeGroup 에 attribute 를 등록하는 화면이지만, 여기는 그와 무관하게 EASYDESK_ATTRIBUTE
테이블 전체를 다루는 global 관리 화면이다.
목록 화면(admin-attribute-management.html)은 이제 순수 목록 + 링크만 담당하고, 실제 수정은
Attribute 이름을 클릭해서 들어가는 상세 화면(admin-attribute-detail.html)에서 이루어진다.
Name/Type 은 상세 화면에서도 읽기 전용이고 Localized/Global/Common/Removed 4개 체크박스만
수정 가능하다 (RequestAttributeAdmin/RequestAttributeAdminMapper 사용). 상세 화면은 추가로
OptionAttribute(attribute.getAttributeType().isOptionType())인 경우 AttributeOption 목록을
보여주고, 이름만 입력하면 새 AttributeOption 을 추가할 수 있다 (core 의 AttributeOptionFactory
사용 - root 바로 아래에 하나 추가하는 것과 동일).
화면 전용 표시 데이터(typeName 등)는 shared library 의 RequestAttributeAdmin 에 넣지 않고
이 컨트롤러 안의 private record(AttributeAdminRow/AttributeOptionRow)로만 둔다 - RequestAttributeAdmin
은 Attribute 엔티티를 그대로 반영하는 재사용 가능한 도메인 record 로 유지하기 위함.
-
Constructor Summary
ConstructorsConstructorDescriptionAttributeAdminController(org.springframework.context.MessageSource messageSource) -
Method Summary
Modifier and TypeMethodDescriptionaddOption(Integer id, String optionName, Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) OptionAttribute 인 Attribute 에 이름만으로 새 AttributeOption 을 추가한다 (root 바로 아래에 하나 추가 - core 의 AttributeOptionFactory.getFactory(attribute).add(name) 사용).create(String name, Integer typeId, Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 새 Attribute 를 생성한다 (core 테스트 코드와 동일한 방식: AttributeManager.getInstance() 로 빈 Attribute 를 만들고 name/typeId 만 채워서 저장).detail(Integer id, Integer activeTab, HttpSession session, org.springframework.ui.Model model) Attribute 상세/관리 화면.list(Integer activeTab, HttpSession session, org.springframework.ui.Model model) newForm(Integer activeTab, HttpSession session, org.springframework.ui.Model model) 새 Attribute 추가 폼.update(Integer id, Boolean localized, Boolean global, Boolean common, Boolean removed, Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 화면에서 체크박스 상태를 넘겨받아 localized/global/common/removed 를 갱신한다.
-
Constructor Details
-
AttributeAdminController
public AttributeAdminController(org.springframework.context.MessageSource messageSource)
-
-
Method Details
-
list
@Screen("AdminAttributeManagement") @GetMapping("/admin/attributes") public String list(@RequestParam(value="tab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.ui.Model model) -
detail
@Screen("AdminAttributeDetail") @GetMapping("/admin/attributes/{id}") public String detail(@PathVariable("id") Integer id, @RequestParam(value="tab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.ui.Model model) Attribute 상세/관리 화면. 속성 수정 폼과, OptionAttribute 인 경우 AttributeOption 목록 + 추가 폼을 함께 보여준다. -
update
@Screen("AdminAttributeDetail") @PostMapping("/admin/attributes/{id}/update") public String update(@PathVariable("id") Integer id, @RequestParam(value="localized",required=false) Boolean localized, @RequestParam(value="global",required=false) Boolean global, @RequestParam(value="common",required=false) Boolean common, @RequestParam(value="removed",required=false) Boolean removed, @RequestParam(value="activeTab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 화면에서 체크박스 상태를 넘겨받아 localized/global/common/removed 를 갱신한다. name/typeId 는 RequestAttributeAdminMapper#updateBeanFromRecord() 가 애초에 매핑 대상에서 제외하므로 여기서 넘어오는 값과 무관하게 절대 바뀌지 않는다. 수정 후에는 (목록이 아니라) 상세 화면으로 돌아간다. -
addOption
@Screen("AdminAttributeDetail") @PostMapping("/admin/attributes/{id}/options") public String addOption(@PathVariable("id") Integer id, @RequestParam(value="optionName",required=false) String optionName, @RequestParam(value="activeTab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) OptionAttribute 인 Attribute 에 이름만으로 새 AttributeOption 을 추가한다 (root 바로 아래에 하나 추가 - core 의 AttributeOptionFactory.getFactory(attribute).add(name) 사용). 이미 같은 이름의 Option 이 있으면 factory 가 기존 것을 그대로 반환하므로(예외 아님) 별다른 안내 없이 성공 메시지만 보여준다. -
newForm
@Screen("AdminAttributeNew") @GetMapping("/admin/attributes/new") public String newForm(@RequestParam(value="tab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.ui.Model model) 새 Attribute 추가 폼. -
create
@Screen("AdminAttributeNew") @PostMapping("/admin/attributes/new") public String create(@RequestParam(value="name",required=false) String name, @RequestParam(value="typeId",required=false) Integer typeId, @RequestParam(value="activeTab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) 새 Attribute 를 생성한다 (core 테스트 코드와 동일한 방식: AttributeManager.getInstance() 로 빈 Attribute 를 만들고 name/typeId 만 채워서 저장).
-