Class TreeServiceImpl

    • Constructor Summary

      Constructors 
      Constructor Description
      TreeServiceImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends TreeSearchEntity>
      T
      addNode​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      int
      alterNode​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      int
      alterNodeType​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      void
      calculatePosition​(T treeSearchEntity, T nodeById, java.util.List<T> childNodesFromNodeByRef, javax.servlet.http.HttpServletRequest request, java.lang.String tableName)  
      <T extends TreeSearchEntity>
      void
      cutMyself​(T nodeById, long spaceOfTargetNode, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById)  
      <T extends TreeSearchEntity>
      void
      enterMyselfFixLeftRight​(long idif, long ldif, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, T treeSearchEntity)  
      <T extends TreeSearchEntity>
      void
      enterMyselfFromTree​(long ref, long c_position, long c_id, long idif, long ldif, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, T treeSearchEntity)  
      <T extends TreeSearchEntity>
      void
      fixPositionParentIdOfCopyNodes​(long insertSeqResult, long position, T treeSearchEntity)  
      <T extends TreeSearchEntity>
      java.util.List<T>
      getChildNode​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      java.util.List<T>
      getChildNodeWithoutPaging​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      T
      getNode​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      java.util.List<T>
      getNodesWithoutRoot​(T treeSearchEntity)  
      <T extends TreeSearchEntity,​K,​V>
      java.util.Map<K,​V>
      getNodesWithoutRootMap​(T treeSearchEntity, java.util.function.Function<T,​K> key, java.util.function.Function<T,​V> value)  
      <T extends TreeSearchEntity>
      java.util.List<T>
      getPaginatedChildNode​(T treeSearchEntity)
      TreeSearchEntity로부터 페이지된 자식 노드 목록을 검색합니다.
      <T extends TreeSearchEntity>
      T
      moveNode​(T treeSearchEntity, javax.servlet.http.HttpServletRequest request)
      트리 구조 내에서 노드를 이동합니다.
      <T extends TreeSearchEntity>
      T
      newInstance​(T treeSearchEntity)
      파라미터로 넘겨진 인스턴스의 정보를 이용해 리플렉션하여 새로운 인스턴스를 만들어 반환한다.
      <T extends TreeSearchEntity>
      int
      overwriteNode​(T toEntity, T fromEntity)
      이 메서드는 한 노드의 속성을 다른 노드의 속성으로 덮어씁니다.
      <T extends TreeSearchEntity>
      long
      pasteMyselfFromTree​(long ref, long idif, long spaceOfTargetNode, long ldif, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, long rightPositionFromNodeByRef, T nodeById)  
      <T extends TreeSearchEntity>
      int
      removeNode​(T treeSearchEntity)
      This function removes a node from the tree structure.
      <T extends TreeSearchEntity>
      java.util.List<T>
      saveOrUpdateList​(java.util.List<T> entities)  
      <T extends TreeSearchEntity>
      java.util.List<java.lang.String>
      searchNode​(T treeSearchEntity)  
      <T extends TreeSearchEntity>
      void
      stretchLeft​(long spaceOfTargetNode, long rightPositionFromNodeByRef, long copy, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, org.hibernate.criterion.DetachedCriteria detachedCriteria)
      이 메서드는 트리 노드의 왼쪽 값을 주어진 양만큼 확장합니다.
      <T extends TreeSearchEntity>
      void
      stretchLeftRightForMyselfFromTree​(long spaceOfTargetNode, long rightPositionFromNodeByRef, long copy, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, T treeSearchEntity)
      이 메서드는 주어진 매개변수를 기반으로 트리 노드의 왼쪽과 오른쪽 값을 확장합니다.
      <T extends TreeSearchEntity>
      void
      stretchPositionForMyselfFromTree​(java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, T treeSearchEntity)  
      <T extends TreeSearchEntity>
      void
      stretchRight​(long spaceOfTargetNode, long rightPositionFromNodeByRef, long copy, java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById, org.hibernate.criterion.DetachedCriteria detachedCriteria)
      이 메서드는 주어진 매개변수를 기반으로 트리 노드의 오른쪽 값을 확장합니다.
      <T extends TreeSearchEntity>
      int
      updateField​(T treeSearchEntity, java.lang.String field)  
      <T extends TreeSearchEntity>
      int
      updateNode​(T treeSearchEntity)  
      • Methods inherited from class java.lang.Object

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

      • TreeServiceImpl

        public TreeServiceImpl()
    • Method Detail

      • getNode

        @Transactional(readOnly=true)
        public <T extends TreeSearchEntity> T getNode​(T treeSearchEntity)
                                               throws java.lang.Exception
        Specified by:
        getNode in interface TreeService
        Throws:
        java.lang.Exception
      • getChildNodeWithoutPaging

        @Transactional(readOnly=true)
        public <T extends TreeSearchEntity> java.util.List<T> getChildNodeWithoutPaging​(T treeSearchEntity)
                                                                                 throws java.lang.Exception
        Specified by:
        getChildNodeWithoutPaging in interface TreeService
        Throws:
        java.lang.Exception
      • getChildNode

        @Transactional(readOnly=true)
        public <T extends TreeSearchEntity> java.util.List<T> getChildNode​(T treeSearchEntity)
                                                                    throws java.lang.Exception
        Specified by:
        getChildNode in interface TreeService
        Throws:
        java.lang.Exception
      • getPaginatedChildNode

        @Transactional(readOnly=true)
        public <T extends TreeSearchEntity> java.util.List<T> getPaginatedChildNode​(T treeSearchEntity)
                                                                             throws java.lang.Exception
        TreeSearchEntity로부터 페이지된 자식 노드 목록을 검색합니다.
        Specified by:
        getPaginatedChildNode in interface TreeService
        Type Parameters:
        T - TreeSearchEntity의 타입. TreeSearchEntity를 확장해야 합니다.
        Parameters:
        treeSearchEntity - 자식 노드 목록을 검색할 때 사용되는 TreeSearchEntity 객체.
        Returns:
        TreeSearchEntity로부터 검색된 자식 노드 목록.
        Throws:
        java.lang.Exception - 검색 과정 중에 오류가 발생할 경우.
      • getNodesWithoutRoot

        @Transactional(readOnly=true)
        public <T extends TreeSearchEntity> java.util.List<T> getNodesWithoutRoot​(T treeSearchEntity)
                                                                           throws java.lang.Exception
        Specified by:
        getNodesWithoutRoot in interface TreeService
        Throws:
        java.lang.Exception
      • getNodesWithoutRootMap

        @Transactional(readOnly=true)
        public <T extends TreeSearchEntity,​K,​V> java.util.Map<K,​V> getNodesWithoutRootMap​(T treeSearchEntity,
                                                                                                            java.util.function.Function<T,​K> key,
                                                                                                            java.util.function.Function<T,​V> value)
                                                                                                     throws java.lang.Exception
        Specified by:
        getNodesWithoutRootMap in interface TreeService
        Throws:
        java.lang.Exception
      • searchNode

        public <T extends TreeSearchEntity> java.util.List<java.lang.String> searchNode​(T treeSearchEntity)
                                                                                 throws java.lang.Exception
        Specified by:
        searchNode in interface TreeService
        Throws:
        java.lang.Exception
      • addNode

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> T addNode​(T treeSearchEntity)
                                               throws java.lang.Exception
        Specified by:
        addNode in interface TreeService
        Throws:
        java.lang.Exception
      • overwriteNode

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> int overwriteNode​(T toEntity,
                                                              T fromEntity)
                                                       throws java.lang.Exception
        이 메서드는 한 노드의 속성을 다른 노드의 속성으로 덮어씁니다.
        Specified by:
        overwriteNode in interface TreeService
        Parameters:
        toEntity - 속성을 덮어쓸 대상 노드
        fromEntity - 속성을 가져올 노드
        Returns:
        1: 성공, 그 외: 예외 발생
        Throws:
        java.lang.Exception - 데이터베이스 작업 중에 오류 발생
      • stretchLeftRightForMyselfFromTree

        public <T extends TreeSearchEntity> void stretchLeftRightForMyselfFromTree​(long spaceOfTargetNode,
                                                                                   long rightPositionFromNodeByRef,
                                                                                   long copy,
                                                                                   java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                                                   T treeSearchEntity)
                                                                            throws java.lang.Exception
        이 메서드는 주어진 매개변수를 기반으로 트리 노드의 왼쪽과 오른쪽 값을 확장합니다. 노드가 추가, 이동, 또는 제거될 때 트리 구조에서 공간을 조정하는 데 사용됩니다.
        Parameters:
        spaceOfTargetNode - 확장할 공간의 양
        rightPositionFromNodeByRef - 확장이 시작할 노드의 오른쪽 위치
        copy - 복사 작업 여부를 나타내는 플래그 (0: 복사, 1: 복사 아님)
        c_idsByChildNodeFromNodeById - 확장에서 제외할 자식 노드 ID의 컬렉션
        treeSearchEntity - TreeSearchEntity 클래스의 인스턴스로, 트리 노드를 나타냄
        Throws:
        java.lang.Exception - 확장 프로세스 중에 오류가 발생할 경우
      • stretchRight

        public <T extends TreeSearchEntity> void stretchRight​(long spaceOfTargetNode,
                                                              long rightPositionFromNodeByRef,
                                                              long copy,
                                                              java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                              org.hibernate.criterion.DetachedCriteria detachedCriteria)
        이 메서드는 주어진 매개변수를 기반으로 트리 노드의 오른쪽 값을 확장합니다. 노드가 추가, 이동, 또는 제거될 때 트리 구조에서 공간을 조정하는 데 사용됩니다.
        Parameters:
        spaceOfTargetNode - 확장할 공간의 양
        rightPositionFromNodeByRef - 확장이 시작할 노드의 오른쪽 위치
        copy - 복사 작업 여부를 나타내는 플래그 (0: 복사, 1: 복사 아님)
        c_idsByChildNodeFromNodeById - 확장에서 제외할 자식 노드 ID의 컬렉션
        detachedCriteria - 확장할 대상 노드를 검색하기 위해 사용되는 DetachedCriteria 객체
      • stretchLeft

        public <T extends TreeSearchEntity> void stretchLeft​(long spaceOfTargetNode,
                                                             long rightPositionFromNodeByRef,
                                                             long copy,
                                                             java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                             org.hibernate.criterion.DetachedCriteria detachedCriteria)
        이 메서드는 트리 노드의 왼쪽 값을 주어진 양만큼 확장합니다. 트리 구조에서 노드가 추가, 이동, 또는 제거될 때 공간을 조정하는 데 사용됩니다.
        Parameters:
        spaceOfTargetNode - 확장할 공간의 양
        rightPositionFromNodeByRef - 확장이 시작할 노드의 오른쪽 위치
        copy - 복사 작업 여부를 나타내는 플래그 (0: 복사, 1: 복사 아님)
        c_idsByChildNodeFromNodeById - 확장에서 제외할 자식 노드 ID의 컬렉션
        detachedCriteria - 확장할 대상 노드를 검색하기 위해 사용되는 DetachedCriteria 객체
      • newInstance

        public <T extends TreeSearchEntity> T newInstance​(T treeSearchEntity)
                                                   throws java.lang.Exception
        파라미터로 넘겨진 인스턴스의 정보를 이용해 리플렉션하여 새로운 인스턴스를 만들어 반환한다. 리플렉션을 위한 타입 정보를 제공하기 위한 인스턴스
        Parameters:
        treeSearchEntity -
        Returns:
        T extends TreeSearchEntity
        Throws:
        java.lang.ClassNotFoundException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.lang.Exception
      • removeNode

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> int removeNode​(T treeSearchEntity)
                                                    throws java.lang.Exception
        This function removes a node from the tree structure.
        Specified by:
        removeNode in interface TreeService
        Parameters:
        treeSearchEntity - The node to be removed.
        Returns:
        0 if the node is successfully removed, otherwise an exception is thrown.
        Throws:
        java.lang.Exception - If an error occurs during the removal process.
      • updateNode

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> int updateNode​(T treeSearchEntity)
                                                    throws java.lang.Exception
        Specified by:
        updateNode in interface TreeService
        Throws:
        java.lang.Exception
      • updateField

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> int updateField​(T treeSearchEntity,
                                                            java.lang.String field)
                                                     throws java.lang.Exception
        Specified by:
        updateField in interface TreeService
        Throws:
        java.lang.Exception
      • saveOrUpdateList

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> java.util.List<T> saveOrUpdateList​(java.util.List<T> entities)
                                                                        throws java.lang.Exception
        Throws:
        java.lang.Exception
      • alterNode

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> int alterNode​(T treeSearchEntity)
                                                   throws java.lang.Exception
        Specified by:
        alterNode in interface TreeService
        Throws:
        java.lang.Exception
      • alterNodeType

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> int alterNodeType​(T treeSearchEntity)
                                                       throws java.lang.Exception
        Specified by:
        alterNodeType in interface TreeService
        Throws:
        java.lang.Exception
      • moveNode

        @Transactional(rollbackFor=java.lang.Exception.class,
                       isolation=SERIALIZABLE,
                       propagation=REQUIRED)
        public <T extends TreeSearchEntity> T moveNode​(T treeSearchEntity,
                                                       javax.servlet.http.HttpServletRequest request)
                                                throws java.lang.Exception
        트리 구조 내에서 노드를 이동합니다.
        Specified by:
        moveNode in interface TreeService
        Parameters:
        treeSearchEntity - 이동할 노드
        request - HTTP 요청 객체
        Returns:
        이동된 노드
        Throws:
        java.lang.Exception - 이동 중에 오류가 발생할 경우
      • enterMyselfFromTree

        public <T extends TreeSearchEntity> void enterMyselfFromTree​(long ref,
                                                                     long c_position,
                                                                     long c_id,
                                                                     long idif,
                                                                     long ldif,
                                                                     java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                                     T treeSearchEntity)
                                                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • enterMyselfFixLeftRight

        public <T extends TreeSearchEntity> void enterMyselfFixLeftRight​(long idif,
                                                                         long ldif,
                                                                         java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                                         T treeSearchEntity)
      • fixPositionParentIdOfCopyNodes

        public <T extends TreeSearchEntity> void fixPositionParentIdOfCopyNodes​(long insertSeqResult,
                                                                                long position,
                                                                                T treeSearchEntity)
                                                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • pasteMyselfFromTree

        public <T extends TreeSearchEntity> long pasteMyselfFromTree​(long ref,
                                                                     long idif,
                                                                     long spaceOfTargetNode,
                                                                     long ldif,
                                                                     java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                                     long rightPositionFromNodeByRef,
                                                                     T nodeById)
                                                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • stretchPositionForMyselfFromTree

        public <T extends TreeSearchEntity> void stretchPositionForMyselfFromTree​(java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById,
                                                                                  T treeSearchEntity)
                                                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • calculatePosition

        public <T extends TreeSearchEntity> void calculatePosition​(T treeSearchEntity,
                                                                   T nodeById,
                                                                   java.util.List<T> childNodesFromNodeByRef,
                                                                   javax.servlet.http.HttpServletRequest request,
                                                                   java.lang.String tableName)
                                                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • cutMyself

        public <T extends TreeSearchEntity> void cutMyself​(T nodeById,
                                                           long spaceOfTargetNode,
                                                           java.util.Collection<java.lang.Long> c_idsByChildNodeFromNodeById)
                                                    throws java.lang.Exception
        Throws:
        java.lang.Exception