code: public static CmsResource readResource(CmsObject cms, CmsHistoryResourceBean bean) throws CmsException {
  
          CmsHistoryVersion versionBean = bean.getVersion();
          if (versionBean.getVersionNumber() != null) {
              return (CmsResource)(cms.readResource(bean.getStructureId(), versionBean.getVersionNumber().intValue()));
          } else {
              if (versionBean.isOnline()) {
                  CmsObject onlineCms = OpenCms.initCmsObject(cms);
                  onlineCms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
                  return onlineCms.readResource(bean.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
              } else {
                  return cms.readResource(bean.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION);
              }
          }
      }
docs: Reads a historical resource for a history resource bean.<p>
  
  @param cms the CMS context
  @param bean the history resource bean
  @return the historical resource
  
  @throws CmsException if something goes wrong