Class ItemTypeAdminController

java.lang.Object
com.easydesk.web.controller.ItemTypeAdminController

@Controller public class ItemTypeAdminController extends Object
Global ItemType (특정 Module 에 속하지 않는, ItemType 엔티티 그 자체) 의 AttributeGroup/Attribute 를 관리하는 화면. ModuleAdminController 의 "Module -> ModuleItemType -> AttributeGroup -> ModuleAttribute" 흐름과 짝을 이루는 "ItemType -> AttributeGroup -> ItemTypeAttribute" 흐름이다. ModuleItemType 오버라이드를 거치지 않고 ItemType#getAttributeGroup(name) 을 그대로 쓰기 때문에, AttributeFactory.getFactory(group) 이 이 group 은 ItemType 소유라는 걸 알아채서 (ModuleAttribute 가 아니라) ItemTypeAttribute 테이블에 등록해준다. "이 group 에 이미 등록된 Attribute 를 체크된 상태로 보여주는" 로직은 ModuleAdminController 와 동일해서 AttributeGroupAttributeSupport 로 공용화해서 같이 쓴다.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemTypeAdminController(org.springframework.context.MessageSource messageSource)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String name, boolean isDefault, Integer parentId, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
    새 Global ItemType 을 추가한다 (core 의 ItemTypeFactory.getFactory().add(name, isDefault, parentId) 사용 - parentId 는 화면 dropdown 에서 고른 ItemTypeEnum(ALL/EducationContents/...)
    attributeGroups(Integer typeId, String activeGroupName, HttpSession session, org.springframework.ui.Model model)
    선택한 ItemType 에 정의된 AttributeGroup 들을 AttributeGroupTypeEnum 기준으로 tab 화면에 보여준다. group 이 없으면(아직 정의되지 않은 AttributeGroupType) attributes 는 빈 목록.
    attributesForGroup(Integer typeId, String groupName, Integer activeTab, HttpSession session, org.springframework.ui.Model model)
    선택한 AttributeGroup(name 으로 식별)에 등록할 수 있는 Attribute 목록을 Attribute/UserAttribute 두 tab 으로 보여준다.
    initialize(Integer typeId, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
    선택한 ItemType 의 core ItemType#initialize() 를 실행한다.
    list(HttpSession session, org.springframework.ui.Model model)
    Global ItemType 목록.
    moveAttributes(Integer typeId, String groupName, String targetGroupName, List<Integer> selectedAttributeIds, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
    AttributeGroup 화면에서 선택한 Attribute 들을 다른 AttributeGroup 으로 이동시키거나 (targetGroupName 이 MOVE_TARGET_REMOVE 이면) 현재 Group 에서 제거한다.
    registerAttributes(Integer typeId, String groupName, List<Integer> selectedAttributeIds, Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
    화면에서 선택한 Attribute 들을 이 AttributeGroup 에 등록한다 (core 의 AttributeFactory.getFactory(group).add(attribute) 사용 - group 이 ItemType 소유이므로 ItemTypeAttribute 테이블에 등록된다).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ItemTypeAdminController

      public ItemTypeAdminController(org.springframework.context.MessageSource messageSource)
  • Method Details

    • list

      @Screen("AdminItemTypes") @GetMapping("/admin/item-types") public String list(HttpSession session, org.springframework.ui.Model model)
      Global ItemType 목록. Module 등록 여부와 무관하게 ItemTypeEnum(전체 상수) 기준으로, DB 에 row 가 있으면 그 값을, 없으면 removed=true placeholder 를 보여준다. (ModuleAdminController#itemTypes() 와 같은 패턴이지만 ModuleItemType 오버레이가 없다.)
    • add

      @Screen("AdminItemTypes") @PostMapping("/admin/item-types/add") public String add(@RequestParam("name") String name, @RequestParam(value="isDefault",required=false,defaultValue="false") boolean isDefault, @RequestParam(value="parentId",required=false) Integer parentId, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
      새 Global ItemType 을 추가한다 (core 의 ItemTypeFactory.getFactory().add(name, isDefault, parentId) 사용 - parentId 는 화면 dropdown 에서 고른 ItemTypeEnum(ALL/EducationContents/...) 의 id 를 그대로 전달한다).
    • initialize

      @Screen("AdminItemTypes") @PostMapping("/admin/item-types/{typeId}/initialize") public String initialize(@PathVariable("typeId") Integer typeId, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
      선택한 ItemType 의 core ItemType#initialize() 를 실행한다. (core 쪽에서 AttributeGroup, ItemTypeAttribute, ItemTypeOption 을 등록하도록 구현되어 있음 - 이 컨트롤러는 그 실행만 담당) DB 에 row 가 없는 placeholder ItemType(row.removed==true 로 표시됨) 은 화면에서 체크박스를 disable 처리해서 애초에 이 요청이 오지 않도록 막아둔다.
    • attributeGroups

      @Screen("AdminItemTypeAttributeGroups") @GetMapping("/admin/item-types/{typeId}/attribute-groups") public String attributeGroups(@PathVariable("typeId") Integer typeId, @RequestParam(value="groupName",required=false) String activeGroupName, HttpSession session, org.springframework.ui.Model model)
      선택한 ItemType 에 정의된 AttributeGroup 들을 AttributeGroupTypeEnum 기준으로 tab 화면에 보여준다. group 이 없으면(아직 정의되지 않은 AttributeGroupType) attributes 는 빈 목록.
    • moveAttributes

      @Screen("AdminItemTypeAttributeGroups") @PostMapping("/admin/item-types/{typeId}/attribute-groups/move") public String moveAttributes(@PathVariable("typeId") Integer typeId, @RequestParam(value="groupName",required=false) String groupName, @RequestParam(value="targetGroupName",required=false) String targetGroupName, @RequestParam(value="selectedAttributeIds",required=false) List<Integer> selectedAttributeIds, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
      AttributeGroup 화면에서 선택한 Attribute 들을 다른 AttributeGroup 으로 이동시키거나 (targetGroupName 이 MOVE_TARGET_REMOVE 이면) 현재 Group 에서 제거한다. ModuleAdminController#moveAttributes() 와 동일한 패턴이지만 Module/ModuleItemType 이 없으므로 itemType.getAttributeGroup(name) 을 그대로 사용한다.
    • attributesForGroup

      @Screen("AdminItemTypeAttributes") @GetMapping("/admin/item-types/{typeId}/attribute-groups/{groupName}/attributes") public String attributesForGroup(@PathVariable("typeId") Integer typeId, @PathVariable("groupName") String groupName, @RequestParam(value="tab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.ui.Model model)
      선택한 AttributeGroup(name 으로 식별)에 등록할 수 있는 Attribute 목록을 Attribute/UserAttribute 두 tab 으로 보여준다. (ModuleAdminController#attributesForGroup() 과 동일한 패턴.)
    • registerAttributes

      @Screen("AdminItemTypeAttributes") @PostMapping("/admin/item-types/{typeId}/attribute-groups/{groupName}/attributes") public String registerAttributes(@PathVariable("typeId") Integer typeId, @PathVariable("groupName") String groupName, @RequestParam(value="selectedAttributeIds",required=false) List<Integer> selectedAttributeIds, @RequestParam(value="activeTab",required=false,defaultValue="0") Integer activeTab, HttpSession session, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
      화면에서 선택한 Attribute 들을 이 AttributeGroup 에 등록한다 (core 의 AttributeFactory.getFactory(group).add(attribute) 사용 - group 이 ItemType 소유이므로 ItemTypeAttribute 테이블에 등록된다).