code: public static Set<String> getNamesOfGroupsContainingResource(
          CmsObject cms,
          CmsResource inheritanceConfig,
          CmsResource target) throws CmsException {
  
          Set<String> names = new HashSet<String>();
          CmsContainerConfigurationParser parser = new CmsContainerConfigurationParser(cms);
          parser.parse(inheritanceConfig);
          Map<Locale, Map<String, CmsContainerConfiguration>> contents = parser.getParsedResults();
          for (Map<String, CmsContainerConfiguration> mapForLocale : contents.values()) {
              for (Map.Entry<String, CmsContainerConfiguration> entry : mapForLocale.entrySet()) {
                  String key = entry.getKey();
                  CmsContainerConfiguration config = entry.getValue();
                  for (CmsContainerElementBean element : config.getNewElements().values()) {
                      if (element.getId().equals(target.getStructureId())) {
                          names.add(key);
                      }
                  }
              }
          }
          return names;
      }
docs: Parses an inheritance group configuration C and returns the names of inheritance groups in C in which a given resource
  is defined as a new element.<p>
  
  @param cms the current CMS context
  @param inheritanceConfig the inheritance configuration resource
  @param target the resource to search in the inheritance configuration
  
  @return the names of the inheritance groups in which the target resource is defined as  a new element
  
  @throws CmsException if something goes wrong