code: public String updateContextAndGetFavoriteUrl(CmsObject cms) throws CmsException {
  
          CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION;
          CmsProject project = null;
          switch (getType()) {
              case explorerFolder:
                  CmsResource folder = cms.readResource(getStructureId(), filter);
                  project = cms.readProject(getProjectId());
                  cms.getRequestContext().setSiteRoot(getSiteRoot());
                  cms.getRequestContext().setCurrentProject(project);
                  String explorerLink = CmsVaadinUtils.getWorkplaceLink()
                      + "#!"
                      + CmsFileExplorerConfiguration.APP_ID
                      + "/"
                      + getProjectId()
                      + "!!"
                      + getSiteRoot()
                      + "!!"
                      + cms.getSitePath(folder);
                  return explorerLink;
              case page:
                  project = cms.readProject(getProjectId());
                  CmsResource target = cms.readResource(getStructureId(), filter);
                  CmsResource detailContent = null;
                  String link = null;
                  cms.getRequestContext().setCurrentProject(project);
                  cms.getRequestContext().setSiteRoot(getSiteRoot());
                  if (getDetailId() != null) {
                      detailContent = cms.readResource(getDetailId());
                      link = OpenCms.getLinkManager().substituteLinkForUnknownTarget(
                          cms,
                          cms.getSitePath(detailContent),
                          cms.getSitePath(target),
                          false);
                  } else {
                      link = OpenCms.getLinkManager().substituteLink(cms, target);
                  }
                  return link;
              default:
                  return null;
          }
      }
docs: Prepares the CmsObject for jumping to this favorite location, and returns the appropriate URL.
  
  @param cms the CmsObject to initialize for jumping to the favorite
  @return the link for the favorite location
  
  @throws CmsException if something goes wrong