Class StudioUtils

java.lang.Object
org.craftercms.studio.api.v2.utils.StudioUtils

public abstract class StudioUtils extends Object
  • Constructor Details

    • StudioUtils

      public StudioUtils()
  • Method Details

    • getMimeType

      public static String getMimeType(String filename)
    • getSiteId

      public static String getSiteId()
      Obtains the siteId from the current request, always fails if called out of a request context
      Returns:
      the siteId
    • matchesPatterns

      public static boolean matchesPatterns(String path, List<String> patterns)
    • getTopLevelFolder

      public static String getTopLevelFolder(String path)
      Gets the top level folder where path is contained. The result will be a value from the list defined at StudioConstants.TOP_LEVEL_FOLDERS, if found, null otherwise.
      Parameters:
      path - the content path
      Returns:
      top level root path, if matched, or null otherwise
    • getStudioTemporaryFilesRoot

      @NonNull public static Path getStudioTemporaryFilesRoot()
    • getSandboxRepoLockKey

      public static String getSandboxRepoLockKey(String siteId)
      Get the key for sandbox repo operations lock
      Parameters:
      siteId - the site id
      Returns:
      the lock key
    • getSyncFromRepoLockKey

      public static String getSyncFromRepoLockKey(String siteId)
      Get the key for sync-from-repo task lock
      Parameters:
      siteId - the site id
      Returns:
      the lock key