Class CommonExportUtils


  • public final class CommonExportUtils
    extends Object
    The common utility that contains some useful methods that can be reused in the export endpoints.
    Author:
    Dima Myroniuk (dmyroniuk)
    • Method Detail

      • isExportFinished

        public static boolean isExportFinished​(Export export)
        Determines whether or not this export is finished.
        Parameters:
        export - the entity that holds the basic information about the export
        Returns:
        true if this export has ExportStatus.FINISHED status
      • isExportBelongsToCurrentApplication

        public static boolean isExportBelongsToCurrentApplication​(Export export,
                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Determines whether or not this export belongs to the application from the context.
        Parameters:
        export - the entity that holds the basic information about the export
        contextInfo - context information
        Returns:
        true if this export belongs to the application from the context
      • getApplicationIdFromContext

        @Nullable
        public static String getApplicationIdFromContext​(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Gets the application id from the context.
        Parameters:
        contextInfo - context information
        Returns:
        the application id from the context
      • isExportBelongsToCurrentTenant

        public static boolean isExportBelongsToCurrentTenant​(@NonNull
                                                             Export export,
                                                             @Nullable
                                                             com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Determines whether or not this export belongs to the tenant from the context.
        Parameters:
        export - the entity that holds the basic information about the export
        contextInfo - context information
        Returns:
        true if this export belongs to the tenant from the context
      • getTenantIdFromContext

        @Nullable
        public static String getTenantIdFromContext​(@Nullable
                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Gets the tenant id from the context.
        Parameters:
        contextInfo - context information
        Returns:
        the tenant id from the context
      • getUserFriendlyFilenameForExport

        public static String getUserFriendlyFilenameForExport​(Export export)
        Creates the user friendly file name for the current export.
        Parameters:
        export - the entity that holds the basic information about the export
        Returns:
        the user friendly file name
      • contextMissingAuthorResponse

        public static org.springframework.http.ResponseEntity<Object> contextMissingAuthorResponse()
        Creates the response entity with the error message that currently authenticated user cannot be found.
        Returns:
        the response entity with the error message