code: @SuppressWarnings({"javadoc", "deprecation"})
      public void chtype(CmsDbContext dbc, CmsResource resource, int type) throws CmsException {
  
          // must operate on a clone to ensure resource is not modified in case permissions are not granted
          CmsResource clone = (CmsResource)resource.clone();
          I_CmsResourceType newType = OpenCms.getResourceManager().getResourceType(type);
          clone.setType(newType.getTypeId());
          // log it
          log(
              dbc,
              new CmsLogEntry(
                  dbc,
                  resource.getStructureId(),
                  CmsLogEntryType.RESOURCE_TYPE,
                  new String[] {resource.getRootPath()}),
              false);
          // write it
          writeResource(dbc, clone);
      }
docs: Changes the resource type of a resource.<p>
  
  OpenCms handles resources according to the resource type,
  not the file suffix. This is e.g. why a JSP in OpenCms can have the
  suffix ".html" instead of ".jsp" only. Changing the resource type
  makes sense e.g. if you want to make a plain text file a JSP resource,
  or a binary file an image, etc.<p>
  
  @param dbc the current database context
  @param resource the resource to change the type for
  @param type the new resource type for this resource
  
  @throws CmsException if something goes wrong
  
  @see CmsObject#chtype(String, int)
  @see I_CmsResourceType#chtype(CmsObject, CmsSecurityManager, CmsResource, int)