Class DefaultFileUploadStateHydrationService
java.lang.Object
com.broadleafcommerce.asset.service.DefaultFileUploadStateHydrationService
- All Implemented Interfaces:
FileUploadStateHydrationService
public class DefaultFileUploadStateHydrationService
extends Object
implements FileUploadStateHydrationService
- Author:
- Samarth Dhruva (samarthd)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FileUploadState
applyHydration
(FileUploadState state, Map<String, Asset> foundAssetsById) findAssetsAndCollectToMap
(List<String> assetIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected AssetService<Asset>
protected Asset
getHydratedOrLog
(Asset unhydrated, Map<String, Asset> foundAssetsById) Returns the fully-populated instance ofunhydrated
if it was found, otherwise logs a warning and returnsunhydrated
as-is.hydrate
(FileUploadState unhydrated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs ofAssets
that are referenced byunhydrated
, finds the corresponding items in the data store, and then replaces each reference with the fully populated representation of the item.
-
Constructor Details
-
DefaultFileUploadStateHydrationService
-
-
Method Details
-
hydrate
public FileUploadState hydrate(FileUploadState unhydrated, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:FileUploadStateHydrationService
Gets the IDs ofAssets
that are referenced byunhydrated
, finds the corresponding items in the data store, and then replaces each reference with the fully populated representation of the item.- Specified by:
hydrate
in interfaceFileUploadStateHydrationService
- Parameters:
unhydrated
- the unhydratedFileUploadState
whose references should be hydratedcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the given
unhydrated
instance after hydrating its references
-
determineReferencedAssetIds
-
findAssetsAndCollectToMap
-
applyHydration
-
getHydratedOrLog
Returns the fully-populated instance ofunhydrated
if it was found, otherwise logs a warning and returnsunhydrated
as-is.- Parameters:
unhydrated
- theAsset
instance containing just an ID for which a fully-populated replacement instance should be foundfoundAssetsById
- a map of assets found in the datastore by their ID. This map will be used to source the replacement instance forunhydrated
.- Returns:
- the fully-populated version of
unhydrated
if it was found infoundAssetsById
, otherwise the givenunhydrated
instance as-is
-
getAssetService
-