Class AssetValidator

java.lang.Object
com.broadleafcommerce.asset.service.validation.AssetValidator
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator

public class AssetValidator extends Object implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
Validations for Asset.
Author:
Samarth Dhruva (samarthd)
  • Constructor Details

    • AssetValidator

      public AssetValidator()
  • Method Details

    • setAssetService

      @Autowired @Lazy public void setAssetService(AssetService<Asset> assetService)
      Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions
      Parameters:
      assetService - the asset service
    • setFolderService

      @Autowired @Lazy public void setFolderService(FolderService<Folder> folderService)
      Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions
      Parameters:
      folderService - the folder service
    • supports

      public boolean supports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      supports in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validate

      public void validate(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      validate in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validateType

      protected void validateType(Asset asset, org.springframework.validation.Errors errors)
    • validateUrlAndEmbedCode

      protected void validateUrlAndEmbedCode(Asset asset, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • validateStorageType

      protected void validateStorageType(org.springframework.validation.Errors errors)
    • validateStorageTypeDependentFields

      protected void validateStorageTypeDependentFields(Asset asset, org.springframework.validation.Errors errors)
    • validateMimeType

      protected void validateMimeType(org.springframework.validation.Errors errors)
    • validateLastUpdatedDate

      protected void validateLastUpdatedDate(Asset asset, org.springframework.validation.Errors errors)
    • validateFolderId

      protected void validateFolderId(Asset asset, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getAssetService

      @NonNull protected AssetService<Asset> getAssetService()
    • getFolderService

      @NonNull protected FolderService<Folder> getFolderService()