protected void buildCheckNodes(
     ITreeNode treeNode, Set<String> checkNodes, Collection<String> groupCodes) {
   checkNodes.add(treeNode.getCode());
   ITreeNode parent = treeNode.getParent();
   if (parent != null
       && parent.getParent() != null
       && !parent.getCode().equals(treeNode.getCode())) {
     this.buildCheckNodes(parent, checkNodes, groupCodes);
   }
 }
 @Override
 public Set<String> checkTargetNodesOnClosing(
     String nodeToCloseCode, Set<String> lastOpenedNodes, Collection<String> groupCodes)
     throws ApsSystemException {
   ITreeNode nodeToClose = this.getTreeNode(nodeToCloseCode);
   if (null == nodeToCloseCode || null == nodeToClose) {
     return this.checkTargetNodes(null, lastOpenedNodes, groupCodes);
   }
   Set<String> checkedTargetNodes = new HashSet<String>();
   try {
     if (nodeToClose.isRoot()) {
       return checkedTargetNodes;
     }
     if (null != lastOpenedNodes) {
       Iterator<String> iter = lastOpenedNodes.iterator();
       while (iter.hasNext()) {
         String code = (String) iter.next();
         if (null != code
             && this.checkNode(code, groupCodes)
             && !code.equals(nodeToCloseCode)
             && !this.getTreeNode(code).isChildOf(nodeToCloseCode)) {
           checkedTargetNodes.add(code);
         }
       }
     }
     if (null != nodeToClose
         && null != nodeToClose.getParent()
         && this.checkNode(nodeToClose.getParent().getCode(), groupCodes)) {
       checkedTargetNodes.add(nodeToClose.getParent().getCode());
     }
   } catch (Throwable t) {
     ApsSystemUtils.logThrowable(t, this, "checkTargetNodesOnClosing");
     throw new ApsSystemException("Error check target nodes on closing tree", t);
   }
   return checkedTargetNodes;
 }