code: @SuppressWarnings("deprecation")
      private List<CmsResource> getGalleriesByType(int galleryTypeId) {
  
          List<CmsResource> galleries = new ArrayList<CmsResource>();
  
          // We swallow errors in this method because we don't  want a failure to read some folders (e.g. because of permission problems) to
          // cause an empty gallery list as a result
  
          try {
              galleries.addAll(
                  getCmsObject().readResources(
                      "/",
                      CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId)));
          } catch (Exception e) {
              LOG.error("Could not read site galleries: " + e.getLocalizedMessage(), e);
          }
  
          String siteRoot = getCmsObject().getRequestContext().getSiteRoot();
          // if the current site is NOT the root site - add all other galleries from the system path
  
          try {
              if (!siteRoot.equals("")) {
                  List<CmsResource> systemGalleries = null;
                  // get the galleries in the /system/ folder
                  systemGalleries = getCmsObject().readResources(
                      CmsWorkplace.VFS_PATH_SYSTEM,
                      CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId));
                  if (systemGalleries != null) {
                      // add the found system galleries to the result
                      galleries.addAll(systemGalleries);
                  }
              }
          } catch (Exception e) {
              LOG.info("Could not read system galleries: " + e.getLocalizedMessage(), e);
          }
  
          try {
              if (!OpenCms.getSiteManager().isSharedFolder(siteRoot)) {
                  String shared = OpenCms.getSiteManager().getSharedFolder();
                  List<CmsResource> sharedGalleries = getCmsObject().readResources(
                      shared,
                      CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(galleryTypeId));
                  if (sharedGalleries != null) {
                      galleries.addAll(sharedGalleries);
                  }
              }
          } catch (Exception e) {
              LOG.info("Could not read shared galleries: " + e.getLocalizedMessage(), e);
          }
          return galleries;
      }
docs: Generates a list of available galleries for the given gallery-type.<p>
  
  @param galleryTypeId the gallery-type
  
  @return the list of galleries