Class StorageUtils

java.lang.Object
com.broadleafcommerce.asset.service.support.StorageUtils

@Deprecated(forRemoval=true, since="1.7.8") public final class StorageUtils extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
This logic was moved to an extensible bean: AssetStorageUtils.
Utility class containing helpful functionality pertaining to the storage and processing of Assets by the StorageService.
Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Takes a valid mime type (for example, "image/png") and converts it to a general DefaultAssetType for use as Asset.getType().
    static String
    getContextAwareAssetUrlPrefix(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the tenant discrimination prefix that would be applied to an asset URL for the given context.
    static String
    getContextAwareUrl(Asset asset, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the Asset.getUrl() prepended with a tenant discriminated prefix based on the ContextInfo.
    static String
    prependContextAwarePrefix(String assetUrl, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the assetUrl prepended with a tenant discriminated prefix based on the ContextInfo.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • determineAssetTypeFromMimeType

      public static DefaultAssetType determineAssetTypeFromMimeType(String mimeType)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Takes a valid mime type (for example, "image/png") and converts it to a general DefaultAssetType for use as Asset.getType().
      Parameters:
      mimeType - the mime type to examine and determine the general type for
      Returns:
      the best guess for the general asset type, or DefaultAssetType.UNKNOWN if it cannot be determined
    • getContextAwareUrl

      public static String getContextAwareUrl(@NonNull Asset asset, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the Asset.getUrl() prepended with a tenant discriminated prefix based on the ContextInfo. This is purely a convenience method equivalent to calling prependContextAwarePrefix(String, ContextInfo) with Asset.url as the first argument.
      Parameters:
      asset - the Asset for which to create a context-aware URL
      contextInfo - context information surrounding multitenant state
      Returns:
      the Asset.getUrl() prepended with a tenant discriminated prefix based on the ContextInfo
      See Also:
    • prependContextAwarePrefix

      public static String prependContextAwarePrefix(@NonNull String assetUrl, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the assetUrl prepended with a tenant discriminated prefix based on the ContextInfo. This mostly delegates to getContextAwareAssetUrlPrefix(ContextInfo).

      If ContextInfo is null or has a null application ID and null tenant ID, the output will be {assetUrl}. If ContextInfo has a null application ID but present tenant ID, the output will be "/tenants/{tenantId}/" + {assetUrl}. If ContextInfo does have a application ID, the output will be "/applications/{applicationId}/" + {assetUrl}.

      Parameters:
      assetUrl - the url to which the tenant-discriminated prefix should be prepended
      contextInfo - context information surrounding multitenant state
      Returns:
      the assetUrl prepended with a tenant discriminated prefix based on the ContextInfo
      See Also:
    • getContextAwareAssetUrlPrefix

      public static String getContextAwareAssetUrlPrefix(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the tenant discrimination prefix that would be applied to an asset URL for the given context.

      If ContextInfo is null or has a null application ID and null tenant ID, the output will be "". If ContextInfo has a null application ID but present tenant ID, the output will be "/tenants/{tenantId}". If ContextInfo does have a application ID, the output will be "/applications/{applicationId}".

      Parameters:
      contextInfo - context information surrounding multitenant state
      Returns:
      the tenant discrimination prefix that would be applied to an asset URL for the given context
      See Also: