docs: public static Multimap<CmsResource, CmsResource> getBrokenLinks(
          CmsObject cms,
          List<CmsResource> selectedResources,
          boolean includeSiblings,
          boolean reverse)
      throws CmsException {
  
          Set<CmsResource> descendants = new HashSet<CmsResource>();
          for (CmsResource root : selectedResources) {
              descendants.add(root);
              if (root.isFolder()) {
                  descendants.addAll(cms.readResources(cms.getSitePath(root), CmsResourceFilter.IGNORE_EXPIRATION));
              }
          }
  
          if (includeSiblings) {
              // add siblings
              for (CmsResource res : new HashSet<CmsResource>(descendants)) {
                  if (res.isFile()) {
                      descendants.addAll(cms.readSiblings(res, CmsResourceFilter.IGNORE_EXPIRATION));
                  }
              }
          }
          HashSet<CmsUUID> deleteIds = new HashSet<CmsUUID>();
          for (CmsResource deleteRes : descendants) {
              deleteIds.add(deleteRes.getStructureId());
          }
          Multimap<CmsResource, CmsResource> linkMap = HashMultimap.create();
          for (CmsResource resource : descendants) {
              List<CmsRelation> relations = cms.getRelationsForResource(resource, CmsRelationFilter.SOURCES);
              List<CmsResource> result1 = new ArrayList<CmsResource>();
              for (CmsRelation relation : relations) {
                  // only add related resources that are not going to be deleted
                  if (!deleteIds.contains(relation.getSourceId())) {
                      CmsResource source1 = relation.getSource(cms, CmsResourceFilter.ALL);
                      if (!source1.getState().isDeleted()) {
                          result1.add(source1);
                      }
                  }
              }
              List<CmsResource> linkSources = result1;
              for (CmsResource source : linkSources) {
                  if (reverse) {
                      linkMap.put(resource, source);
                  } else {
                      linkMap.put(source, resource);
                  }
              }
          }
          return linkMap;
  
      }