code: public static String resourceOriginalPath(CmsObject cms, String resourceName) {
  
          CmsProject proj = cms.getRequestContext().getCurrentProject();
          try {
              CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL);
              String result = cms.getSitePath(resource);
              cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
              result = cms.getSitePath(cms.readResource(resource.getStructureId()));
              // remove '/' if needed
              if (result.charAt(result.length() - 1) == '/') {
                  if (resourceName.charAt(resourceName.length() - 1) != '/') {
                      result = result.substring(0, result.length() - 1);
                  }
              }
              return result;
          } catch (CmsException e) {
              return null;
          } finally {
              cms.getRequestContext().setCurrentProject(proj);
          }
      }
docs: Returns the original path of given resource, that is the online path for the resource.
  If it differs from the offline path, the resource has been moved.<p>
  
  @param cms the cms context
  @param resourceName a site relative resource name
  
  @return the online path, or <code>null</code> if resource has not been published