Class GalleryTreeService

java.lang.Object
sk.iway.iwcm.components.gallery.GalleryTreeService

@Service @RequestScope public class GalleryTreeService extends Object
  • Constructor Details

    • GalleryTreeService

      public GalleryTreeService(GalleryDimensionRepository repository, jakarta.servlet.http.HttpServletRequest request)
  • Method Details

    • getItems

      public List<GalleryJsTreeItem> getItems(String url)
      Get List of GalleryJsTreeItem for specified URL address (e.g. /images/gallery)
      Parameters:
      url -
      Returns:
    • checkPathAccess

      public boolean checkPathAccess(Map<String,Object> map, String virtualPath)
      Checks whether the current user has write access to the given virtual path. The path must start with /images and the user must have folder write permission. If access is denied, the result and error keys are set in the provided map.
      Parameters:
      map - response map where result=false and an error message are set on failure
      virtualPath - virtual path to check (e.g. /images/gallery/subfolder)
      Returns:
      true if access is allowed, false otherwise
    • findAndMoveGalleryFolder

      public void findAndMoveGalleryFolder(String virtualPath, String parentPath, Map<String,Object> result, boolean updateInDoc)
      Finds a GalleryDimension by its virtual path and moves it under the specified parent path. The following operations are performed on a successful move:
      • Updates the GalleryDimension path in the database.
      • Renames the physical directory on the file system.
      • Updates image_path in the gallery table.
      • Registers a 301 redirect from the old path to the new path.
      • Optionally replaces all occurrences of the old path in page content (doc).
      On any error the result=false and an error message are placed into the result map.
      Parameters:
      virtualPath - current virtual path of the gallery folder (e.g. /images/gallery/old)
      parentPath - target parent virtual path under which the folder will be moved (e.g. /images/gallery/new-parent)
      result - response map populated with result (boolean) and optionally error (String)
      updateInDoc - if true, replaces all occurrences of the old path in page content
    • updateInDocWarning

      public NotifyBean updateInDocWarning(Prop prop)