/**
  * Description of the Method
  *
  * @param context Description of the Parameter
  * @return Description of the Return Value
  */
 public String executeCommandMove(ActionContext context) {
   // Parameters
   String itemId = (String) context.getRequest().getParameter("id");
   Connection db = null;
   try {
     db = getConnection(context);
     // Load the ticket and the organization
     Ticket thisTicket = addTicket(context, db);
     int ticketId = thisTicket.getId();
     // Check access permission to organization record
     if (!isRecordAccessPermitted(context, db, thisTicket.getOrgId())) {
       return ("PermissionError");
     }
     // Load the folder
     FileFolder thisFolder = new FileFolder(db, Integer.parseInt(itemId));
     context.getRequest().setAttribute("FileFolder", thisFolder);
     // Load the current folders
     FileFolderHierarchy hierarchy = new FileFolderHierarchy();
     hierarchy.setLinkModuleId(Constants.DOCUMENTS_TICKETS);
     hierarchy.setLinkItemId(ticketId);
     hierarchy.build(db);
     context.getRequest().setAttribute("folderHierarchy", hierarchy);
     return "MoveOK";
   } catch (Exception e) {
     context.getRequest().setAttribute("Error", e);
     return ("SystemError");
   } finally {
     this.freeConnection(context, db);
   }
 }
 /**
  * Description of the Method
  *
  * @param context Description of the Parameter
  * @return Description of the Return Value
  */
 public String executeCommandSaveMove(ActionContext context) {
   // Parameters
   String newFolderId = (String) context.getRequest().getParameter("folderId");
   String itemId = (String) context.getRequest().getParameter("id");
   Connection db = null;
   try {
     db = getConnection(context);
     // Load the ticket and the organization
     Ticket thisTicket = addTicket(context, db);
     int ticketId = thisTicket.getId();
     // Check access permission to organization record
     if (!isRecordAccessPermitted(context, db, thisTicket.getOrgId())) {
       return ("PermissionError");
     }
     // Load the current folder
     FileFolder thisFolder = new FileFolder(db, Integer.parseInt(itemId));
     int folderId = Integer.parseInt(newFolderId);
     if (folderId != 0 && folderId != -1) {
       FileFolder newParent = new FileFolder(db, folderId);
       FileFolderHierarchy thisHierarchy = new FileFolderHierarchy();
       thisHierarchy.setLinkModuleId(Constants.DOCUMENTS_TICKETS);
       thisHierarchy.setLinkItemId(ticketId);
       thisHierarchy.build(db, thisFolder.getId());
       if (thisHierarchy.getHierarchy().hasFolder(Integer.parseInt(newFolderId))) {
         thisFolder.buildSubFolders(db);
         Iterator iterator = (Iterator) thisFolder.getSubFolders().iterator();
         while (iterator.hasNext()) {
           FileFolder childFolder = (FileFolder) iterator.next();
           childFolder.updateParentId(db, thisFolder.getParentId());
         }
       }
     }
     thisFolder.updateParentId(db, folderId);
     return "PopupCloseOK";
   } catch (Exception e) {
     context.getRequest().setAttribute("Error", e);
     return ("SystemError");
   } finally {
     this.freeConnection(context, db);
   }
 }