code: public void moveCategory(CmsObject cms, String oldCatPath, String newCatPath, String referencePath)
      throws CmsException {
  
          CmsCategory category = readCategory(cms, oldCatPath, referencePath);
          String catPath = cms.getRequestContext().removeSiteRoot(category.getRootPath());
          CmsLock lock = cms.getLock(catPath);
          if (lock.isNullLock()) {
              cms.lockResource(catPath);
          } else if (lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
              cms.changeLock(catPath);
          }
          cms.moveResource(
              catPath,
              cms.getRequestContext().removeSiteRoot(internalCategoryRootPath(category.getBasePath(), newCatPath)));
      }
docs: Renames/Moves a category from the old path to the new one.<p>
  
  This method will keep all categories in their original repository.<p>
  
  @param cms the current cms context
  @param oldCatPath the path of the category to move
  @param newCatPath the new category path
  @param referencePath the reference path to find the category
  
  @throws CmsException if something goes wrong