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 FileUploadStateapplyHydration(FileUploadState state, Map<String, Asset> foundAssetsById) findAssetsAndCollectToMap(List<String> assetIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected AssetService<Asset>protected AssetgetHydratedOrLog(Asset unhydrated, Map<String, Asset> foundAssetsById) Returns the fully-populated instance ofunhydratedif it was found, otherwise logs a warning and returnsunhydratedas-is.hydrate(FileUploadState unhydrated, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Gets the IDs ofAssetsthat 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:FileUploadStateHydrationServiceGets the IDs ofAssetsthat 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:
hydratein interfaceFileUploadStateHydrationService- Parameters:
unhydrated- the unhydratedFileUploadStatewhose references should be hydratedcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- the given
unhydratedinstance after hydrating its references
-
determineReferencedAssetIds
-
findAssetsAndCollectToMap
-
applyHydration
-
getHydratedOrLog
Returns the fully-populated instance ofunhydratedif it was found, otherwise logs a warning and returnsunhydratedas-is.- Parameters:
unhydrated- theAssetinstance 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
unhydratedif it was found infoundAssetsById, otherwise the givenunhydratedinstance as-is
-
getAssetService
-