code: private void deleteResourceFromProject(CmsObject cms, CmsResource res) throws CmsException {
  
          CmsLock lock = cms.getLock(res);
          if (lock.isUnlocked() || lock.isLockableBy(cms.getRequestContext().getCurrentUser())) {
              cms.lockResourceTemporary(res);
          } else {
              cms.changeLock(res);
          }
          cms.deleteResource(cms.getSitePath(res), CmsResource.DELETE_PRESERVE_SIBLINGS);
      }
docs: Deletes the given resource which is part of  a form session project.<p>
  
  @param cms the CMS context to use
  @param res the resource to delete
  
  @throws CmsException if something goes wrong