code: @SuppressWarnings("unused")
      private List<CmsResource> getLinkSources(CmsObject cms, CmsResource resource, HashSet<CmsUUID> deleteIds)
      throws CmsException {
  
          List<CmsRelation> relations = cms.getRelationsForResource(resource, CmsRelationFilter.SOURCES);
          List<CmsResource> result = new ArrayList<CmsResource>();
          for (CmsRelation relation : relations) {
              // only add related resources that are not going to be deleted
              if (!deleteIds.contains(relation.getSourceId())) {
                  CmsResource source = relation.getSource(cms, CmsResourceFilter.ALL);
                  if (!source.getState().isDeleted()) {
                      result.add(source);
                  }
              }
          }
          return result;
      }
docs: Gets the resources which link to a given structure id.<p>
  
  @param cms the current CMS context
  @param resource the relation target resource
  @param deleteIds set of resources to delete
  
  @return the list of resources which link to the given id
  
  @throws CmsException if something goes wrong