Class MITListItem

All Implemented Interfaces:
Cacheable, LocalizableOM, Serializable, Comparable<MITListItem>, ColumnAccessByName, ObjectModel, Persistent

public class MITListItem extends BaseMITListItem implements LocalizableOM, Comparable<MITListItem>, Cacheable

A module and an iteme type. Wildcards are possible, so that a single MITListItem could represent all the item types in a module. A single item type in all modules (that have it defined). Or all modules and item types.

Parent 를 갖고 있으면 Parent 는 하나만 설정하여야 한다.

all --> id = 0, 0 ( MULTIPLE_MODULE_KEY GroupEnum.ALL, MULTIPLE_ITEM_TYPE_KEYItemTypeEnum.ALL )

  • 모든 모듈, 모든 아이템유형 : M : 0 & T : 0
  • 현재 모듈, 모든 아이템 유형 : M : NULL & T : 0
  • 현재 모듈의 형식은 아주 특별한 경우에만 사용하여야 한다.

    모든 모듈, 아이템 유형 : M : 0 , T : 0

    현재 모듈, 아이템 유형 : M : NULL & T : T

    특정 모듈 모든 아이템 유형 : M : M & T : 0

    특정 모듈 아래에 모든 모듈, 모든 아이템 유형 : M : 0 & T : 0 & P : P

    특정 모듈 아래에 모든 모듈, 아이템 유형 : M : 0 & T : T & P : P

    Version:
    $Id: MITListItem.java,v 1.71 2008/12/25 04:03:45 youngho Exp $
    Author:
    Youngho Cho
    • Constructor Details

      • MITListItem

        public MITListItem()
    • Method Details

      • save

        public void save() throws Exception
        Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed.
        Specified by:
        save in interface Persistent
        Overrides:
        save in class BaseMITListItem
        Throws:
        Exception
      • setModule

        public void setModule(Module module) throws TorqueException
        DOCUMENT ME!
        Parameters:
        module - DOCUMENT ME!
        Throws:
        TorqueException - DOCUMENT ME!
      • getItemType

        public ItemType getItemType() throws TorqueException
        Description copied from class: BaseMITListItem
        Returns the associated ItemType object. If it was not retrieved before, the object is retrieved from the database
        Overrides:
        getItemType in class BaseMITListItem
        Returns:
        itemType or current itemType
        Throws:
        TorqueException - DOCUMENT ME!
      • getModule

        public Module getModule() throws TorqueException
        Returns:
        module or current module
        Throws:
        TorqueException - DOCUMENT ME!
      • setParent

        public void setParent(Module module) throws TorqueException
        DOCUMENT ME!
        Parameters:
        module - DOCUMENT ME!
        Throws:
        TorqueException - DOCUMENT ME!
      • getParent

        public Module getParent() throws TorqueException
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
        Throws:
        TorqueException - DOCUMENT ME!
      • hasParent

        public boolean hasParent()
        DOCUMENT ME!
        Returns:
        DOCUMENT ME!
      • compareTo

        public int compareTo(MITListItem otherItem)
        Comparable 구현, 이 MitListItem 이 표시하는 면적을 비교한다. (m x t) 처리 보다 큰 범위이면 1, 동일한 범위이면 0, 보다 작은 범위이면 -1 먼저 itemType 을 비교한다. 그 다음 Module 범위를 구한다. Substract 는 비교하지 않는다.
        Specified by:
        compareTo in interface Comparable<MITListItem>
        See Also:
      • isSingleModuleItemType

        public boolean isSingleModuleItemType()
        isSingleModuleItemType 을 확인한다. ( true 이면 대응하는 ModuleItemType 이 존재하여야 한다.)
        Returns:
        DOCUMENT ME!
      • isSingleModule

        public boolean isSingleModule()
        대상이 SingleModule 인지
        Returns:
      • isSingleItemType

        public boolean isSingleItemType()
        대상이 SingleItemType 인지
        Returns:
      • isUseCurrentModule

        public boolean isUseCurrentModule()
        where use CurrentModule
        Returns:
        true if moduleId is null
      • isUseCurrentItemType

        public boolean isUseCurrentItemType()
        where use CurrentItemType
        Returns:
        true if itemTypeId is null
      • isForAllItemTypes

        public boolean isForAllItemTypes()
        모든 ItemType 에 적용하는지 즉 ItemTypeId 가 ItemTypeEnum.ALL
      • isForAllModule

        public boolean isForAllModule()
        모든 Module 에 적용하는지 즉 ModuleId 가 GroupEnum.ALL
      • getModuleItemType

        public ModuleItemType getModuleItemType() throws TorqueException
        isSingleModuleItemType 일 경우 ModuleItemType 을 구한다. 그외는 null 을
        Returns:
        moduleItemType or null
        Throws:
        TorqueException
      • getModuleAttribute

        public ModuleAttribute getModuleAttribute(Attribute attribute) throws TorqueException
        isSingleModuleItemType 일 경우 ModuleAttribute 을 구한다.
        Parameters:
        attribute -
        Returns:
        ma or null
        Throws:
        TorqueException
      • hashCode

        public int hashCode()
        저장된 item 은 primary key 로, 저장되기 전에는 객체 자신으로 hashCode 를 구한다. (BaseMITListItem.equals(Object) 와 일치)

        BitMatrix 는 DB 조회와 TransactionContext 에 따라 달라지므로 hashCode 에 사용하지 않는다. Torque 의 기본 hashCode 는 primary key 가 없으면 호출할 때마다 값이 달라진다.

        Overrides:
        hashCode in class BaseMITListItem
        Returns:
        an int value
        See Also:
      • getModuleIds

        protected List<Long> getModuleIds() throws TorqueException
        Returns:
        moduleIds collection for all 이면 null 을 return 한다.
        Throws:
        TorqueException
      • getItemTypeIds

        protected List<Integer> getItemTypeIds() throws TorqueException
        Returns:
        ItemTypeIds collection
        Throws:
        TorqueException
      • getAttributeIds

        protected List<Integer> getAttributeIds() throws TorqueException
        주의 : CurrentModule, CurrentItemType 은 지원하지 않는다.
        Throws:
        TorqueException
      • getAttributeIds

        protected List<Integer> getAttributeIds(boolean activeOnly, boolean commonOnly) throws TorqueException
        Parameters:
        activeOnly -
        commonOnly -
        Returns:
        attribute list
        Throws:
        TorqueException
      • toKeyString

        public String toKeyString()
        P\dI\d+, M\d+I\d+ 의 Pattern 으로 문자열을 만든다. null 이면 Pnull, Mnull 등과 같이 표현한다. 검색범위 문자열 TODO : expression language
      • getModuleMatrixSize

        public static int getModuleMatrixSize() throws TorqueException
        BitMatrix 의 Module 크기 (x, width) : 현재 Module 의 최대 id + 1
        Returns:
        module size
        Throws:
        TorqueException - 조회 오류
      • getItemTypeMatrixSize

        public static int getItemTypeMatrixSize() throws TorqueException
        BitMatrix 의 ItemType 크기 (y, height) : 현재 ItemType 의 최대 id + 1
        Returns:
        itemType size
        Throws:
        TorqueException - 조회 오류
      • getBitMatrix

        public BitMatrix getBitMatrix()
        이 item 이 처리하는 BitMatrix 를 구한다. 크기는 현재 DB 의 Module / ItemType 최대 id 로 정한다.

        여러 item 의 BitMatrix 를 함께 연산할 때는 크기가 같아야 하므로 getBitMatrix(int, int) 를 사용한다.

        Returns:
        이 item 이 처리하는 BitMatrix (x : Module id, y : ItemType id)
      • getBitMatrix

        public BitMatrix getBitMatrix(int moduleSize, int itemTypeSize) throws TorqueException
        주어진 크기로 이 item 이 처리하는 BitMatrix 를 구한다.
        • 모든 ItemType (ItemTypeEnum.ALL) : 모든 ItemType
        • 모든 Module (GroupEnum.ALL) : Parent 가 없으면 모든 Module, Parent 가 있으면 Parent 아래의 모든 Module (자손)
        • Parent 가 있고 모든 Module 이 아니면 Parent 의 자식 Module
        • Module / ItemType 이 null 이면 현재 (TransactionContext) Module / ItemType
        Parameters:
        moduleSize - Module 크기 (x, width), getModuleMatrixSize()
        itemTypeSize - ItemType 크기 (y, height), getItemTypeMatrixSize()
        Returns:
        이 item 이 처리하는 BitMatrix (x : Module id, y : ItemType id)
        Throws:
        TorqueException - 조회 오류
        IllegalArgumentException - id 가 크기를 벗어나는 경우
        IllegalStateException - 현재 Module / ItemType 을 구할 수 없는 경우
      • toExpression

        public String toExpression()
        human readerble expression

        모든 모듈, 아이템 유형 : P M 0 T 0 P

        현재 모듈, 아이템 유형 : P M T : T P

        특정 모듈 모든 아이템 유형 : P M M T 0 P

        특정 모듈 아래에 모든 모듈, 모든 아이템 유형 : P P M 0 T 0

        특정 모듈 아래에 모든 모듈, 아이템 유형 : P P M 0 T T

        Returns:
        string representation
      • toString

        public String toString()
        toString()
        Overrides:
        toString in class BaseMITListItem
        Returns:
        string representation
      • getLocalized

        public Localized[] getLocalized(Locale locale) throws TorqueException
        Description copied from interface: LocalizableOM
        locale 에 해당하는 localized 정보를 구한다.
        Specified by:
        getLocalized in interface LocalizableOM
        Parameters:
        locale -
        Returns:
        localized
        Throws:
        TorqueException - 조회 중 오류가 발생한 경우
      • getMethodCache

        public MethodResultCache getMethodCache()
        Description copied from interface: Cacheable
        Returns the method result cache for this object.
        Specified by:
        getMethodCache in interface Cacheable
        Returns:
        MethodResultCache
      • clear

        public void clear()
        Description copied from interface: Cacheable
        clear this Serializable instance cache
        Specified by:
        clear in interface Cacheable