Package sk.iway.iwcm.components.gallery
Class GalleryTreeService
java.lang.Object
sk.iway.iwcm.components.gallery.GalleryTreeService
-
Constructor Summary
ConstructorsConstructorDescriptionGalleryTreeService(GalleryDimensionRepository repository, jakarta.servlet.http.HttpServletRequest request) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckPathAccess(Map<String, Object> map, String virtualPath) Checks whether the current user has write access to the given virtual path.voidfindAndMoveGalleryFolder(String virtualPath, String parentPath, Map<String, Object> result, boolean updateInDoc) Finds aGalleryDimensionby its virtual path and moves it under the specified parent path.Get List of GalleryJsTreeItem for specified URL address (e.g.updateInDocWarning(Prop prop)
-
Constructor Details
-
GalleryTreeService
public GalleryTreeService(GalleryDimensionRepository repository, jakarta.servlet.http.HttpServletRequest request)
-
-
Method Details
-
getItems
Get List of GalleryJsTreeItem for specified URL address (e.g. /images/gallery)- Parameters:
url-- Returns:
-
checkPathAccess
Checks whether the current user has write access to the given virtual path. The path must start with/imagesand the user must have folder write permission. If access is denied, theresultanderrorkeys are set in the provided map.- Parameters:
map- response map whereresult=falseand anerrormessage are set on failurevirtualPath- virtual path to check (e.g./images/gallery/subfolder)- Returns:
trueif access is allowed,falseotherwise
-
findAndMoveGalleryFolder
public void findAndMoveGalleryFolder(String virtualPath, String parentPath, Map<String, Object> result, boolean updateInDoc) Finds aGalleryDimensionby its virtual path and moves it under the specified parent path. The following operations are performed on a successful move:- Updates the
GalleryDimensionpath in the database. - Renames the physical directory on the file system.
- Updates
image_pathin thegallerytable. - Registers a 301 redirect from the old path to the new path.
- Optionally replaces all occurrences of the old path in page content (doc).
result=falseand anerrormessage 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 withresult(boolean) and optionallyerror(String)updateInDoc- iftrue, replaces all occurrences of the old path in page content
- Updates the
-
updateInDocWarning
-