code: protected void rewriteLinks(CmsResource resource, Collection<CmsRelation> relations) throws CmsException {
  
          LOG.info("Rewriting relations for resource " + resource.getRootPath());
          I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId());
          boolean hasContentLinks = false;
          boolean hasOtherLinks = false;
  
          for (CmsRelation relation : relations) {
              if (relation.getType().isDefinedInContent()) {
                  hasContentLinks = true;
              } else {
                  hasOtherLinks = true;
              }
          }
          if (hasContentLinks) {
              LOG.info("The resource " + resource.getRootPath() + " has links in the content.");
          }
          if (hasOtherLinks) {
              LOG.info("The resource " + resource.getRootPath() + " has non-content links.");
          }
  
          if (hasContentLinks) {
              if (resourceType instanceof I_CmsLinkParseable) {
                  CmsFile file = m_cms.readFile(resource);
                  rewriteContent(file, relations);
                  m_rewrittenContent.add(file.getStructureId());
              }
          }
          if (hasOtherLinks) {
              rewriteOtherRelations(resource, relations);
          }
      }
docs: Rewrites the links for a single resource.<p>
  
  @param resource the resource for which the links should be rewritten
  @param relations the relations to the source folder which have this resource as its source
  
  @throws CmsException if something goes wrong