code: protected void updateRelationForUndo(CmsObject cms, CmsSecurityManager securityManager, CmsResource resource)
      throws CmsException {
  
          // type may have changed from non link parseable to link parseable
          CmsResource undoneResource1 = null;
          try {
              // first try to locate the resource by path
              undoneResource1 = createRelations(cms, securityManager, resource.getRootPath());
          } catch (CmsVfsResourceNotFoundException e) {
              // ignore, undone move operation
          }
          // now, in case a move operation has been undone, locate the resource by id
          CmsResource undoneResource2 = securityManager.readResource(
              cms.getRequestContext(),
              resource.getStructureId(),
              CmsResourceFilter.ALL);
          if (!undoneResource2.equals(undoneResource1)) {
              I_CmsResourceType resourceType = getResourceType(resource);
              List<CmsLink> links = null;
              if (resourceType instanceof I_CmsLinkParseable) {
                  I_CmsLinkParseable linkParseable = (I_CmsLinkParseable)resourceType;
                  if ((undoneResource1 == null) || !undoneResource2.getRootPath().equals(undoneResource1.getRootPath())) {
                      try {
                          links = linkParseable.parseLinks(cms, cms.readFile(undoneResource2));
                      } catch (CmsException e) {
                          if (LOG.isWarnEnabled()) {
                              LOG.warn(e);
                          }
                      } catch (CmsRuntimeException e) {
                          if (LOG.isWarnEnabled()) {
                              LOG.warn(e);
                          }
                      }
                  }
              }
              securityManager.updateRelationsForResource(cms.getRequestContext(), undoneResource2, links);
          }
      }
docs: Update the relations after an undo changes operation.<p>
  
  @param cms the cms context
  @param securityManager the security manager
  @param resource the resource that has been undone
  
  @throws CmsException if something goes wrong